Week 9 - Proper Template Generation & Interrupting Navigation
Buildings on the Ground
About three weeks ago, a very strange issue involving bulding placement was discovered. When a building is defined as a structure template, the building placement fails, and the template is seemingly placed randomly across the world.
Buildings generating in the sky
After some investigation, this placement turned out not to be random. Rather, it was a problem with the rotation order. The problem is best demonstrated with the diagram below:
The top rotation matrix order was the intended order for placing templates. The building is initially at the origin, (0,0,0), rotated/transformed to fix the destitation parcel, then translated to the parcel. The bottom is what actually ended up occuring, where these two steps were flipped. The template was rotated unnecessarily around the origin, ending up in a totally different location than where the parcel was. With this order changed, and a few tweaks made to ensure the template is at the centre of the parcel, the building generation now works as expected!
Well buildings spawning correctly!
In testing this issue, I found another issue with building generation. When buildings are generated in the world, they aren't place directly; rather in a buffer. This buffer is then unloaded at a constant rate to avoid lag. When the game is paused, the buffer doesn't unload, but buildings are still placed inside the buffer. When the game unpauses this buffer rapidly unloads, like the city was developing the entire time the game was paused! This will likely require a change next week of the timestep used to generate buildings.
Now that the pathfinding system is working, a practical integration into the behaviors of Metal Renegades is required. In most cases the citizen will be travelling to a static location, such as a building. But one behavior requires the tracking of a moving object; the social need. To follow a moving character, the pathfinding nodes must be able to be interrupted in the middle of travel. The current pathfinding nodes do not allow for this, and a strange collection of errors and movement bugs ensue. These nodes will need to be updated or replaced to have a practical integration.
Over the Next Week
- After #11 is merged, start on character factions & faction aggression, the last major task in the proposal!
- Create a test character for pathfinding inside Terasology/TutorialBehaviors, and then implement the tactics used in this character into Metal Renegades characters.
- Continuing the development of player needs, specifically hunger, rest, etc.
PRs & Issues
- https://github.com/Terasology/MetalRenegades/pull/11 "Need Based behaviors"
- https://github.com/Terasology/Behaviors/pull/18 Listen for path calculation in FindPathToNode
- https://github.com/Terasology/Pathfinding/pull/39 Change path to not extend ArrayList
- https://github.com/Terasology/DynamicCities/issues/50 Buildings placed into buffer while game is paused
- https://github.com/Terasology/StructureTemplates/pull/31 Fix bottom centre block region calculation
- https://github.com/Terasology/DynamicCities/pull/49 Fix structure template placement issues
- https://github.com/Terasology/MetalRenegades/pull/22 Set blacksmith template size to a fixed value