It’s been a few days. I last updated after having developed a simple city generator, designed to create a place for the enemy faction to propagate.
With the city in place, I have spent the last four days and 1600 lines of code working on developing systems for the faction. I find writing AI to be a difficult task. I have no trouble thinking logically about the interactions I want to occur, but the complexity always blows out, and with complexity comes bugs.
That said, I am relieved to say that the heavy lifting is done and my enemy AI is all but complete.
I have attached a work in progress build below. I suggest skimming the following post as it will frame your understanding of what is happening.
The goal from day one has been to allow a faction to grow organically within the city rather than be hand created.
In real life I am sure the complexities of operating an underground resistance movement are staggering. This creates a challenge, as I must distill this complexity into simple components – while retaining behaviour that is representative of reality. I have taken some liberties.
In Rollback factions work in the following way:
- Operatives are recruited for a specific task.
- Operatives occupy a ‘home’ building, relevant to their task.
- Operatives path from their home building to other relevant buildings.
Multiple operatives and operatives of different types are able to occupy the same building. For example, soldiers may occupy and guard a storehouse, as well as a storeman.
The diagram below depicts the interactions between the building types and the faction’s operative types.
The faction looks functional. Appropriate operatives are pathing to appropriate buildings – but for the sake of Rollback deeper functionality is required.
I envision the following scenario occurring in the final game:
Conflict begins. The player is faced with missile attacks on their territory. The player identifies the missile storehouses, and begins a ground offensive. Their troops are met with faction soldiers and fighting occurs on the streets.
I want the intensity of those missiles attacks, and the duration of the ground combat to be directly reflective of the faction’s capabilities.
Having a faction that looks real is not enough – when faced with missile attacks, I want to know how many missiles in their arsenal and at what rate they have the capacity to fire them. When I roll in with tanks I want to know how many soldiers I am confronting, and how many man-portable rockets they’re armed with.
And I want the player’s actions, prior to, and during the conflict, to be able to influence these things.
Faction statistics track all variables related to the faction – from weapon storage levels, to operative recruitment rates. Each individual operatives has associated statistics. The faction’s statistics are the total of all operative statistics.
Faction statistics drive the faction. Although ostensibly the smuggler may be collecting weapons from the tunnel, and then transporting these weapons to a specific storehouse – this behaviour is entirely superficial. Behind the scenes, the smuggler’s smuggling rate (represented as weapons smuggled per day) is added to the faction’s total weapon stores. In the same way as the smuggler’s physical behaviour plays no part in determining actual faction statistics, the specific destination storehouse doesn’t either.
Now – if the smuggler is destroyed, his smuggling rate is removed from the total.
If the storehouse is destroyed, a relevant amount of weapons are destroyed.
The system allows for a wide range of relevant behaviours, with a relatively simple and trouble free design.
The table below lists each operative type and their statistics.
|Smuggler||Increases weapons smuggled per day.|
|Storeman||None (functions to build storehouse).|
|Soldier||Increases missiles fired per day.|
|General||Increases missiles fired per day, small bonus to recruitment.|
|Military Head||Increases missiles fired per day, large bonus to recruitment.|
|Media Worker||Small bonus to recruitment.|
|Media Head||Large bonus to recruitment.|
|Diplomat||Increases limit on weapons that can be smuggled per day.|
|Political Head||Bonus to recruitment, increase limit on weapons that can be smuggled per day.|
There’s little point to having a chain of buildings, operatives and statistics if the faction has no way of growing over time.
The faction recruitment system allows the faction to recruit new operatives intelligently and in reaction to the player’s interference. For example, prioritise the recruitment of smugglers if the player were to assassinate all of their existing ones.
Recruitment is heavily influenced by faction statistics. The faction assesses the priority of specific operative types, and continuously recruits, based off these priorities.
Recruitment priorities are calculated based off a list of rules. These rules generally relate faction statistics to each other, proposing an optimal ratio that the faction should strive towards.
For example, one rule may have the faction attempt to ensure that they have the storage capacity to host the yield of exactly 3 days of weapon smuggling.
The faction will tweak the prioritisation of relative operatives – in this case, smuggler and storeman – in an attempt to retain this balance.
If a storehouse was to be destroyed, the faction would dramatically increase prioritisation on storehouses, otherwise, as time progresses and the stores continually fill, smuggler prioritisation would slowly increase.
That is my progress for now.
I invite you to download the work in progress build from the links below to observe the systems in play.
Please be aware that this is not representative in any way of the player experience and is simply a sneak peek into these systems. No effort has been made to balance, and these systems are open to change, so some counterintuitive behaviour can be expected. Don’t launch fullscreen as there is no way to exit from within the game.
Next on the list is developing the player experience. I’m excited to finally start building a game on top of these foundations.