I am wanting to make a turn based, tactics style game that works on a grid system. I have dabbled with A* path finding project but am wondering if there is a better, cleaner method for achieving what I want.
As I’m very new, I have no idea if I’m doing this the best possible way, but at the moment I have the floor made up of separate cubes, which I have OnMouseEnter/Exit script to highlight the square, with A* pathfinding over the top.
Here is a screenshot of how A* Pathfinding project calculates the course (in red) and how I ultimately want units to move (in green).
My question: Is there a better, cleaner and simpler way to make mouse selected grid movements? I don’t mind if it’s using an asset or writing code from scratch. As long as I have a solid direction I can work towards it.
Hmm well, just a rough idea would be to set up a node based network for every grid spot, and then have an object follow your mouse and find out which node is closest to your mouse, and when you click it would move the object to that node’s location.
If you use a good A* system, like The A* Project by Aron Granberg, you can code in a system which gives a cost to nodes based on length. So paths made up of shorter paths would get a higher cost, while paths made up of less longer paths get a lower cost. Something which would apply a higher cost to jaggered paths, understand?
You would also need to tweak it so your AI won’t take massively longer paths instead of the shortest path etc. You get the idea!