Yet Another Dungeon Pixel Game

Quick Intro

I’ve been working on creating a feel small games lately. I decided to not use any engine and instead use a library and from there implement everything necessary. I chose SDL2 as the base library for this game prototype for a couple of reasons:

  • I want to refresh my C++ skills.
  • I want to have fun an implement some of the core functionalities of the game.
  • I’m not in a rush, so I can take my time, and do the thing without pressure.
  • I want to use this as a learning project for various things.

What are the basic elements of a dungeon game?

A player

At least one player is mandatory. The player will be able to move througout the dungeon. The player should be able to move left, right, up, down. No diagonal move will be supported.

A player can also shoot enemies.

A dungeon

At least one dungeon is required to have something minimal playable. More dungeons are welcomed, but one is what I expect to build in this prototype.

A dungeon has an entry point, or a spawn point, where the player will start, and has an exit, usually a door, where the player will exit the dungeon and either go the the next one or end the game.

Enemies

A dungeon can have one or many types of enemies. This prototype will have only one type of enemy.

Enemies can attack you and harm you. If you don’t defend yourself and kill the enemies, you’ll eventually be killed and the game will be over.

Enemies die when you harm them enough.

Some will die easily, some will die only after some x amount of hits.

Pick-up items

Various pick-up items will be spread within the dungeon.

The player will be able to pick the items up.

Each new pick-up will count on the players score.

Items available on the prototype will be a heard and a coin.

Sounds

A sound should be heard when:

  • Shooting the enemy
  • Player dies
  • Player gets hit by enemy
  • Starting on a new dungeon
  • Exising the dungeon

The Most Basic Flow

The most simple dungeon game flow would look like this:

The player starts the game at the first dungeon which has a certain level of difficulty.

The player’s goal is to reach the exit of the dungeon without being killed by the enemies along the way and pick-up as much as possible pick-up items.

Once the player reaches the exit of a dungeon, the player moves to the next level, which will be another dungeon with an increased level of difficulty.

Once the player goes through all the dungeons, the game ends.

Milestones

Milestone #1 - A boring but functional dungeon

Create a game that has 1 dungeon where the player can navigate through moving left, right, top, down.

Don’t add anything else now, just the dungeon, the logic to enter/exit the dungeon and also the logic to detect the end of the game.

Play a sound then the level starts.

Play a sound when the player exits the dungeon.

Update one:

Some progress was made.

The player movements are ready. Support for animations and collision detection were added as well.

First dungeon and movement ready
Some progress.

Update two:

This milestone is completed. The current version now has the ability to define where in the map the exit door will exist and detect when the player goes through it. Also, when the level starts a sound is played and when the player exits the level another sound is played.

With that I conclude the work for this weekend. Next weekend I’ll work on the implementation of the second milestone! Yay!

First milestone completed!
First milestone completed!

Milestone 2 - Pick-up items

Add a heart and a coin item and spread them inside the dungeon’s floor at random locations.

The amount of hearts and coins will be manually set for now based on a proportion of the number of floor tiles available in the map.

Milestone 3 - Picking-up items

Implement the logic to allow the player to pick-up the items from the floor and create a counter for each type of pick-up item.

Add a sound to each pickup to make the game more fun :)

Milestone 4 - Camera follow

In order to be able to have proper dungeon maps, the world size, which is set by the size of the tile map, is now limited to 320x160 pixels, allowing us to have 20x10 tiles. I’d like to double that, meaning we’d have a tile map of 40x20 tiles, which will allow me to create more challenging dungeons.

With the increase of the world, we’d have to still keep the same aspect ratio and only see a portion of the world relative to the player’s position. This is the most basic for of a camera.

The goals of this milestone are then to increase the size of the world, and implement a camera follow that will be relative to the player position and of the size of the screen size (1280x640).

Update on (08.03.2022):

Today is the international women’s day and it’s a holiday here in Germany. I took part of the day to work on this milestone and implement the increased world size and the camera follow. I have a basic working version for the prototype which I’m happy with, so I consider this milestone achieved.

The world now has 40x20 tiles and can support a more complex dungeon. The player can also navigate through the dungeon’s corridors connecting different rooms and the camera will follow the player.

World size increased and camera follow is now working
World size increased and camera follow is now working