Sorry for the lack of updates lately, I’ve been deep in the behavior code with not much to report. My proposed system for the Action, Goal, and Role hierarchy has gone through quite a few changes. I cannot say how many times I completely scrapped the system I had written to try something different. But I think things are starting to settle down to a robust behavior system.
The Action, Goal, and Role hierarchy is still in place, but the framework for how these components communicate is finally working the way I want them to. Additionally, I also added ‘memory’ to my creatures and people, so modeling intelligent behavior should be significantly easier now that they actually can remember what they were doing.
Now that my behavior framework seems robust, I’ve been reworking my pathfinding algorithms to create a system that is fast and invisible to the user. I created a thread-pool system to utilize the extra cores of the processor, since pathfinding is likely going to be the most resource-intensive system (except perhaps the civilization strategy AI in the far future). I now have a system that seems to be working great.
The following is one of many tests of the thread-pool system where two simultaneous pathfinding request are made. In this case, both were returned in 20 ms (50 FPS). I’ve had a few take as long as 14 s to process, so I will likely put a cap on the times and have it return an incomplete path. Otherwise, I am very satisfied with the results.
The way the system works currently is that a request is made to the pathfinding thread-pool. Until the request is returned, the creature/person will use a generic movement algorithm to head in the general direction of target location. Once the path is returned from the pathfinder, the creature/person will use the path instead for the rest of its journey. I am using a simple A* pathfinding algorithm. This algorithm works great because I set it up to only process a path between two sub-regions (squares on the map above). But once the player clears out much of the terrain for building, other algorithms might find a path more quickly, such as Jump-Point Search which works more effectively in open areas. Since each region contains information about the density of obstacles within it, it will be easy to choose the best algorithm to use based on how dense a given region is.
Now I am working on specific goal functions which will hopefully culminate into a library of behavior options that can be reused for all the denizens of the manor. I’ve had a few successful tests of watching a visitor set up a campsite, I’ll try to get a video up soon.
For those of you who were trying to guess the tabs on the management screen, I don’t think anyone got the top tab, so it’s still open.
Anyway, back to the grind…