GBVM & Tile Tracking


This week I focused on solving a pretty big roadblock in my plan to detect whether the player is walking on trail tiles using GBVM.

🧱 The Tile Order Problem

My goal was to check the tile ID beneath the player and decide if it was a trail tile. Seems simple—until I discovered that GB Studio doesn’t load tiles into VRAM in the order they appear in your tileset. Instead, the tiles get jumbled, making something like if tile id < 10 unreliable.

So I dug deeper.

🔍 Scene Tile Loading Logic

After some research and testing, I found that GB Studio loads a scene’s tiles from left to right, top to bottom, and that it also cross-references a Common Tileset to avoid reloading duplicates. I thought I could fix the order by carefully arranging tiles in a Common Tileset, but the cross-referencing still led to mismatches between the design and VRAM order.

💡 The Fix: Invisible Scene Preload

The breakthrough came when I realized I could load the Common Tileset in a scene by itself first—with a black background and the camera positioned away from the tiles so they aren’t visible. Then, when the main scene loads, the tiles are already in VRAM in exactly the order I want. Finally, predictable tile IDs!

As a test, I used the tiles depicting the numbers 0, 1, and 2, which let me visually confirm that the correct tiles were being referenced as the player walked across them.

Now that I have reliable access to tile IDs, it opens up a lot of new possibilities—like tracking trail distance, playing different footstep sounds based on surface, and restricting where tents can be pitched.

This was one of those classic game dev situations where I thought I’d solve the problem in a day and ended up wrestling with it most of the week.

🎨 More Pixel Art Practice

With the tile ID issue sorted, I used the remaining time to keep sharpening my pixel art skills. Still no major updates on the visuals, but I’m slowly getting more confident with Aseprite and the overall look is evolving.

Thanks for reading, and see you in the next update!
— Derek

Leave a comment

Log in with itch.io to leave a comment.