In the last video update (viewable here if a refresher is needed) you might have noticed how the agents have a strong tendency to get stuck walking in looping patterns. This is because the agents aren’t aware of one another. The only thing they care about is spreading their territory. This means if two or more agents are close to one another they’ll just keep capturing one another’s territory as if they’re taking turns.
I fixed this by adding some new goals and actions that cause agents to search for and attack other agents. They do this with a quick field of vision check. If an enemy agent is detected they’ll attack until the threat is dead. The combat is super bare bones. There aren’t any calculations like damage rolls or hit chances going on yet. This means the first agent to attack will always win since they’ll have the health advantage. Eliminating other agents is prioritized above spreading territory so the moment a hostile comes into view they’ll attack. This means there’s no more weird dancing back and forth.
This is what combat looks like. The map starts with a stupid amount of agents present and they all kill one another until only a few remain. The red line between two agents means they’re fighting. I don’t think I ever explained the white line but it’s just an indicator of where the agent is pathing to. You can see that the agents don’t start claiming territory until all visible threats have been destroyed.
The next update was a new form of territory selection for the claim goal. The agent would previously analyze all the tiles that didn’t belong to their faction and choose the one that’s mathematically closest. This would lead to the agent sometimes picking a new tile to claim that was actually quite far away. That’s because the distance calculation didn’t take into account obstacles like walls.

The left image is how it previously worked while the right one is a closer approximation of how it now works. The green dot is the agent, red dot the target and grey line the path. The darker green tiles are claimed territory while white is unclaimed. The agent now selects a random neutral or enemy tile that borders their factions claimed tiles. This system isn’t perfect due to the random element but I actually prefer how it looks. It spreads the agents out and gets them expanding their territory in all directions.
What’s next? Groups! The agents are no longer going solo. The term faction now makes more sense since they’re working together.
The next thing I added was more goals and actions. The agents can now idle and patrol. Idling causes the agent to just stand where they are while patrol causes them to path to random friendly territory. The weights for these two goals are just counters which is code speak for a number that increments. It starts small but gets bigger over time and eventually it weighs enough to supersede claiming territory. The weight then gets reset back to zero at random which frees the agent to go back to claiming territory. I don’t feel like this shifting weight idea is the proper way to use GOAP but I’ve yet to think of a better way to handle things. If you’re wondering then combat has a high enough weight that idling and patrolling don’t ever overwhelm it.
The reason I added idling and patrolling is because I don’t always want the agents fighting over territory. It’d be kind of silly if there was a 24/7 gang war happening. I imagine them instead fighting in small unexpected bursts. The only time constant warfare should occur is when two or more factions have adjacent territory and their agents keep incidentally running into one another while patrolling. I’m not aiming for realism so much as I am the atmosphere. I think it would feel better if there was only the occasional skirmish instead of gangsters constantly shooting up the streets.
There have been no major changes at this point. I’ve been doing lots of minor behind the scene alterations to move things more towards my goal. Here are some of those changes. First, the maximum amount of agents a faction can have is now based on the amount of territory claimed. This means small factions have less and big factions have more. The current ratio is 1 agent for every 10 tiles with a maximum of 20 per faction. The agents spawn based on chance instead of a guarantee. This is why even factions with a ton of territory don’t have full agent counts. I did this so factions that are being constantly damaged will lose ground since it takes a while for reinforcements to spawn.
That’s about it. I’ve come to realize that I’m not using GOAP to it’s fullest yet. The agents have multiple goals, sure, but there’s only one path of actions available for them to accomplish each goal. The lack of multiple action paths kind of defeats the purpose of using it. Everything I’ve done so far would be much easier to implement as a finite state machine. That’s okay, though. I knew when adding GOAP that it would take a while to come into its own and be useful.
I think once more mechanics are in place things will get better. Having different kinds of equipment to use (guns, knives, cybernetics) and ways to get said equipment (buying, looting, stealing) will help. The games in such a simple state right now that there’s just not a lot for me to leverage yet.
I’m not sure what to do next. I want to start adding player interaction but there’s not anything for them to do aside from fight with the gangsters. Come back next Friday to see what I’ve decided to do next! Thanks for reading.