Let’s talk about Godot tilemaps. Have you ever played a 2D platformer or Metroidvania and wanted to know how it is made? Maybe you are already making one. I’m back for another insight into the cryptic, enigmatic, secretive, open-source world of indie game development. Tongue-in-cheek there. But I am reaching out to you devs out there to talk about some very useful primary knowledge in Godot TileMaps! Particularly beginners.
Before You Start
This how-to is specifically aimed at solo devs who are in the very beginning stages of learning Godot for a game project. Most GoDo intro tutorials take you through the steps of making a basic physics-based platform test. You should be able to find what you need on the Godot website. Otherwise, here we go!
Godot TileMaps: Let’s Get Started
If you’re working on your foundational project made from a tutorial, it might be a good idea to create this project as a new scene within that project file on Godot.
The first thing you’ll need is a tileset. This is the collection of tile pictures that you put on your tilemap so that you can switch between angles and depths of the terrain easily. You can make them yourself, in fact, I suggest it, but just start off with a free tilemap first.
The main place I look for game assets is itch.io. There you can specify free sets only, sliding scale, or you can see what’s for sale. Just keep in mind that tile sizes will affect how they are implemented. The TinyRPG set in this tutorial is 16×16, but you’ll find others for 8×8.
Okay NOW Let’s Learn About Godot TileMaps
It is not my intention to create a full tutorial here. I just want to provide a summary of what kind of tools are available. These are very organized and documented methods, and should at least give you a foundation to move forward. The internet is a living breathing pulsating system of tubes that require how-to’s, cause who has time for the whole story. I promise I’ll give you enough to sink your teeth in here in the beginning though.
- Make a Node and rename it to Scene. Create a child node with the TileMap node type.
- On the right under Inspector, find the drop-down labeled Tile Set. Select your New Tile Map.
- Click on the file name that is now listed in the dropdown menu.
- Using your tileset image, which you can add to your directory if you like, add the image file by dragging it into the open area on the left. A preview should appear.
- You can press Shift+F12 at any time to make the tilemap more visible
- If you are using the TinyRPG set, press New Single Tile near the upper right.
- Select Single New Tile. You can also use auto-tile, but I’m using a single tile for this how-to.
- Carve the tile set pieces. This will help you create mini sprites for moving forward.
- Click on the tilemap in your node window to the left again.
- You should have a nice vertical bar to the right and left of the inspector. Your carved pieces will be selectable and placeable within the grid.
- Create as many tiles as you want. Create your own landscape with them.
- Save versions as you work. Ctrl + Z if you need to erase a step or go backward.
That’s pretty much it for taking your tileset and importing it manually in the game. It might seem tedious honestly, but you’re sure you find shortcuts the more you experiment.
This Then That
There’s some different stuff you can do once you have your tileset. The most obvious thing is to give a 2D sprite/character/avatar somewhere to run around and jump on. What I chose to do was important to my logo, Mr. Dave Pizza. I tried to copy and paste the new tileset, but this is not how Godot works. Thankfully I hadn’t gone very far, so I just started a new scene and recreated the tileset very quickly. (By the way, you’ll only need about 4 or 5 tiles to get started, although you can do more. The asset pack for the tutorial has several pieces should you need them.)
Pay attention to the grid snap function. Everything is A LOT easier if you understand you can do everything on a grid. I spent a good while trying to figure out how to get my collision shape player script from my physics tutorial to work on this step in this experiment. There are certainly methods to add non-rectangular polygon outlines to your landscape, but I think rectangular is the way to go in this stage, although I suppose you could round the corners.
Once you create your tilemap, it is fairly portable within your project. I encourage you to make sure your sprites, tiles, and player, are parallel on the grid. Once they are everything should add up quite neatly.
Godot TileMaps: Just a Couple Last Things
I decided to add two last things. Music. And a camera. (A game camera) The music was easy, just a node, audiostreamplayer2d, and add a creative commons OGG file. In this case, it was Fluxus by Skye Jordan on ccMixter. I downloaded the mp3 and then converted it. Did I mention all of this was free?
The camera was a method described in the last issue’s tutorial. It is pretty easy, add a camera node under your player node, enable current, center the purple box, quickly resize if necessary, and you’re done.
TileMaps: That’s It!
This took me at least 3-4 hours. From what I learned, that’s a bargain for time investment. There are so many tilesets and so many game types that this basic understanding can go so far. In fact, at this rate, I suspect you could learn everything there is to know about this software and simply move on to the design phase.
I really enjoy this. It’s kind of hard to translate because I am not a programmer, but the quick results of Godot TileMaps are pretty rewarding. By the way, I’m not dismissing Unity or Unreal or any other game engines. This is my first ever time doing something like this though, so might as well give it all I’ve got.
I am not sure if I am going to continue this game project further or if I will explore something related but completely different. I feel so invested in this now that I might have to! We’ll see though.
Thank you so much for reading Mr. Dave Pizza. If you enjoyed this tutorial be sure to look around. I am building a how-to section focused on indie games from many angles, you can visit it here: How-To Section. I also review/showcase indie games on a regular basis. Be sure to check things out. And please come back again! Thank you!