Tag: roguelike

Designing a Rogue-like game for book two

Designing a Rogue-like game for book two

My 2nd eBook is going to be a bit like the first one- first it teaches C but it is oriented towards Raspberry Pis.  Then it shows how to program Asteroids (like the first book) followed by a Match three game and finally a Rogue type dungeon explorer game.

Rogue like game

Dungeon assets from itch.io
Dungeon assets

Now some rogue-likes stay true to the originals which were text based. Like this above from an article on Wikipedia. Now that’s ok, but I fancy something a bit more colourful so I’m going to use 16 x 16 pixel graphics.

I did a bit of searching and found these dungeon graphics on itch.io. I’ll use those to start with but may change. The view is not quite top down but top down with a bit of isometric in it. It looks better than pure top down.

So I figure the game has to have these elements.

(1) Generate a dungeon with multiple rooms and levels and stairs between,

(2) Fill the dungeon with monsters and treasures.

(3) Move the player’s character through the dungeon fighting monsters, picking up things including keys and maintaining a small inventory.

(4) Add some side quests like needing to find keys to open a chest with a magical item.

(5) I’ll also need to devise a simple combat system with magic.

Do monsters move- you’d hope so. How are rooms connected, in fact how are dungeons generated? I created a dungeon generator for the postal game Quest 30 years ago and can remember how I did it so there’ll will be that to implement in C.

I’m also going to leave out things like needing food and water.

So there it is now. Now to start writing the software. I’ll update this with progress reports.

Drawing  dungeon rooms using characters

Drawing dungeon rooms using characters

Some roguelike roomsThe final game will use graphics but those graphics will be based on characters, so I’ve started off by drawing a room or two using the provided extended ASCII characters.

Here for example is an 8 x 8 cell room with four inner columns and four possible doors. I’ve used spaces in one and full stops in the other to see which looks better. I think I prefer full stops as you can count them but it’s not a big difference.

╔════╬═╗  ╔════╬═╗  /----\
║      ║  ║......║  |....|
║ ╬  ╬ ║  ║.╬..╬.║  #....|
╬      ╬  ╬......╬  |....|
║      ║  ║......║  \.||./
║ ╬  ╬ ║  ║.╬..╬.║
║      ║  ║......║
╚═╬════╝  ╚═╬════╝

The 3rd room is smaller and roughly octagonal though not as nice looking. I used the normal ASCII characters for that with the two slashes ( / and \ ) as well as # for a vertical wall door and two | for a double door. Here’s a corridor that goes round two corners and then meets another one.

═══     ╔════╦══
   ╚════╝    ║

There are plenty of ASCII character charts and I used this one which describes all the graphical chars making it easy, albeit a bit tedious to draw these in any text editor. There are single box characters as well as the double ones I’ve used. The ╬ character has proved very versatile as it provides not only columns but doors in both horizontal and vertical walls.

It’s noticeable that despite this room being square, it looks rectangular thanks to characters being taller than wide. Also in WordPress, the gaps between lines are more noticeable as gaps whereas in Notepad++ (the editor I used to create these) as shown in the image at the top, these gaps are absent.

How to implement a Roguelike

How to implement a Roguelike

Roguelike dungeon
From Wikimedia

A roguelike is a character based fantasy game. By character I mean @^! not an individual as such! A question on the C SubReddit had asked about Project ideas for simple applications and someone had suggested a Roguelike. It’s not a bad idea but probably quite a bit more than just a simple project.

So I suggested breaking it down into stages. Here’s what I said.

Rather than a roguelike in one go (that’s a actually quite a bit of code) so do it in these stages.

  1. A Dungeon level generator. Create rooms and link them by corridors.

  2. Generate a bunch of levels – link them via randomly stairs, pits, transporters.

  3. Add random monsters and treasures in rooms.

  4. Implement a moving player able to navigate through the levels.

  5. Add combat. Weapons, range weapons, spell casting. Add monster hit points.

  6. Turn it into a polished game. Add everything else needed. Permadeath, collecting treasures. Moving monsters.

  7. (Optional) Make it multiplayer and allow PvP.

PvP means allow Player v Player combat. Doing it multiplayer is actually quite a lot of work which is why I made it an option. Rogues are often created using simple ASCII chars for monsters and treasures. Some programmers have used graphics and there are plenty of free graphics sets for 8 x 8 or 16 x 16 pixel sized monsters etc. like the Kenney.nl microrogue set. Shown in action below.

Kenney.nl micro rogue set in action

I am tempted to make this the 3rd game idea for the Raspi game book. 30 years ago I created a multiplayer postal game Quest that is still running albeit on the web not by post. That included a dungeon generator. It wasn’t in C but it’s easy enough to translate Turbo Pascal to C.