Pathfinding Related Question
Okay guys I am completely clueless on this because I really haven''t done any pathfinding / AI stuff before.
My game is turn based, and a character can move a given distance during any turn. This is simple enough on flat / consistant terrain, because it is just a circle with radius equal to the max distance. But what if I have an small hill or a patch of tough terrain. Walking up and down a hill is more distance than just walking straight on flat ground. But it would be possible to walk around the hill as well. So basically my question is, how do I calculate the reachable area taking into account discrepencies in terrain slope and objects that may be blocking a path.
Is your terrain split into tiles? If so, then each tile has a ''cost'' to walk across it. This cost is then used in a pathfinding algorithm (such as A*) to determine the shortest path. Obstacles which completely block a tile preventing you walking through it either have a huge ''cost'' or are given a value for ''not walkable''.
Tilemaps are, very generally, used for 2D. 3D games usually use a waypoint system where the level designer adds ''points'' to the terrain. The cost of moving from one point to another is again used in an algorithm.
Check the Articles&Resources for A* but remember there are other algorithms which cost less (in CPU) to use but can still do the job.
Tilemaps are, very generally, used for 2D. 3D games usually use a waypoint system where the level designer adds ''points'' to the terrain. The cost of moving from one point to another is again used in an algorithm.
Check the Articles&Resources for A* but remember there are other algorithms which cost less (in CPU) to use but can still do the job.
Cast several ''path rays'' out from your agent... say at 16 discrete angles. Use each ray as a path along which you integrate the directional derivative of the surface the agent is moving along (where the direction is given by the ray). If your surface is defined by a height map, then you can use a simple linear interpolation, or bilinear interpolation to get the tangent plane between any set of heights. Make sense?
Cheers,
Timkin
Cheers,
Timkin
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement