Grid Building System DEVLOG #2 - Setting Rules for Placing Objects



Since the time of the last devlog, I added in rules for building placement to make placing objects into the game world make more sense. After all, being able to place a house in water is not ideal, right?

In the system, rules are set at the placeable object level which means that each scene object you want to place or instantiate into the game world can be defined for what requirements must be met in order for the building system to successfully place it into the game world. It's also set up to be an array of rules, allowing for more flexibility in mix and matching rules or even creating your own (as long as they inherit from BuildingRule and can return a pass / fail message)

Take this house scene for instance. If you look at the log in the bottom right, you'll see I required to get 3 rocks and 2 wood to build the house and also that there can't be collisions under the house build area. If I try to place the house without those requirements met, the build log posts the failed message with details (it does this by connecting to the build system by Godot signals)

On the placeable object, you would set in the building rules array each rule you want to check for. In this case, the NoCollisionsRule and SpendResourcesRule. The resources are of course spent after the building system returns a successful build (once again by signals).

Going along with the collision setup, you'll also see that an objects collision preview is split into tile squares that align with the tilemap under them. Each tile indicator checks against the space under it to see if there are collisions with the tilemap or other objects in the game world.

Next I want to be working on some additional placement rules, and a basic gui for selecting between placeable objects. I'd like to have an in development release available after that on Ko-fiPatreon, and Itch.

Thanks for reading and following along with my work.

Get Grid Building Plugin for Godot 4

Buy Now
On Sale!
10% Off
$30.00 $27.00 USD or more

Leave a comment

Log in with itch.io to leave a comment.