RTS Kit A* Pathfinding
by Robert Stewart · 02/10/2006 (4:22 pm) · 14 comments
Ok so I keep hearing how everyone wants Pathfinding in the RTS kit, so I decided this morning I would start working on it. I have a few different ideas on how it would be done, the one I'm currently working with takes very few resources.
Anyway I'll try and finish it today, I should have some sort of video of it in action tonight. Just letting you all know that pathfinding is in the works.
Also I have enabled a few debugging features for Pathfinding, so if debug enabled it will draw the path and nodes using OpenGL like the RTS Kit selection stuff. Oh and right now everything is done in script, I will change that to C++ maybe tomorrow or when ever I have it working nicely in script.
Anyway I'll try and finish it today, I should have some sort of video of it in action tonight. Just letting you all know that pathfinding is in the works.
Also I have enabled a few debugging features for Pathfinding, so if debug enabled it will draw the path and nodes using OpenGL like the RTS Kit selection stuff. Oh and right now everything is done in script, I will change that to C++ maybe tomorrow or when ever I have it working nicely in script.
About the author
Recent Blogs
• My game• RTS Kit A* Pathfinding Cont.
• I'm Back
• Cloth Physics
• Plan for Robert Stewart
#2
I don't mean to start a flame war but I feel that the RTS kit is the weakest GG product I've bought, it seems almost totally unsupported and does seem to be very, very feature lacking, whilst I can understand GG's argument that they want to keep the kit generic I think most amateur developers would be in a much better position if there was at least some pathfinding routine implemented - it's easier for a good developer to remove and replace an existing pathfinding scheme that doesn't fit their needs than it is for a new developer to implement a pathfinding scheme from scratch.
I think if some form of pathfinding was available at least as a resource that it would open up so so many doors for new developers to start from and get their foot in the door. As I say, the keep it generic argument is all very well, but again - it's much easier for an experienced developer to remove and replace than it is for an amateur developer to build from scratch.
So thank you Rob, for adding something the RTS SK is so sorely missing ;)
02/10/2006 (5:40 pm)
Indeed, this will rock.I don't mean to start a flame war but I feel that the RTS kit is the weakest GG product I've bought, it seems almost totally unsupported and does seem to be very, very feature lacking, whilst I can understand GG's argument that they want to keep the kit generic I think most amateur developers would be in a much better position if there was at least some pathfinding routine implemented - it's easier for a good developer to remove and replace an existing pathfinding scheme that doesn't fit their needs than it is for a new developer to implement a pathfinding scheme from scratch.
I think if some form of pathfinding was available at least as a resource that it would open up so so many doors for new developers to start from and get their foot in the door. As I say, the keep it generic argument is all very well, but again - it's much easier for an experienced developer to remove and replace than it is for an amateur developer to build from scratch.
So thank you Rob, for adding something the RTS SK is so sorely missing ;)
#3
02/10/2006 (7:20 pm)
So sweet with the resource!
#4
I couldent get a movie done up yet, so here is a pic. Please click on link for image.
http://img86.imageshack.us/img86/7818/path2uf.jpg
Basically the white line is where the unit want's to go, the path is blocked so it find's the closest corner and moves to it, then it moves to the next corner, then it moves to the clicked position been the X. Green line showing the path the unit takes.
02/10/2006 (9:44 pm)
Ok so after a few hours of messing around with this, I have found a really simple and fast pathfinding method.I couldent get a movie done up yet, so here is a pic. Please click on link for image.
http://img86.imageshack.us/img86/7818/path2uf.jpg
Basically the white line is where the unit want's to go, the path is blocked so it find's the closest corner and moves to it, then it moves to the next corner, then it moves to the clicked position been the X. Green line showing the path the unit takes.
#5
The Pirate game I was working on www.surrenderyerbooty.com/ is basically in need of the ability to have ships path around a limited number of simple shapes (islands) and around other ships. Because of the turn based nature of the game nothing is moving when this occurs except for the couple of ships the player is in control of.
It appears from the image that you have a unit recognizing a collision volume and then moving around it to a designated point determined by a mouse click, is that correct?
02/10/2006 (10:00 pm)
Very cool!The Pirate game I was working on www.surrenderyerbooty.com/ is basically in need of the ability to have ships path around a limited number of simple shapes (islands) and around other ships. Because of the turn based nature of the game nothing is moving when this occurs except for the couple of ships the player is in control of.
It appears from the image that you have a unit recognizing a collision volume and then moving around it to a designated point determined by a mouse click, is that correct?
#6
Not trying to hijack your thread Robert, just trying to pool the collective RTS developments of the day. Let's keep this ball rolling
And here is the link to Geom's post www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9750
@ Ian, Thats a lot of RTS dev support for one day, hope that gets you smiling :O)
02/10/2006 (10:16 pm)
I posted this over in Geom's thread, ( who coincidentally happens to also be tackling the pathing issue as well) ,but realized it was appropriate here also. Here is a link to my RTS Environment pack that was just released today. www.garagegames.com/products/82Not trying to hijack your thread Robert, just trying to pool the collective RTS developments of the day. Let's keep this ball rolling
And here is the link to Geom's post www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9750
@ Ian, Thats a lot of RTS dev support for one day, hope that gets you smiling :O)
#7
02/11/2006 (7:24 am)
Aye, it's like everything I've been hoping for over the last 18months has appeared in a single day ;)
#8
02/11/2006 (8:45 am)
Ho ho ho! Merry ...February...
#9
http://img395.imageshack.us/img395/8145/path15vt.jpg
Blue is the obstacle and has to be the shape of a rectangle/square.
Cyan is the unit.
Black is the Clicked Position.
Brown are the corner's to the obstacle.
Pink is a raycast, sent from the unit to the clicked position, to find out if any obstacles are in the way.
Green is the direction the unit takes, following the closet corner to the clicked position.
I choose to use this very simple and resource cheap way of doing things,
first because it was my first attempt at pathfinding,
second because it only needs to use pathmanager when an obstacle is in the way.
There are many way's this could be done, one way I want to try is more of a resource hog, however it works really nicely around different shapes.
02/11/2006 (9:38 am)
Ok this picture may be a better illustartion of what's happening.http://img395.imageshack.us/img395/8145/path15vt.jpg
Blue is the obstacle and has to be the shape of a rectangle/square.
Cyan is the unit.
Black is the Clicked Position.
Brown are the corner's to the obstacle.
Pink is a raycast, sent from the unit to the clicked position, to find out if any obstacles are in the way.
Green is the direction the unit takes, following the closet corner to the clicked position.
I choose to use this very simple and resource cheap way of doing things,
first because it was my first attempt at pathfinding,
second because it only needs to use pathmanager when an obstacle is in the way.
There are many way's this could be done, one way I want to try is more of a resource hog, however it works really nicely around different shapes.
#10
for example
With regards to the other method you mention that is more of a resource hog, what about circular collision, of pentagonal or octagonal complexity?
I could make a square work for the islands in my pirate game, and that would also work for most building structures in any RTS game, but circular shapes would be a little more elegant.
02/11/2006 (10:33 am)
Ok, thats a very clear illustration of how it works, thanks. FYI, you can get the image to show in your post by inclosing the path to it between "[image] and [/image]" for example

