I continued to refine history generation this week.
- Added 10 new event types, including attacking, creating/discovering items, adding/removing status effects, changing actor types, and creating various room types.
- World state aging. The history generator now generates a random number of events for each era and automatically inserts an event to advance the era after the random events are generated.
- Circular history event reference checker. I made a change to ensure that the event trigger queue was fully processed before advancing to the next era. After implementing the change, the history generator got stuck in an infinite loop. It took me two hours to figure out what caused the loop. The source turned out to be not the change but an existing issue that the change exposed: circular references in history event definitions. In some cases, event A triggered event B, and event B then triggered event A. Since it’s likely that I’ll accidentally create circular references in future event definitions, I added a way to detect this situation and cancel generation. A better solution would be to check for circular references at design time, but I didn’t want to burn any more time on this issue.
- History log improvements. History events and world state are now written to a file. Entity ID’s are no longer guids (guids are horrible for readability) with short identifiers consisting of the entity type and sequence number. The era in which an event occurs is now displayed.
- Named actors. Actors created during history generation are now named. Names carry over to actor remains as well (corpses or bones).
- Bug fixes
- Connection points not being removed. This was an annoying bug that removed walls in preparation for adding doors, but never added the doors (or connecting corridors). I fixed the bug by uncommenting code I had already written to address the issue. I can’t remember why I commented out the code in the first place.
- List randomizer no longer modifies the original list. When I created the list randomizer, I knew it was a bad practice to modify the list passed to it. But, it was a desirable behavior in the scenarios where it was used and more efficient than creating a temporary duplicate list. I changed my mind this week when I discovered that it was the source of a bug that was pretty difficult to track down.
After spending the past five months on map and history generation, I’m a little burned out on proc gen and eager to work on other aspects of the game. I’m tempted to do the latter, but I can’t stop working on the former until I’m satisfied with the maps being produced. My vision is to create maps that tell a story, appear cohesive and organic, and provide emergent narratives and gameplay. My theory is that history generation can achieve this. Next week, I’ll add more history events and further improve the history generator.