SamSuka
castpixel
castpixel

patreon


How to make a 2D dungeon crawler in 3 days

 

Hi all!

Here’s a post-mortem for Lands of TSR Lore , my tiny dungeon crawler made from scratch!

This was my 10th Ludum Dare and I thought I’d treat myself.

Early on I realized I will have no fun if I follow the theme, my ideas weren’t exceptional. What I thought was a fun idea about growth was, in fact, just an idea about leveling up in an rpg. Nothing better was coming, and since my internet connection chose that time to abandon me for 6 hours (yes, thank you internet gods), I felt less and less inspired.

Instead of despairing and spoiling all the fun for myself, like I usually do, I decided I’d just make a tiny rpg thingy. An old-school 2D (2.5D?) dungeon crawler, like Eye of the Beholder, Lands of Lore, Wizardry, Etrian Odyssey, the sort of games that felt magical to me, because the potential was there for a 3D world made of carefully pixeled pixelart. The closest pixelart can get to being immersive, without actual 3D transformations like wolfenstein (which kind of spoils it for me).

So, what went well?
First of all, a TON of code. I spent a ton more time coding than any other LD. I also spent a ton more time coding than I did content creation, which is refreshing because I’m always self-conscious that my art is better than my code is. Here’s all my “event groups” (it’s how Construct 2 allows you to organize code).

Each of those groups contains 3-4 dozen events. And not just if/then statements and quick solutions, I had to think hard about the algorithm that renders this:

into *this*:
Here’s the code by the way:

After a lot of headscratching, trigonometry saved the day: I made code that can read a bunch of 2d tile positions in the 4 cardinal directions at once, instead of having to input each separately. This code reduction is important, because tiles, monsters and objects (and later on, decorations) are going to be using the same function. Making changes is certainly easier the less code I have.
The basic idea was: the sine and cosine of 0,90,180 and 270 degrees have this useful property of having values of -1,0,1. So why not incorporate the code for checking for North/South and East/West in the same line, but multiply each half with either sin() or cos(), half the line is multiplied by 0, and the other half remains.

The inventory: I started this on a whim near the end, so you could pick up those shields.

Naturally I fumbled with the visualization code for the inventory and didn’t want to waste more time on it. Therefore all the shields you pick up just crumble to dust. I’m sorry ^-^’ The crumbly ancient shield graphic is from Eye of the Beholder by the way, I thought it was funny, since it’s a 24 year old game. I certainly feel old for having played it when it came out

I made a wall set by using a 1-point perspective set of lines, and decided I wanted some extra bits sticking out in corners, for the thing to look more 3-dimensional (ergo the pillars in the front row)


I also thought how cool it would be to have the dungeon sort of smoothly transition from one tile to another, like Land of Lore first did. I probably used the same trick as they did, I used r0j0hound’s html5 canvas plugin for Construct, which allows me to take a screenshot and then manipulate it (scale it up) over the course of 3 frames, while also repositioning it to keep the horizon line level. This,  along with mirroring the floor and wall graphics with each step (still a little buggy) gives a very solid illusion of moving forward, comparable to even recent AAA titles (Etrian Odyssey).

The whole game window is 192×108 pixels, smaller than SNES resolution, the height is smaller than even gameboy resolution. It’s the only way to get away with pixelart that looks good and polished.


Tiny screen size means it’s not overkill to have 11 frames of attack animation. It’s basically a 50×50 sprite, quite reasonable for platformers and such, and absolutely screen-filling at this size

I like the dungeon music I wrote, inspired by Wizardry and Westwood studios’ brilliant Adlib music, using a Yamaha chip emulator called JuceOPLVSTi

Dungeon Music

More things that went right:

What went wrong:

I know people make genius experiences for LD that last hours or have that wow factor and innovation. I admire and respect them, and hope I’ll have that spark of creativity myself some day. Until then, I’m happy to just chip away at little problems, learning to think like a coder, making game spaces I can explore. Thanks for being here for the ride and reading about it.

I love LD!

Comments

That 3D system looks incredible, congrats!

SuperBiasedGary

Wow! I envy you, I wish I was that good at programming O_O Kudos!

TeamTailnut

Awesome, and with construct2 :3

Gillenew

EPIC JOB.

Daniel Scofano

Awesome work!!!!


More Creators