XaiJu
relativisticgame
relativisticgame

patreon


Week 51: tiled-based levels

I spent Monday and Tuesday improving support for bitmap animations in my engine. I am using this feature to render animations on the robot’s screen. Well, you may have noticed that I included one experimental animation in the last video I posted. That one, however, was achieved by loading the animation frame by frame. With the work I did this week I can load it all from one single file. I also developed tooling to improve editing and working with animations. This will be handy soon, as I want to have the robot communicate through its screen. For example, the robot will give hints to the player about the buttons to press (well, during the first levels). It will also use animations to convey information (e.g. showing time or hinting that it is connecting wirelessly to the facility’s computers) and convey emotions (e.g. in dialogues with other characters.)

I spent the rest of the week developing infrastructure to design the game levels. This is one crucial piece of work. I need to be able to easily design levels, create walls and rooms with very little effort. I was tempted to prototype a 3D renderer for the background, but I concluded it would be too much work. For now, the levels will stay 2D but I’ll gradually include more lighting effects and make it interesting.

I opted for a tile-based approach. The prototype I made subdivides the level into 127x127 cells. The vertices of the cells thus form a 128x128 grid of points. I provide a depth value for each of them.  This is a number between 0.0 and 1.0. The depth is 0.0 inside the room and 1.0 outside it (inside the walls.) The depths are currently provided via a PNG image. You can see below how this image looks. 

The depth values are then used to calculate a map (Signed Distance Function map) for collisions. The depths are also used to draw the room, but this approach doesn’t work well. I will replace it with a better tile-based rendering, where each cell is filled with a choice of available pre-drawn tiles.

With this post I share a video of what I currently have. It is full of artifacts, but I am nonetheless quite pleased with the results of this initial prototyping. I can now draw a level quickly with an image editor. The game loads it and handles collisions with the walls. It shouldn’t be too difficult to go a step further and have a level editor inside the game.


More Creators