Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Steering behavior and grid AStar pathfinding


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 xiongyouyi   Members   -  Reputation: 150

Like
0Likes
Like

Posted 11 July 2012 - 12:04 AM

I want to make a RTS geme use steering behavior and grid astar pathfinding, but I don't know how to handle the wall avoidance. For example, path following behavior, how to avoid the wall? There are many blocked grids, they may be the wall.
Thanks!

Edited by xiongyouyi, 11 July 2012 - 12:05 AM.


Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 8001

Like
0Likes
Like

Posted 11 July 2012 - 01:14 AM

I want to make a RTS geme use steering behavior and grid astar pathfinding, but I don't know how to handle the wall avoidance. For example, path following behavior, how to avoid the wall? There are many blocked grids, they may be the wall.
Thanks!

The first idea is, that the path is not blocked. But this is often not the case (i.e. some other unit standing on the path), but at least it should not be blocked by static objects.

I have the following approach to solve navigation:
1. Calculate a path using A* .
2. Steer your entiy along the path using a combination of different steering behaviours like path following, obstacle avoidance, flocking etc..
3. Use some problem tracker to check if your entity runs into problems (i.e. velocity dropped to a creep for several seconds). If an issue occurs then start an emergency behaviour (recalculate path and try again, spawn to closest valid waypoint, kill unit etc.)

#3 xiongyouyi   Members   -  Reputation: 150

Like
0Likes
Like

Posted 11 July 2012 - 02:43 AM


I want to make a RTS geme use steering behavior and grid astar pathfinding, but I don't know how to handle the wall avoidance. For example, path following behavior, how to avoid the wall? There are many blocked grids, they may be the wall.
Thanks!

The first idea is, that the path is not blocked. But this is often not the case (i.e. some other unit standing on the path), but at least it should not be blocked by static objects.

I have the following approach to solve navigation:
1. Calculate a path using A* .
2. Steer your entiy along the path using a combination of different steering behaviourslike path following, obstacle avoidance, flocking etc..
3. Use some problem tracker to check if your entity runs into problems (i.e. velocity dropped to a creep for several seconds). If an issue occurs then start an emergency behaviour (recalculate path and try again, spawn to closest valid waypoint, kill unit etc.)


How to avoid the wall? Because the wall is grid cell, there are so many cells, check them all?

#4 xiongyouyi   Members   -  Reputation: 150

Like
0Likes
Like

Posted 11 July 2012 - 03:45 AM

Maybe my question is not clear. I want to implement Crowd path following behavior, like this http://www.red3d.com/cwr/steer/CrowdPath.html
So, first i need use Astar to find a path with width, then use steering behavior to avoid other agents and the wall. The question is, how could I find a path with width?

#5 Tannerd   Members   -  Reputation: 117

Like
0Likes
Like

Posted 12 July 2012 - 12:35 AM

Maybe you want the agents to follow a path without getting too far from the segments of the path that connects the nodes, is that it?
The example you posted shows a behaviour that seems just to perform a clamping of the agents positions against walls.
If you need the agents to follow the path having their distance from the current path segment be less than an amount,
you need just to define which is the current path segment and the distance from the agent.
Compute the closest node to the agent
find the graph links _in the path_ that share that node
have the distance of the agent be less than an amount for one or both of the graph link just found and beware of "corners" as shown in this figure
http://i.imgur.com/jmpPK.jpg
(the red lines are the path segments normals, the blue lines are the imaginary walls that define your path width, the red ugly circles are the wrong agents positions, as you can see those agents in the corners shall compute their distance from the walls carefully)
Just kindly check this strategy because I am not 100% sure it will find the correct path segments from which to measure the agent distance.

Let me know if I understood correctly.

#6 xiongyouyi   Members   -  Reputation: 150

Like
0Likes
Like

Posted 12 July 2012 - 02:28 AM

In steering behavior, it need avoid collision from other agents and walls, the question is i don't know how to define the wall in grid map.

#7 Tannerd   Members   -  Reputation: 117

Like
0Likes
Like

Posted 12 July 2012 - 02:54 AM

Are these walls defined when an agent computes the path?
Are they defining the maximum distance from the path that an agent must follow (path with a width)?
If yes,
you shift the path segments alongside their normal (both ways) and then change the extreme of these segments using the intersection with the lines passing through the extremes of the adjacent segments in order to roughly fill the gaps that creates (like the picture I posted before).
Does this help?

#8 xiongyouyi   Members   -  Reputation: 150

Like
0Likes
Like

Posted 12 July 2012 - 07:27 PM

Thank you! Please take a look at this picture
http://postimage.org/image/borep2zz3/

When a crowd agents move from red point to yellow point, the agent need avoid collision from the wall(the black block), should i raycast all the black blocks?

#9 Tannerd   Members   -  Reputation: 117

Like
0Likes
Like

Posted 13 July 2012 - 01:08 AM

I guess you will need to.
Actually I think ( I am not 100% sure ) you should cast a circle (or a box) which is slightly more complicated. What you do in this case however, is enlarge the walls by the agent radius obtaining a sort of rounded walls (the corners of the inflated walls will be filled with arcs), and then cast a ray against them; the ray shall have length = distance_of_wall_detection (which could be current_velocity * time_of_prediction). You will need segment to segment intersections and segment to circle intersection
( http://www.gamedev.n...e-intersection/ )
By the way, (I am saying this just not to let anything out) do you connect the node of the graph based only on the criterion that two adjacent cells are passable?
If yes you should instead cast a box as large as a gridcell (or as large as an agent bounding box) towards an adjacent cell and connect them only if no intersection with any static obstacle occurred. In this way the smoothed path you showed might not be computed: the agent will go up to the cell with the value = 2 and the steer by 90° towards the goal.
I hope this helps.

Edited by Tannerd, 14 July 2012 - 01:36 AM.


#10 xiongyouyi   Members   -  Reputation: 150

Like
0Likes
Like

Posted 13 July 2012 - 02:22 AM

It's so complicated! I will think about NavMesh, NavMesh return the result triangle channel, the edge of the channel will be wall, so it will be easier to integrate with steering behavior. And we use lockstep simulation in our rts, there will be thirty units request pathfinding in a single logic frame, 512X512 grid Astar maybe inefficient.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS