4.2.0 Object Info & Mode Selection Hotbar


Key changes in this update are the addition of a targeted object information display, improvements to object name displays for in game readability, the addition of mode selection hotbar and buttons, and an overhaul to the placeable selection UI.

There is a new mode info mode which lets you read over information about hovered objects but not directly manipulate them through the ManipulationSystem. If you want to use the new mode, you should define an 'info_mode' action and assign a key in the ProjectSettings InputMap. To see information about the object being hovered, the new TargetInformer should help as a baseline. See target_informer.tscn in the templates package. To add extra information like extra stats, you can modify it to add extra label information pertinent to the node objects in your own game.

Mode Selection Hotbar

Added to the project templates, the action bar provides an easy starter for initiating changes on the ModeState mode and responding visually if a mode is exited by other means such as pressing the keyboard hotbar. If you include the GridBuilderActionBar (action_bar.tscn), you can switch modes by pressing on the hotbar buttons in addition to any hotkeys you set in the ProjectSettings InputMap.


Placeable Selection UI Changes

  • Instead of an ItemList, the selection UI now uses a GridContainer and Button approach. This allows each button to be set with the Placeable it represents and use that information for displaying and sending event data upwards when pressed. The limitation of ItemList is that the individual items being displayed are not their own scripted control node so can do little else than show text and an icon without a parent UI (the custom ItemList) handling selections, presses, and data handling.
  • The template scenes can be customized for both the placeable_view.tscn (extends Button) and placeable_grid.tscn (extends GridContainer)
  • This also means that the selection buttons can be extended or replaced with additional code if needed. The grid container instances the PackedScene template and only expects certain properties to be set on it. Beyond that it could even be an entirely different Control class for each Placeable to be represented

Grid Targeting System / Settings

  • Grid Targeting System by default does not limit position to valid tile spaces only anymore. You can toggle this back on in the GridTargetingSettings but mostly recommended for a isometric map to make sure the cursor doesn't go off into space. In other cases, I believe it's actually better that the positioner can target tiles with no tile data in it.

Name Displayer

The name displayer by default will take a node's name property and turn it into a more player readable format for Gameplay. It strips the numbering from object names if the ProjectSettings property "editor/naming/node_name_num_separator" is set to space, underscore, or dash. It will automatically insert spaces to the node name as well. To let individual games control how objects display their name, you can assign any custom_name_method that will be called on the nodes to generate a display name for the Build Log, Manipulation System, and other places where the NameDisplayer may be used. For example, you can implement your own to_string method to display a custom property like display_name or sanitize the node.name in a custom way to UI display.

  • Recommended to share one NameDisplayer resource across all needed nodes as is done in the Grid Builder Templates package.
  • Assign custom_name_method to call any name method in place of the Grid Builder defaults. Requirement is each node in the game that will be displaying a name, will need to implement said method (Inheritance in your scripts could be a good way to just reuse the same naming method across all objects)
  • You can assign a missing_name string to the NameDisplayer to show anytime it can not find the name. Currently that only happens if the node is null that is passed into get_display_name method for the NameDisplayer.
  • You should assign a node_name_num_seperator in ProjectSettings if you want to use the default method and have it work easier. I recommend underscore _ or dash - as those are characters that you will probably never use in a regular object name. The default method cuts off the name string at the delimeter character so it is not a full proof method but works well enough without having any understanding of your game's custom code. Hence why overriding the name method with custom_name_method is an option.
  • New resource object to convert node names to player readable formats. You can set a custom method you want to call for getting a display name from Nodes referenced in the system but you need to have it implemented (ex. 'to_string'). By default, it will perform like below. This NodeNaming resource is referenced in the BuildLog, ManipulationSystem, and TargetInformer currently. It is recommended to create 1 and share it across your different system nodes.

Build Log

  • Build Log Settings have been turned into their own BuildLogSettings resource class for future reusability. Be sure to set the new resource and set any custom settings values needed.
  • BuildLog by default converts node names to game readable name with NameDisplayer. You can override this by setting 'custom_name_method' in the NameDisplayer resource.

Mode Icons 

Modified from Kenney Icons (CC0), updated the default icons for the CursorsSet that trigger when a mode change is made to one of the plugin modes. You can find these in the addons/grid_building/icons directory and customize them to any replacement icons you want in the CursorsSet resource for the ModeCursors node. The cursors will only auto set if you include a ModeCursors node in your systems hierarchy.


Auto Disable Systems on Bad Setup

  • Systems will not automatically disable (set process_mode to disabled) if they fail their initial setup checks. This prevents a barrage of error messages hitting the console when the player sets player input but there are no actions defined to actually control the system. Instead you should see one message when the system fails to load for each missing setting and a message to fix it and reload the scene.

Target Informer

New UI template added to display basic information about objects being targeted, manipulated, or placed within the GridBuilder systems. By default, it will show a game readable name using the node's hierarchy name and it's X, Y position within the game world. The object displayed will be either the hover over in manipulation move, the build preview node, or the object being moved in move mode.


GridBuilderInventory

  • ItemContainer and BaseItemStack given save_state and load_state methods for simple saving and loading contents in the demo without any external systems.

Resource Display

  • ResourceDisplay in the demo now reacts to the ItemContainer slots_changed being set. It should load the correct resource count displays when the game is loaded.

Demo Project

  • Added object info box (TargetInformer) and GridBuilderActionBar to each demo proejct
  • Removed the toggle build mode button from the demo project. Is it replaced by the mode buttons on the action bar.

Isometric Demo Project

  • Added a large Placeable building that takes 4 isometric tiles to place as a demonstration of having multi large tile objects. To get grid builder to require larger placements of 4 /  9 + tiles, you need to scale and / or move the collision polygons on the placed scenes so that the building system will detect collisions in the placement areas, and require those regions for successful placement.

  • It is recommended to use CollisionPolygon2D instead of CollisionShape2D with skew for Isometric collisions.

Files

Grid Building v4.2.0 ~ All Packages (Requires Godot 4.3+) 3.7 MB
9 days ago
gb_4.2.0_web.zip Play in browser
9 days ago

Get Grid Building Plugin for Godot 4

Buy Now$40.00 USD or more

Leave a comment

Log in with itch.io to leave a comment.