Question about Pathfinding


Can you define roads/paths or does the path finding always take the shortest route?

I ask because if I have little bits of greenery and a path in your town, I want to impose a “don’t walk on the grass” sort of deal.

Also you might want to have a safe road which is guarded for traveling along. If the AI takes the shortest path they may ignore this safe road and get themselves into danger?


As stated by @ponder
Core Game vs Mods

The engine and fundamental game primitives are being written in C++.
This is stuff like:

The renderer (we use OpenGL)
The path finding algorithms
The physics systems (when we get to physics...)
The client / server multiplayer bits
The save / load game system

Almost everything that you would consider the “game” is written in
Lua, and is theoretically moddable.

So if the pathfinding is hardcoded you can’t change it. But it should be theoretically possible to Mod some impassable areas like your areas of greenery. They could be invisible walls for example.
Hard to tell at this stage of development.


If anyone walks on my grass, they lose a foot! That should quickly teach those commoners. :stuck_out_tongue:


They won’t try more than twice :wink:


It would be cool if they actually learned!

Like; every time they go to a certain area they take damage, so eventually they know to not go there again.


I’d also like a way to tell my workers to prefer certain paths or avoid certain paths. Even if pathfinding is hardcoded it could be handled in the game itself. One way to handle this in game would to build gates/signs/etc that only allow certain types of workers through them (so if you’ve built a walled city you can close the gates and keep your defenseless workers inside during a siege). Might be harder out in the countryside though.



Very cool idea, I would like this to since it would allow for more in-depth city management. Maybe you could assign types or individual workers to regions, or blacklist them from certain regions.

This might not be very needed for normal townsmen but it would certainly be cool for guards.


I think having patrol grids for guards is pretty important. I would also like to see all your settlers stick to roads and paths whenever possible. Additionally, roads and paths could provide a slight speed boost… very handy for your people and, unfortunately, their enemies. :wink:


@Lvl0User Speed increase on roads would be awesome, it would implement a lot of strategy into building the defenses around your city. Choosing how to layout the roads, etc…


Awesome, I managed to get this answered by Tony on stream.

To summarize:
You can’t define paths per-say and they can’t reasonably be modded in.
At the moment the implemented path finding is A* which finds the shortest path from A to B, they plan to change to to a hierarchial model and different types of terrain have different weights, so a rocky mountain will not be chosen over a grassy route just because it’s technically shorter.
You will be able to mod these weights, so you could technically create an impassible type of terrain. [citation needed]

Quick thought, if you can dynamically set the path weight of voxel then a mod could essentially create “funnels”.

For example you could check which side of the voxel the civ is and give it a low weight where as if they were on the other side it would be a high weight, effecitvely being a one way system.

Or you could say, define a building zone where unless the civ is carrying out a building action the weight would prevent them from going through the building zone (unless there was no other way to get to where they want to go)

Man, I want to make this mod now :stuck_out_tongue:


Adding to the comment on weights above. I did a bit of research into A* a while ago, if it were implemented into the engine, you could have the weights dynamically change if, say your villagers are continually dying in the same areas. So a death in that location would raise the weighting of all tiles in a radius around the location of death. You could also have something implemented where the player could place invisible markers that bump the weight of a tile either up or down (or a row or square of tile) making it fairly easy to set up preffered routes, but not limiting villagers from walking over them if they still need to (if they are fleeing from a titan have them ignore any death weighting or markers the player set?) Of course this is all up to how much the developers want to put into this :slight_smile:


cool thanks for sharing!