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.

 

Funcitonal terrain modification and platforms

I have completed implementing terrain modification.
As you can see on the screenshots below, the terrain tool as a UI giving you informations of how to use it and cost prediction. Once you’re happy with your modifications and validate, the modified tiles become marked. At this point, the process is free.
Then, each tile will be worked gradually with time, actually consuming the required tools and coins as it goes.

 

I’ve also implemented platforms.
Their creation and tool is similar to terrain modification. You first plan and preview your work and then validate the task, which creates marked tiles that are gradually modified one by one ( also the task can be cancelled just by deleting these marked tiles ).


Once a platform is built, its acts almost like a any tile of terrain. You may actually build any infrastructure on it, but also buildings.
Each platform can be built as a bloc, or a bridge letting units pass beneath ( though the logic and pathfinding parts arnt implemented yet ).
Here you can see a bridge over water with a house built on it. So you may now build a Venice if you feel like it.

Another example of platforms used as defensive walls. Next thing i’m working on : you’ll be able to build actual defensive buildings ( towers ) and infrastructures ( battlements ) on these. These defensive things will only be buildable on platforms.

Currently there is 2 types of platforms. These will be very expensive to build, especially the stone one. But also very time consuming.
The wooden one will have little defensive value but will be faster to build, so best for bridges and things like that.
Below you can see a leveled rocky hill fortified with stone platforms.
A stone platform costs 5 stone blocs, so building a “castle” like this will be quite expensive.