All under-the-hood changes this week…
Enemy AI System Overhaul
Last week I mentioned some difficulties I was having with the enemy AI system. I was seriously considering replacing it, but in the end I elected to keep it and overhaul the portions that caused the most problems. I took a step back and wrote out everything the AI system needed to do. The current AI does all of these things, albeit in an overly complex manner. The process of writing out the AI requirements actually helped me identify some of the problem areas. For example, I realized that enemies needed to track game events rather than observations (an enemy will often have multiple observations for a game event because most events can be both seen and heard). In fact, Observation objects, used extensively in the AI system, weren’t needed at all, so I removed them. I also removed Actor Tracking, which was used by actors to keep track of the actors they were interested in (typically, enemies tracking the player). This was replaced with querying actor memories, a feature recently added. To sum it up, I removed artifacts that didn’t provide enough benefit to justify the complexity they added, resulting in a 50% reduction in code and easier to follow AI logic.
GUIDs to ints
Previously, object IDs were GUIDs. GUID-based IDs are easy to implement but have drawbacks: 1) GUIDs require more memory and storage than ints and 2) GUIDs make log files harder to read. I replaced GUIDs with ints this week.
Next week, I’ll repair AI state saving/loading, which broke with this week’s changes. I’ll then focus on combat testing, which prompted the AI work in the first place.

