#### Archived

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

# Path finding...

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

## 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 on other sites
Well, to make it short: Pathfinding is very komplex.

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.

Danvil

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

##### Share on other sites
ARGH,
so much spelling mistakes

1. 1
Rutin
36
2. 2
3. 3
4. 4
5. 5

• 11
• 15
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633353
• Total Posts
3011485
• ### Who's Online (See full list)

There are no registered users currently online

×