Design a site like this with
Get started

Dungeon Tetris

With most of the actual game basics squared away, including dungeon generation, menus, UI and events for game-over and whatnot, its finally tetris time!

Last night I implemented the basics, using the SRS rotation algorithm, although I haven’t implemented wall kicks yet and not sure if I will. Wall kicks are where if you attempt a rotation, and there are blocking tiles (for example the side wall) then a few nearby places are checked, i.e. it’s ultimately moved away from the wall so that it can fit.

Anyway here we are! Note the floor tiles change when the blocks move, this is because the floor is just the one underlying terrain type for each base color, and the renderer picks the tile to display depending on the location of the cell within the level. This makes the checkerboard pattern super easy, but also makes it weird when you try to move it around.

The blocks all otherwise move as I would expect, and can even carry enemies/the player. I’ll have to add some checks to detect flying enemies and ignore them. Also if I want tetris blocks to carry torch pillars (I do) then I’ll need to move the light entities too. This might be hard because for wall torches, then light entity is actually in the tile in-front of the wall, so this might result in the light from torches being carried away while the torch stays in place 😛 I’ll figure it out anyway.

Another important thing is that with level generation, I need to ensure connectivity – that is the ability to actually reach the exit. With a tetris field, this isn’t guaranteed, the player might lock themselves away from a critical door. To fix this, I implemented a spawn strategy that creates tetronimoes in places they don’t quite fit, if there’s nowhere else for them to go. Firstly it looks for the least blocking space, then it tries to place as high as possible.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: