DEVLOG #1 - Grid Building and Targeting System for Godot 4


I started work on building and targeting systems that work together for Top Down 2D Godot 4 games and wanted to show a bit of what's going on behind the scenes before I release an initial version of it. I intend to start releasing it to creator level supporters once it's in a more workable state.

The goal is to be able to detect which tiles on a grid are available for building, to indicate that visually, and then when trying to use the build system you will get feedback on whether a buildable object can be placed in the targeted tile (or tiles for lager objects like a house)

This is still an early prototype but hopefully the direction I'm heading with this is pretty clear if you've tried games like Stardew Valley, Terraria, or Forager

Mouse cursor not showing in the screenshot but wherever the mouse points, you have an indicator of the tile you are hovering over. The indicator snaps to the center of a tile so any detection should be inside the bounds of that tile for whether there are existing collisions or if the tile is on an unbuildable collision layer.

Here's an example of an unbuildable tile. The player can walk over the bridge tiles but they show as unbuildable to the indicator (don't mind that the bridge is hovering over grass, they are different layers of the same tilemap ~ The system checks all tile layers for collisions as well.)

Duplicating a bunch of houses. When in build mode you will see a preview of the object you are trying to place and through a designated action (currently I'm defaulting it to ui_accept), you can place the object. You can see the preview with the grid indicator on the far right (I will probably make preview objects show partially transparent or change the color to make it more obvious)

To implement next will be writing checks for valid placement (no collision) and to expand the indicator to show multiple tiles of placement zone for large objects like houses. I would like to write the code to setup multiple validation checks where all must pass in order to place the building. For instance, in a resource based game, you often would need a certain number of resources in order to place a building down. Checking that the resources exist in the player's inventory would be needed but not every game will work like that. The more flexible these checks the more they can apply to any 2d game.

Get Grid Building Plugin for Godot 4

Buy Now
On Sale!
30% Off
$40.00 $28.00 USD or more

Leave a comment

Log in with itch.io to leave a comment.