Sign in to follow this  

Following dynamically changing path

This topic is 3632 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone, I'm working on a project of mine (RTS) and have stumbled upon a problem. What I need to do for the computer, when seeing a group of enemies, is to circle around them on the distance of it's gun range and attack. At the moment, I am able to calculate actual enemy groups (distance sorting via graphing) and get nearest group for computer to attack. However, when approaching such group, I can't make the computer either follow the specified path around enemies group. The path is constructed as a simple convex hull expansion on the weapon range - it's called polygon offsetting. The thing is that player' objects may move, thus requiring calculation of primary/secondary hulls almost per-frame basis, thus I need to re-create hulls each time and cannot have "next" pointers for computer to go to after reaching specified distance to point on secondary, expanded hull. So, my question is as follows: what is the best way to go here? Use forces, ala http://www.red3d.com/cwr/steer/PathFollow.html, or somehow acquire next counter-/clockwise point on secondary hull and go towards it? Please give examples if you can. Thank you.

Share this post


Link to post
Share on other sites
What I gather is that you're basically constructing a set of waypoints for your attacking unit to follow. And, as the victim group moves, those waypoints become invalid. So what I would do is only calculate one waypoint in advance, and I would keep updating this waypoint to a valid location (by making the waypoint move the same way the victim unit group is moving, or something). Once the attacker reaches that waypoint, construct the next one and do the same thing.

If it's not possible for your current waypoint to remain valid, then I'd tell the attacker to attempt to circle in the opposite direction, if possible.

This method should ensure the attacking unit is always attempting to move to a valid waypoint.

Share this post


Link to post
Share on other sites

This topic is 3632 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this