Making a game is hard. The sheer amount of stuff that needs to be done is insane, specially when doing it solo. I already got some stuff done, but my main goal for this beginning is to lay strong foundations for the project. The two systems I’m mainly working on are the Map system and the Player’s core mechanics. Although the first lines of code I wrote were to make a CharacterBody2D move and jump, I’ll start from the Map system because it’s where the idea of a game came to be (and my memory is still fresh from the last time I was working on it).

The Map System

There is one single thing in a Metroidvania that I need up and running the most in here: The minimap. It’s a must-have piece of user experience for the genre, as it provides the player with the notion of locality in a huge interconnected world. And I didn’t know shit about how to make one. As it turns out, the whole map system needs to work together for it to happen. The map system can be divided into 3 sections:

1. The Importers;
2. The Runtime;
3. The Minimap per se.

I’m sticking with Tiled map editor for the level design because it’s free and open-source, so I need a way to stuff the Tilemaps into Godot and build my scenes from that.

Starting with the importers: I tried some plug’n’play solutions, but none could work the way I wanted, so I decided to write one myself. Godot has an API for Importer Plugins, and they allow the editor to automatically trigger a reimport whenever the source asset changes. This means I can save changes directly to a Tiled project and the plugin will take care of reading the XML from the .tmx map file and rebuilding the scene tree. Here’s an overview of how it looks like:

Map system diagram Yes, I still use paper.

The plugin let the .tmx and tsx files live as first-class citizens inside the editor, acting as proxies to a runtime representation, which can be a scene. So, you just drag and drop the file into the scene to instantiate it. By the way, tilesets in Godot work in some really odd ways, some of which are quite limiting. For example, I had to fully write my own tile animation player as a workaround to the engine’s half-assed tile animations. Other times I had to do some very funky stuff on code to make it work. It took some time to get all things done right, but it was worth it.

The Minimap

As I have, now, full control over the importing phase of the maps, I took advantage of it to process the minimap data by reading the tiles from each map’s collision layer and combining it with the map’s world positional data, procedurally generating the minimap in the process.

When run, the HUD loads the minimap data into a stateful model, then used to draw the minimap on screen in real-time. The player’s position is globally tracked at all times so that it can “visit” the cells and explore the map. It’s all configurable, with colors, style and drip. I definitely got the basics right, thanks to some already existing plugins. Anyways, I still need to fine-tune some parts to control better how intel is given to the player, and add map indicators for important stuff.

The way the minimap works internally is quite ingenious, but I can speak about it in another time. For now, here’s the first screenshot of the game running:

First screenshot