Making Movement a Little More… realistic.
Logically, terrain should matter and affect the battle and the units moving on it. Ideally, your troops shouldn't decide that marching straight through a forest is a great idea just because it saves two hexagons. 😅
So, I’ve been working on a new way to approach the movement and pathfinding system in the game.
From “simple path” to “best path”
The first version of the automatic pathfinding system was pretty straightforward. Every hex had a weight of 1, so the game basically looked for the path with the fewest hexagons between the unit and its destination.
Simple. Fast. Functional for a prototype. But it had one big problem: it didn't really care about the terrain and its biomes. It had to change for the beta version.
So I replaced the old approach with a real weighted pathfinding system. Now, different terrain types have different movement costs.
A road is quick and easy to travel through.
A forest slows you down.
A village slows you down, but capturing them boosts the troops’ morale.
A wheat field can behave differently depending on the season and the weather.
The result is that the game now finds the most efficient route, rather than simply the shortest one.

Bridges specific rule
The bridges have their own specific rule. It’s to make sure that units don't walk straight through the side barriers of the bridge.
I applied a weight cost specifically on the edges of the hex of every bridge where I do not want the unit to pass through. Since the costless path is prioritized, the unit respects the rule applied. Simple but efficient!

But sometimes the player knows better
Of course, the fastest route isn't always the better route; the one you actually want.
Maybe you want to approach the enemy from the flank and need to go through a forest.
Maybe you want to avoid being seen.
Maybe you're deliberately taking the long way around because there's an enemy position waiting for you or you are expecting reinforcement somewhere specific.
That's where manual path drawing comes in.
You can hold the right mouse button and draw the route yourself. Changed your mind halfway through? Just go back and redraw the path easily.
The automatic system gives you a sensible suggestion, but you are still the commander in chief. This was actually one of the main reasons I wanted to improve this system.
I don't want every movement in Avant-Garde to only feel like: “Click here. The computer figures everything out.” I mean, it is totally fine to rely on the computer to save time and for executing easy orders. But it is important for you to be able to feel like: “I want this unit to go there, but I want it to go through this specific path.”
That small difference matters when you're trying to flank the enemy, avoid difficult terrain, or set up a surprise maneuver.

And yes… there were bugs. The old system had some fun little surprises:
Marker/pastille tracks could sometimes skip cells if the mouse moved too quickly.
Some units could apparently decide that rivers were optional.
Giving manual movement orders too far from the unit could make it ignore hexes completely.
Too many path markers could pile up. Making the unit go back and forth multiple times through the same hexes.
So, while rebuilding the pathfinding system, I also cleaned up these unwanted “features”.

Keeping track of multiple units
When several units are being moved at the same time, it can be difficult to see which unit is going through which path.
That is why, when highlighting a unit with the mouse, its path markers color changes, so you can quickly see which route belongs to this unit. It does the same if you highlight the destination cell, so you can easily see the unit that will go there.
It's a small “quality-of-life” improvement, but once you start moving a lot of units around, it makes a pretty big difference.
What about the best destination?
It is important to make sure your unit goes along the optimal route. But if you attack a unit automatically, how to make sure the unit takes position in the best hex possible to do so? By that I mean, in between quickness, to go there quickly, and defensive position, to attack the enemy from a good spot.
That is what I’m working on at the moment. Attacking an enemy unit automatically will make your unit take the best choice possible so that you can take care of another menace on another front.
More on that in a future devlog.
Take care!
Thomas Crozet
