Week 10 - Citizen Tooltips & Pathfinding Successes
Building around the clock
Last week, an issue involving the DynamicCities building generation cycle was discovered. In short, buildings continued to spawn while the game is paused, which is not intended behavior. I looked at the generation system this week, and it turned out that generation ignored the current paused state of the game. This system subscribes to the game update cycle, which provides the delta time (the difference in time since the last update). This time becomes 0 when the game is paused, but unfortunately this delta time was not used by the system. I changed this system to use this delta time, solving the issue.
On the right path, sort-of...
In the last blog post I talked about the current pathfinding capabilities of the behavior nodes, and how these nodes don't support interruption. As well, I talked about how this could cause problems for integrating this pathfinding into the Metal Renegades characters.
In order to fix this, it turned out I needed to make two new behavior nodes for pathfinding citizens to use. These nodes, "SetupContinuousMoveNode" and "ContinuousMoveAlongPathNode" aren't particularly special, they are just separated versions of the two functions inside of "MoveAlongPathNode". Turns out, when the pathfinding is interrupted, one of the two functions inside of this node doesn't run, which forbids the pathfinding from working. By separating them, it is guarenteed that all pathfinding functions are run, no matter if the behavior is interrupted in the middle or not.
This new pathfinding has been included in a test deer character inside TutorialBehaviors, which follows the character using pathfinding, across very large distances without falling into holes or getting stuck behind corners.
A deer navigating around a wall to follow the player
A Window into the Citizens
One more development this week, is the integration of tooltips into the module. The module, Terasology/WorldlyTooltips, provides information about the current character/block that the player is looking at. In addition to this, I added extra information that displays when the player looks at a citizen, that shows the current status of the citizens needs.
An example of the needs tooltip
This makes it much easier to test the citizen needs, and overall I think this is a very useful addition to the module.
Over the Next Week
- Continuing faction development, including integrations with the combat system.
- Continuing player needs, with thirst, rest, etc.
- Fixing problems with pathfinding and finally getting it integrated into Metal Renegades!
PRs & Issues
- https://github.com/Terasology/TutorialBehaviors/pull/5 Add smartFriendlyCritter, demonstrating continuous pathfinding
- https://github.com/Terasology/MetalRenegades/pull/29 Integration of Pathfinding in Citizen Movement
- https://github.com/Terasology/DynamicCities/pull/51 Change construction timer to operate on delta values
- https://github.com/Terasology/MetalRenegades/pull/26 Integrate tooltips, with information for citizen needs
- https://github.com/Terasology/Behaviors/pull/21 Add full stops to stray & follow behaviors, curbing some movement issues
- https://github.com/Terasology/MetalRenegades/issues/28 Characters stuck inside wells