AI barbarian waves : Step 4/5 is complete!

I ended up inverting the 2 last tasks and completing the AI waves system instead of the Techs first ( though the work on the Tech system is under way ).

So i have now added a basic system of barbarian ‘waves’, which adds challenge to the game and purpose to defending your cities.
The point of this system is also to allow players to regularly experience battles and improve their strategy, as wars between players will be much more rare and punitive (as, like in reality, when someone attacks its usually because they already made sure they would have all the chances to win ).
Its also a simple thing that added a lot to the fun of the game, as there’s now a ‘stress’ to develop and to be efficient enough to keep up with the increasing difficulty. It also adds the possibility to actually lose the game, which is important to make things fun!

Barbarian cities appear near your settlements and every once in a while they spawn a barabarian warband that will try to raid or sack one of your cities.
They increase in difficulty with time and eventually will even attempt to invade. After a while it gets quite challenging to deal with them, and it also opens opportunities for your human player enemies.
The barbarian cities can be attacked and destroyed, which allows you to recover all the ressources they have pillaged and managed to take back to their city. You could eventually get rid of barbarian waves if you destroyed ALL the barbarian cities around you, to a certain radius.
Its important to note that this is a gameplay feature independent of game rules: the barbarian raids are spawned from nothing, and depart from any nearby barbarian region to target one of your regions.
Their choice of units is affected by their region of departure:  you’ll face different units if its a barbarian camp located in an arid region or a nordic one.
Each player now has a ‘hidden’ system of game-events points and difficulty. With time, difficulty increases and increments points that will trigger negative or positive events. For now , AI barbarian waves are the only event, but of course with time other will be added to this, to make things more interesting. This is a component based and tailored for each player, meaning a player joining a game late would start with a low difficulty while the ones already there would face much more challenging events.

Barbarian cities now spawn automatically near your settlements and regularly launch raiding parties to pillage your lands.

There is also a new NPC faction called the Free cities, which also spawns cities around players in the same way barbarians do. For now they’re useless, but eventually they will export and purchase things on the market. All players are by default at peace with these cities with trading rights opened. The point of  these cities is to ensure a minimum of trading activity and to provide basic natural ressources, as you can hardly get them all yourself.

These new features also mark the completion of the first foundations required to eventually develop proper AI players: there’s now the embryo of an AI that manages these barbarian and NPC regions. It’s able to place some basic buildings and i’ve started to organize how it will ‘think’ to face problems and develop regions. Eventually i’ll develop this enough to allow the Free cities to exploit successfully their natural ressources and sell them on the market as well as buying resources sold by players. And on an even longer term, this region AI will be used as a base to create a proper “AI player”.

Besides all that i’ve playtested the game for more than 50 hours with a couple of friends. Only with 3-4 players in “realtime mode” for now, but its been quite fun especially since the addition of the barbarian waves that added spice to the game. This has allowed me to fix countless bugs and balancing issues.
These tests lead to the addition of some miscellaneous new features such as:

Burning buildings during a barbarian raid

– maintenance and state power costs for active policies
– maintenance cost for infrastructures like walls or gardens (making it impossible to build an infinite citadel of walls, as its now pretty expensive to maintain)
– added a new policy: a state subvention allowing you to help a specific class of population ( gives additional income to the population class, paid by the state ).
– burning buildings effect during battles (cosmetic effect to add ambiance, instead of the building switching instantaneously to ruins when destroyed by enemy troops)
– range attack bonus/malus depending on the height difference. Archers on top of cliffs or walls now have a damage bonus + a bonus to hit while its inverted for range units trying to target them from lower positions.
– range attack malus against moving units (proportionally to the target’s speed )
– new charging bonus for melee units based on unit’s mass and movement speed.
– a new ‘reach’ stat for melee weapons ( spears have a higher reach than short-swords ) , affecting many things in combat like giving a bonus against high-mass units like cavalry.
– ground fertility now affects the fields productivity.
– arid and desertic rivers now generate a new highly fertile ground type, giving more specific pros and cons to these climates : smaller agricultural surface but highly productive, which is a big bonus in early game ( less fields to make but produces much more )  while in late game you won’t be able to produce as much as a continental region because of the smaller available surface. Regions with gravely ground types (low fertility) like hills are now at a disadvantage for agriculture, compensating for their defensive advantages.

The great “battle of the 4 armies” that ended one of our test games : while the red player was attacked by a massive barbarian army, the blue player launched a surprise attack as well while i sent reinforcements to help defend the red city. An epic battle ensued, while reinforcements from all sides rushed to the city, extending the battle… Eventually the city was successfully defended with only a few troops left standing. The blue player made a mistake attacking too soon: his army ended up fighting both the red garrison of the fort and the barbarians raiders – who are hostile to everyone! Had he waited a bit more, and the victory would’ve surely been his.
The industrial district of Cochonville, during a test game.