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.

Happy new year!

Happy new year to everyone reading this!

Now back to work after a Christmas break,
May the spirit of the Pig be with you all.

Growth details, new unit recruitment and terrain tools.


I have, at last, reworked the population Growth algorythm and finally added all the details UI so players can understand more what’s going on.
All the stats are displayed ‘per generation’ so you can get a good idea of how your demographics are evolving.
Here you can see my active population is stable as the amount of new actives just balances out the amount dying or getting old.
Sickness is directly connected to health and vital needs of your populaiton while murders will be connected to the amount of ‘conflict’ in your society.
I will later on add one thing that is still not implemented at this point : armies support. Like in the old Civs, armies will have a “support” home region, because as generations pass and soliders get older, they also need to be constantly renewed and that will take a share of the supporting region’s growth. Right now it’s a bit odd as soldiers in armies are therefore immortals. ^^

The growth UI also gives a detailed breakdown of the birthrate in your population with the ” breeding rate” pannel. This represents the percentage of adult population that will breed and have piglets, and it depends as you can see on many factors such as the number of piglets Sows already have, the city size, vital needs satisfaction etc…

 


There’s still a lot of UI to finish in this game…
Its now possible to recruit units into formations again, as i’ve completed this new UI for recruitment.
Also you no longer need to be into the region to do that, and you can load/unload inventory or recruit new troops directly from the world map.

Now an exiting new feature :
I’m now starting the work on fortifications and defensive measures. That means walls, platforms but also , for now, terrain modification.
I’ve began implementing the possibility to modify the height of the terrain, which will allow players to rearrange terrain as they wish, like flattening areas or developing a defensive position to build a nice fort.
However this will be a really costly thing to do for players especially in early game.

As you can see in the screenshot below, when using the tool you will first get a preview of the planned work with the modified tiles appearing hightlighted.
When validated, the tiles to be modified will be marked and locked, waiting to be actually worked one by one as the task progresses. This will be a pretty slow process and will consume a huge amount of tools in particular. So doing something a bit crazy like what i did there is probably not going to be a good idea.