The Battle of Krabolniet

Here it is finally: the attack of the city fortified in the previous video.
It took slightly longer as expected to show a proper battle as there was a huge amount of bugs to fix to make it functional enough for a first release.
All the terrains beeing procedural combined with the fact players can build their fortifications in any way they want makes it quite challenging because the amount of different ‘cases’ to deal with in battles is huge.
There is still obviously a lot of things to improve (both visually and in battle code), but at this point i need to move on to the next tasks as i’m running out of time !
For now the barbarian “AI” is really basic and all units are individually attacking without any global strategy.
One idea i have would be to keep this basic behavior for primitive armies, and that more advanced strategies would be unlocked by technologies or maybe the presence of commanders in armies.

For now, battles themselves are entirely automatic ( that is because in a multiplayer context, ‘online’ players must have no advantages over ‘offline’ players ). It means players do not actually control the units in battle.
Players affect the battles outcome before the battles actually happen : the defenders through organizing the defenses as shown in the previous news, and the attacker through orders and mission settings setup before launching the attack.
Attacking units can automatically pass walls and cliffs with ladders, breach gates with siege rams and embark in rafts to cross rivers when there’s really no other choices.
When launching an attack, you’ll be able to choose a privileged technique of assault.

Spawn location

Today, besides the ongoing work on the battle code and battle ‘AI’ , i’m adding a little feature i’m always annoyed no to find in games : spawning near a friend.
Now, when you create a character, additionally to the options where you can filter the types of starts you want, you can now select a character to spawn close to.
When doing this , you will be assigned the nearest starting location matching your other settings ( climate types etc.. ).
This way, you’ll be able to easily play in coop with friends, starting near them without having this annoying struggle of finding each other or having to respawn until you’re not so far!

Technicalities

These last weeks i’ve been focusing on technical things, so sadly there’s nothing fun to show, but so you dont get the impression i’m doing nothing, i’ll try to summarize what i’ve been up to.

Basically, after beeing done creating the tools and display to terraform and build fortifications, i’ve been busy implementing the ‘logic’ of all these features, so that they are actually “seen” and understood by the porcos and the game, and not just a display thing.
I’ve patched pathfinding to be modified in realtime as you build things. I’ve optimized memory usage of the pathfinding and especially how its gradually loaded on the server depending whats needed, so more regions can be handled.
I’ve divided pathfinding  grids size by 9 and also created a new way of storing them in the memory so they’d use less RAM. Instead of having 9 logical tiles per terrain tile to handle “walls” on the edge between tiles, i’ve properly implemented a system of “edge blocking”. So now one tile of logic can be the same as one tile of terrain.
Also, pathfinding now looks for a path starting from both the starting point and the destination point at the same time, until they reach a meeting point ( doing this makes finding paths faster in some specific cases compared to looking only from the starting point until it reaches the destination).
Porcos now “see ” walls. They can pass beneath bridge platforms,  and basically find their path to their destination correctly without moving through things they shouldnt be able to.

I’ve added a new infrastructure, stairs, to allow porcos to move from a height to another.
Their primary use is to control how porcos can move on the walls, but they can also be used on terrain against cliffs.
I still have to add “gates” though, but its at this point a pretty straightforward task.

Pathfinding updated to support all the new fortification features : porcos now use stairs to access walls, and can now pass below “bridge” platforms (here used to create the city gate).

Now, the point of all this is that i’m finally restoring and updating the last remaining feature of the prototype : battles.
It’s a big chunk of work, especially that it was just ‘prototyped’ and now i need to properly do it, and there will be more to see in the next updates.
The basic battle algorithm on the server side is now functionnal and i’m working on the battle display on the client side.
These last days i’ve worked on sounds and the transition to battles. It’s pretty cool, and to give you an idea, it includes city alarm horns and citizens panicking and taking shelter into their homes!

Fortifications and defense planning

DEFENSIVE STRUCTURES

There is now 8 new military structures : 4 types of battlements, and 4 tower buildings.
These structures can only be built on platforms.
Battlements will provide a defensive bonus to units on the platforms, and towers will act as units of their own providing fire support during battles, but are expensive to maintain and require permanent workers.

Using these structures combined with platforms, it is now possible to design pretty cool fortifications, like this castle i previously shared on facebook a while ago.
Or a fortified city like that second test, with a tiny fort in its middle.

STRATEGIC TOOL
Additionally to these new things available to build, i’ve created a tool i call for now the ” strategic tool”.
When activated, you get to see all the troops of all the formations present in your region and you can customize how your region and these troops will react to incoming enemies.

In the strategic tool, you can add “Defensive zones” simply by clicking to set a position and dragging across the terrain to set a radius.
These zones will automatically fill the terrain following 2 rules : they do not spread to lower heights, but they spread to higher ones.
This way, you can easily and quickly create zones filling hill tops stopping on the cliff edge as well as zones filling walled areas like castles or cities themselves ( the zone will include the wall and then stop at its border ).
The point of these zones is that you can then assign troops to it: each troop can be assigned a “strategic mode”, defining its behavior during battle, and being assigned to a defensive zone is one of them.
For now, i’m creating 3 strategic modes:
Defending zone : In this mode the troop is assigned to a specific defensive zone. The troop will never exit the zone, but will move within it if necessary. The troop will try to prevent enemies from entering the zone. Range units will move along the edge of the zone to engage any available target. Defensive zones can be superposed, so you can setup successive layers of defenses.
Pitch battle : Pitch battle is the basic default behavior. The troops in this mode will automatically deploy to face any incoming army and engage immediately.
Restricted engagement : In restricted engagement, the troop has a range of engagement ( that you can define ). The troop will only move to engage enemies when they are within this range. You could, this way, have some troops guarding specific spots (like warehouses) or reacting only when enemies reach certain zones.
For instance, you could have a defensive zone including all your city and walls with range units, and have some cavalry units in restricted engagement with a range reaching slightly beyond the walls. This way the units will sally out to engage enemies getting near the walls while your range units in defensive mode will support from the walls.

 

With the strategic tool, you can also select any troop and set its default deployment position.
In some modes however, this starting position might be irrelevant : for example troops in pitch battle will automatically redeploy to face the enemy on the edge of the region.

I’ve also added a new military unit: a default warrior unit. It’s basically a pig with a wooden cudgel (the selected troop on the left), and it will be the first available military unit of the game.