With regards to the other method you mention that is more of a resource hog, what about circular collision, of pentagonal or octagonal complexity?
I could make a square work for the islands in my pirate game, and that would also work for most building structures in any RTS game, but circular shapes would be a little more elegant.
#11
02/11/2006 (12:55 pm)
Well you could always use rectangles along the shore of the islands. Yes the resource hog one should be very smart, it would allow the unit to move around any objects shape. I dont have much time to work on either of these things today, however I will pick it back up tomorrow. I'm not sure if I will even work on the smart version until later this month or longer. Thanks for the IMAGE tip.
#12
In the Pirate game, the islands are relatively small, a box would work. The collision volume would be used for detecting the path around the island, and also interactions with the island, like dropping anchor near it to search for or burry treasure, that sort of thing. Precise collision wouldn't be necessary, as is true in most RTS games.
02/11/2006 (5:10 pm)
Na, a square works, it just a little more organic looking if the path is a little more of a curve.In the Pirate game, the islands are relatively small, a box would work. The collision volume would be used for detecting the path around the island, and also interactions with the island, like dropping anchor near it to search for or burry treasure, that sort of thing. Precise collision wouldn't be necessary, as is true in most RTS games.
#13
02/22/2006 (10:31 am)
I have posted the code in the RTS Resource forum, I should have posted this sooner, sorry.
#14
05/02/2006 (8:39 am)
whats the link? I cant find the RTS Resouce Forums......
Torque 3D Owner Todd Pickens
You will be my hero if you make this happen.
Can't wait to see more on this.