Tile based navigation in a turn based game where the game board changes every turn

I have to calculate AI movement along a game board that has discrete tiles but the game board changes (deterministically) every turn and therefore the AI needs to look ahead through those changes to determine an optimal path. Is there anything in the Unity navigation that can help me here or is this a Roll-Your-Own situation?

Thanks!

Unusable tiles would get an obsticle placed on them which would make the path be calculated around them.
Another possibility with Unity 5.6 and up might be to disable the navmesh component of each tile as they become unuseable ( I havent tested 5.6 enough to know if that would work).

https://docs.unity3d.com/Manual/class-NavMeshObstacle.html

Right but the map is changing each turn, which means the agent needs to look at how the map will be at each turn as it calculates the movement, rather than just calculating the entire movement based on the current map.

Is there maybe some sort of callback I can handle that would let me feed the agent the state of the board for each step as it calculates?

Agent.SetDestination should recalculate path.
Do this after each map change.?

I don’t see how that would help, as you would still have an agent making bad decisions and just constantly recalculating looking like a Roomba when someone is constantly changing the room around it :slight_smile:

The key here is the changes are deterministic, which means the agent CAN calculate an optimal path if it processes all the changes for each move ahead of time, just as a player would.

oh i got you… sorry i misunderstood… i thought you were just having an issue after the map changed getting navigation to your desired location… I’m pretty sure you’ll need to write some code to get what you need for this “Roll-Your-Own situation”. Not sure the best solution for this…
Vector3[] points =agent.path.corners; will give you the path not sure that would help much

https://www.youtube.com/watch?v=qSQRZAxXlqw

25 mins in he makes a editor script to give a visual representation of the path, again not sure if that would be helpful at all for your needs

So seems like you almost need a predictive AI system. A step-by-step guide to building a simple chess AI
Maybe the code in this would be somewhat useful in point you in possibly the right direction

Yeah I was thinking something like that but nowhere to that level of complexity. Still though that link could be useful so thanks!

1 Like