itch.io is community of indie game creators and players

Devlogs

AI Tribal Expansion

Worlds - History Simulator
A downloadable game for Windows and macOS

This weekend I worked on making sure that tribes controlled by the AI could also trigger the Tribal Expansion Decision by creating a tribal expansion event that gets assigned only to AI controlled entities. The main difference between a player driven Action and a AI Event is that the event contains in itself the logic that would make it trigger on its own. So the event needs an extra set of attributes and conditions to indicate if and when the event should trigger, and to also select a target. For this last part, I implemented a simple random selection process which could be later be replaced by a smarter selection algorithm.

The most complex attribute I'm currently implementing is the polity core region saturation attribute. This attribute tells the AI how close a tribe is to filling up all the regions they currently considers to be core to their territory. The closer the saturation is to 100%, the more likely the tribe expansion event will be to being triggered, allowing the tribe to add a new core region to expand to. To implement this attribute I had to modify how prominence clusters are constructed. Prominence clusters are abstract entities that I added a while ago to make it easier to perform a census of a polity. Each polity could be made up of one or more such clusters. In this case, I modified cluster entities so that they can't grow outside of the region they are spawn into. With this simple change now I can evaluate the region saturation level by just adding up the area of all the clusters within the core regions and dividing it by the total area of all the core regions of the same polity.

Once I'm done implementing this attribute, it's just a matter of tweaking the event to make sure that it properly triggers for AI tribes. Which is a task I that shouldn't take more than a day. Besides that, this next weekend I will do a revision pass of all the currently implemented decisions. Some of them seem to have stopped triggering for AI entities since I started working on Mod Actions and that should be fixed. I hope that all of that can be done in a single weekend.

Download Worlds - History Simulator
Read comments (4)