11 January 2026

Assigning Data to Tiles in Godot

It’s very common to use Tilemaps to shape 2D games. Their simplicity makes them ideal for creating retro-style environments.

Why might we need to associate data with a tile? For multiple reasons. For example, suppose we’re using a Tilemap to build the map of a top-down perspective game. In that case, we might want to add a “movement resistance” value to different tiles so that our character moves slower on tiles representing a swamp, faster on tiles representing a path, and cannot cross tiles showing impassable rocks.

In a previous article, I explained how to associate this value with Tiles in Unity, but I realized I didn’t cover how to do it in Godot. Let’s solve that in this article.

Imagine having a scene created with several TileMapLayers. In the example screenshot, I used three TileMapLayers: one to define the scene boundaries (WallsTileMapLayer), another for interior obstacles (InteriorObstaclesMapLayer), and another for walkable areas (GroundTileMapLayer). In the walkable areas layer, I placed all the tiles my agents can roam on, although some tiles should have different transit costs than others.

My Example Scene
My Example Scene

To reflect the different tile costs, we can associate data with the Custom Data Layers of the TileSet used in the TileMaps.

First, you need to register the different data types within the TileSet. In the inspector of any TileMap, expand the TileSet resource. You’ll see a section called “Custom Data Layers.” Expanding it shows the data types associated with each tile, and you can add new ones using the “Add element” button. The screenshot shows the data I associated with my tiles.

Associating Custom Data to a TileSet
Associating Custom Data to a TileSet

You can see I associated two data types: a boolean defining whether the tile is an obstacle (though I didn’t use it in my example) and a float defining the cost of moving over the tile.

Once the custom data types are defined, we need to set their values for each tile.

When you select a TileMapLayer in the hierarchy, you’ll see a TileSet tab at the bottom of the editor. Selecting it shows three sections for configuring the TileSet: “Setup,” “Select,” and “Paint.” We can use the last two to assign values to custom data.

In the “Select” section, you can pick specific tiles. Doing so displays several configuration sections, one of which is “Custom Data.” Expanding it shows the different custom data fields, where you can assign values. Remember to press Enter in numeric and text fields to apply changes effectively.

Configuring Custom Data in the “Select” Section of the TileSet Tab
Configuring Custom Data in the “Select” Section of the TileSet Tab

You can do the same more conveniently from the “Paint” tab. Selecting it shows a dropdown to choose the data you want to assign. Once you pick the data type, enter the value in the text field. From that point on, any tile you select in the TileSet will adopt that value. This option is ideal for quickly applying the same value to multiple tiles.

Configuring Custom Data in the “Paint” Section of the TileSet Tab
Configuring Custom Data in the “Paint” Section of the TileSet Tab

With this, tiles will carry these data values to the positions where you place them.

Next, as an example, here’s the method I used to retrieve the cost of the tile associated with a given position.

Method to Retrieve the Cost Value Associated with a Tile
Method to Retrieve the Cost Value Associated with a Tile

Every TileMapLayer has a LocalToMap() method that converts a position to the coordinates of the tile covering that position. I used this method in line 188. However, note that the position cannot be global; it must be relative to the TileMapLayer. That’s why I used ToLocal() in line 189 to convert a global position to one relative to the TileMapLayer.

With the coordinates returned by LocalToMap(), we can call GetCellTileData() (line 190) to retrieve the data associated with the tile at that position. The returned type (TileData) is a package containing all custom data. Therefore, to get the specific data we need, we call its GetCustomData() method and cast it to the expected type. Be careful because you need to pass the exact name of the data field, and it’s easy to mistype it.

And that’s it. Now you have everything you need to associate data with your tiles and retrieve it later depending on the tile at each position. What you do with that data afterward is up to you.

15 December 2025

Review of the book "Game Design Workshop" by Tracy Fullerton

Book cover
There are many ways to get into video game development. We all start from our love of playing, but some of us have a technical background and dive straight into programming with an engine, others get involved after dabbling in modding or level creation for a specific game, and some even come from the world of physical board games.

This book is for all of them because it begins with the most abstract concept of what we call a game and, although it eventually focuses on video games, it emphasizes the creative process of generating ideas, finding the most promising ones, testing them with a prototype that doesn’t have to resemble its final form, and starting an iterative refinement process until you arrive at something genuinely fun for its concept itself (and not for its implementation). Only then does development begin. In fact, the book doesn’t start addressing what we know as development until its last third, and even then it doesn’t deal with the technical side of development—there isn’t a single line of code in this book—but rather the planning and management of a group’s work.

The book adopts the perspective of the video game designer. While this is a very specific role within a development team, it is the one with the most transversal responsibilities, as the book explains, and therefore has the greatest visibility of the entire process—hence its importance.

The first two-thirds of the book explain the role of the video game designer; what we understand by a game; what its fundamental elements are; what elements enrich it to give it the desired character; what the most common gameplay dynamics are according to that character; how we can maintain player interest over time; and how we can keep the game balanced to avoid player frustration or, worse, boredom. It then moves on to how to filter and refine game ideas, giving enormous importance (and entire chapters) to the process of prototyping and testing those prototypes with real players (outside of the designer). Proof of the book’s decidedly “meta” approach is its insistence that tested prototypes start out as physical ones, even on paper and cardboard, long before creating the first digital prototype. This approach of avoiding digital prototypes until very late in the process may seem surprising to those of us who enjoy writing lines of code, but the author convincingly and refreshingly explains the reasoning behind it.

The last third deals with development itself, but with a “hands-off-the-keyboard” approach. Here, the book puts you in the shoes of a team manager who must coordinate multiple specialists to shape a game that can be sold. The entire book has a very realistic tone, but this is where it stands out the most. The author makes a notable effort to convey the day-to-day life of a video game development studio, both in its internal tasks of creating the game and in its interactions with key external actors for testing, funding, and distribution, such as testers and publishers. To do this, it explains how to structure development teams, what roles are common, and how they can interact efficiently and healthily. It then explains how agile methodologies can help humanize development and improve the product. I particularly liked how it explains the workings of the video game market and prepares you for how to approach a publisher so they choose to finance your game. It even goes as far as to discuss typical contracts between publishers and development teams, so you understand how milestone-based payment systems work during development, and later, royalties after the game’s release. It’s a fascinating reality check that demystifies the world of video game development while also showing the enormous effort behind a game that successfully sells.

All of the above is already immensely valuable, but the book is also enriched with testimonials from many game designers. You’ll find that more than one has created games you’ve enjoyed. In these testimonials, each designer shares how they entered the world of game design and development, what attracts them to it, and what creative process they follow when shaping a game. Reading them humanizes the role of the designer, puts faces to the people behind the games you’ve loved, and lets you learn about the life paths they followed to reach the point of creating the games that made them famous. Many of those paths were not easy. More than one even advises against entering the industry unless you have a clear vocation or passion, as it’s neither an easy profession nor one that will make you rich. But all of them confirm that if you truly want to make games and are willing to put in the effort and sacrifices, it’s a profession that can be deeply fulfilling.

Therefore, if you not only love games but also how they’re made, this is your book. It’s a refreshing reality check that demystifies, humanizes, and highlights the creative effort behind what you enjoy on your PC or console. A truly recommended book.