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-fi, Patreon, and Itch.
Thanks for reading and following along with my work.
Get Grid Building Plugin for Godot 4
Grid Building Plugin for Godot 4
Place Anything with Rotate, Flip, Stacking, and Drag Build
Status | In development |
Category | Assets |
Author | Chris' Tutorials |
Tags | 2D, City Builder, Godot, godot4, Metroidvania, Side Scroller, Tilemap, Top-Down, User Interface (UI) |
More posts
- 4.1.0 Manipulate with Move & Demolish Modes89 days ago
- Upcoming Grid Builder Updates for Godot 4.3Aug 18, 2024
- 4.0.3 Compatibility Fix for Godot 4.2.2Jun 09, 2024
- 4.0.2 Small Enhancements & Bug FixesJun 09, 2024
- 4.0.1 File Path HotfixJun 07, 2024
- 4.0.0 - Shared BuildingState, Save / Load HelperJun 07, 2024
- 3.2.2 Bug FixesMar 06, 2024
- 3.2.1 - Input Mapping UpdatesJan 27, 2024
- 3.2.0 - Isometric Tilemap SupportJan 20, 2024
Leave a comment
Log in with itch.io to leave a comment.