Skip to main content
GameDev.net gamedev.net
🔒 Locked

RTS Pathfinding

Started by hello_there Jul 5, 2004 at 12:26 AM 3 replies 1k views
Original Post
hello_there
hello_there
I'm making an RTS game and i want to add some pathfinding. What is the best pathfinding for this type of game. I read a tutorial on A* but do you have to do it be squares. Is there some way to do it by lines. I want it to work out waypoints to the destination. what's the best algorithim to do this. I'm sorry i know this would have been asked before but i could find what i wanted.
____________How could hell be worse?
Matei
Matei
A* works with an arbitrary graph (a set of "vertices" where you can be, connected by "edges" of differing costs). What kind of map do you have? I can't really imagine an RTS that doesn't have a grid-like map underlying it, but with any map, you can create your own set of vertices from knowing where the obstacles are (put a vertex a bit "out" from each corner of a polygonal obstacle), then add a few more vertices between pairs of these, add one where the unit should end and where it begins, compute costs between each pair of vertices (only once if possible!), and launch A*.
IADaveMark
IADaveMark
To sum up, any mapping system where a node has perfect knowledge of the nodes that it directly connected to is capable of supporting A*.
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit<
hello_there
hello_there
It's just a height map. The x and z coordinates are evenly spaced. but how would i determine what vertexs the unit can cross and can't cross. I was thinking i could check the y value of the two triangles that share the two vertexes and if both there normals y values are less that a certain number its not crossable otherwise it is. Would that work?
____________How could hell be worse?
thedevdan
thedevdan
This should be easy: penaltize going up in height, and reward going down in height. You could find the "height" of a node by finding the average hight that tile.
Not giving is not stealing.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.