Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Brackus

Path finding...

This topic is 6425 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

Okay, lets say I am making a sports game, theres a field with nothing special but out of bounds lines, and nets. Theres a goalie for each team, and I have it move to make the save, and not go too far out of the net. Then there is one defense, who will not be allowed out of a certain radius (because I want the defence to stay defending) then I have maybe 1-2 forwards per team, now, for the units not player controlled, how do you make them go towards the ball, if they know the balls x,y coordinates, but the ball is moving maybe. Is there an algorithim to calculate this??? will it calculate for a moving ball too??? Also, is there something to figure out the velocity of the ball, and make it slow down and stop somewhat realistically??? Also, can you make it so that the algo above works for each player in each loop???

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Well, to make it short: Pathfinding is very komplex.

But with your problem, I can perhaps help you:
Do you now Bresenham''s Line-Drawing Algorithmus?
It''s a tricky Algo to Draw a Line from one Point ot another...
Well, BUT you can also use it to move your player from his position to another!

For the moving ball, check out the last position of the ball and the current one, make a vector out of it: that''s the way the ball move in one frame. Then multiply yout vector with e.g. 100 and you will have the position of the ball 100 frames later.

Perhaps this can help you
Danvil

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Oh, and for realistic movement
Look up in your physics book! ;-)
Real physic is the best way to simulate reality...
Danvil

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
ARGH,
so much spelling mistakes

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!