Which path solution would work best in this scenario? 2D Grid/Tile, Turn based

Edit:
I think this handles what I am looking for. Just looked through a bunch of scripts and found Seeker gives me something to work with and returns the full path I can just eat the first path point returned.

Also tested obstacles, etc to recalc on “turn”. Works as I need. Can disregard the Original post below but I’ll keep it up in case someone else was curious.

seeker.StartPath(currentPosition, targetPosition, function) simply calculates the full path the AI will take and hands it off to SetMoveTo where you can just take the incoming path and use .vectorPath[n] on the incoming path from Seeker to grab a single point along the path. Here I just print it for testing:

void CalcPath()
{
	seeker.StartPath(transform.position, target.position, SetMoveTo);
}
	
void SetMoveTo(Path incPath)
{
	print("MoveTo Point: " + incPath.vectorPath[1]);
}

Original:
Paid version of the asset.

So I am basically looking for a simple solution to return a path when called as a list of vectors rather than having the built-in movement scripts - or is there a function to return the list of vectors on a grid to do this in a script like AILerp?

Usage:
2D Grid. Primary direction only. Turn-based movement.
This is so I can have turn-based movement a single tile at a time with the path updating every turn (as the player moves)

Ex:
Every turn happens concurrently. So if the player inputs to move UP, a new playerpos is marked as obstacle, loop through enemies on screen, each calculating a path and only using the first movement position in the path list as the next position (the full path is never used). That new position marked as obstacle (for other enemies). As each enemy updates their new positions and there are none left to move - the turn then executes and everything moves at once.

This was pretty easy to setup in Godot and their built-in A* but I use Unity.

Basically just need the first position to move to on a grid rather than a complete path and I move the rest.

Also, can multiple obstacle updates happen in a single frame?

1 Like

vectorPath was exactly where my brain went when I read the original post, so looks good! Thanks for posting your solution as well. Publicly searchable support forums need information like this :+1:

1 Like