Sign in to follow this  

How to create a typical "Dungeon Master" type of game?

Recommended Posts

shinypixel    226

With a few games on my belt, I'm interested in making something similar like this.


I'm trying to understand how they are made. You typically press arrows to make pictures move, but the pictures are interactive - something like fake 3d in pixel art.


To make it, is the "map" generally an array of vectors/linked lists?


Say, array[5][3] contains artwork ID #5 of a wall. But the linked list still shows there's more in this cell, such as a removable item on the wall, a bag of money on the bottom, directions that allow moving to, any current enemies in this cell, etc.


I'm wondering if that's the typical way of making these games?

Edited by shinypixel

Share this post

Link to post
Share on other sites

Maybe you should start a prototype of your current idea.  Limit it to a 3x3 set up.  You could quickly get something going just using an array of Level.  

In the level you could have a class called MoveableDirection that keeps track of possible movement directions.  It could also include a method that sets its neighbor to be open after you open a door with a key.    


You seem to have the right idea with how the art would work.  You'll need to create an animator class and draw each view from scratch.  Another way is to build it in 3d and simulate an oldschool feel.  The player would be teleported to the next spot instead of walking.  Have you looked at the free version of Unity yet?


The problem as I see it now, is that you'll probably have to create an editor that helps you set up the rooms since there will be a lot of manual templating.  You might as well build something to help you with that.  It could be a good learning experience by itself.


While creating something like this, I would always be asking myself "How can I make this more modular?"  What design steps can you take that will help remove tight coupling between levels?  You'll probably want to swap rooms at one point, for example (maybe during compile time, or maybe during run time as a puzzle).  

Edited by Keith G

Share this post

Link to post
Share on other sites
aregee    1072

There are probably several ways to do this, but I guess the map is some sort of maze like thing.  There are probably lots of ways you could go about the structure, but I guess the most basic one would be a 2D array with flags for visible walls, "hard" walls (you can often walk through walls to secret rooms, etc.)  Instead of flags, you can have 3 bits for each wall, for instance, being an ID for which appearance the wall has.


Another way I am thinking, is to have a 2D array of pointers, pointing to structures or classes that define the rooms in more detail.  This would allow for a lot more flexibility.


The fake 3D thing is piecing together sections of the maze with some sort of perspective.  Think about a square, make a x through both diagonals, there you have the perspective.  Now you can split it in sections, how far ahead do you see before you can turn left, etc.  It really should be pretty straight forward. Just study how it is done in other games.  It shouldn't be too hard.


Here is a picture I found to illustrate what I mean: just fill the walls, ceiling and floor with the graphics you like.

Edited by aregee

Share this post

Link to post
Share on other sites
laztrezort    1058

For the map structure, it can be the same as a typical top-down maze or dungeon game (similar to a rougelike game). Each map cell represents a feature (open space, wall, well, chest, etc.), like each square on a piece of graph paper.


Some old school games represented walls as divisions between cells (the lines between squares on graph paper), so you can have thin walls separating two cells.  This is a bit harder to implement, and it doesn't look like the linked video uses this method.


There are basically 2 ways to go about drawing this, the truly old school way and to fake it using modern techniques.


For the old school approach, each feature (wall, door, chest) that appears at a certain location in the player's view needs is pre drawn on a sprite sheet.  Perspective needs to be baked into the assets.  It gets a bit complicated working out the walls in particular, probably need to work it out on piece of graph paper.  Here is an example "template" where the player is at * and looking north, each number/letter is a wall cell in the player's field of view:


When drawing a view, you will need to take the player location and facing direction and build a list of walls and features in the view, then draw them in the order of the template.  You will also need to have a static list of coordinates to know what and where to draw each wall sprite, depending on where it is in the player's view.  As a made up example:




This might mean that if wall "A" needs to be drawn, copy a rectangular region from the sprite sheet at  position 100,50, size 80,160 to screen position 0,20.  Drawing them in order (1,2,... D, E) and using transparency on the sprites allows use of the painter's algorithm.


This works fine but is a bit tedious to implement (especially creating the wall sprites and getting them to line up in a pleasing way).  That said, I've implemented such system a couple times and had fun doing it.


The other approach, which can be easier to implement (depending on your skill set) and much more extendable, is to fake it using 3D triangles.  Going this route means you just need to have a texture for the walls.  Field of view, lighting, animating movement and turning, fog - all these things are massively easier to add or tweak if using modern techniques.

Share this post

Link to post
Share on other sites
shinypixel    226

Hi there. Thanks for all the ideas so far.


I'm liking the 3D idea, and the player just teleports every 'n' value. The art would be easier and flexible, such as fog, rain, etc. Unfortunately, I've only done 2D things in C/C++/OpenGL. If there's an easy way to load 3d models, I think all I would really do is set the (x,y,z) location of each object and move the camera about. It doesn't feel too difficult to do. But then there's the 3d animation of monsters attacking, which I have no idea how to do. Now, unless the monsters were 2.5D using a rect, I would imagine it'd be easier animating a 2D figure. It sounds a bit beyond me, but with enough research before jumping into it, it would be easier to do.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this