# Techniques of dodging/path planning

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

## Recommended Posts

Hi, If I have an infrastructure in the scene, there are poles and racking systems and many others, how do I ensure that say the worker won't walk into the poles and stuff like that? Thanks a lot Jack

##### Share on other sites
hmm... Wrong forum I think - I'll punt this over to AI for you [smile]

You'll need to be more specific about what information you have - solving these problems is usually much simpler once you clearly and precisely define the problem space.

At a guess, some sort of graph based approach might be sufficient. If you can pre-process your scene to generate a graph of where workers can/can't move then you're most of the way there. You can add one of the many path-finding algorithms (e.g. A*) on top of that in order to get your workers to move around obstacles accordingly.

hth
Jack

##### Share on other sites
If the obstacles are small enough when compared to the free space around them,
you can ignore them in the pathfinding, then use simple collision-avoidance behavior when following the path.

##### Share on other sites
Quote:
 Original post by jollyjeffersYou'll need to be more specific about what information you have - solving these problems is usually much simpler once you clearly and precisely define the problem space.

Yep, that's because: Problem's imply Solutions.
given problem X
solution = !X

##### Share on other sites
Quote:
 Original post by Anonymous PosterYep, that's because: Problem's imply Solutions.given problem Xsolution = !XAdd this to FAQ?

I think you meant to say something like:
given problem X and constraints C, find a solution X-1 such that
X-1X=C

Of course, that would only be possible for a very limited class of problems. ;)

##### Share on other sites
Off topic:

I don't think that fits in the FAQ [rolleyes].
Solutions imply problems (it's not a solution if it doesn't solve a problem), but problems don't necessarily imply solutions. Cold fusion is a problem, but there aren't and will be no solutions... Unless some major revelations come out.
Also, the solution to a problem isn't simply 'not the problem'. Given a question, anybody can negate it, but not everybody can solve it. It's much closer to what Timkin said.

On Topic:

Some form of collision detection is necessary for this. The simplest, but most CPU-intensive method would be determining mesh intersections. Usually some constraints can be laid out so that the collisions can be projected to fewer dimensions. In this case, a new way of representing the environment would be useful. Tell us more if you're still around.

Regards

##### Share on other sites
Do the structures exist before the game runs, or are they dynamically placed by the user?

-me

##### Share on other sites
OFF Topic

Quote:
 Original post by TimkinI think you meant to say something like:given problem X and constraints C, find a solution X-1 such thatX-1X=COf course, that would only be possible for a very limited class of problems. ;)

Ok, you've got a good point there.
Even so, I think that a large portion of those limited classes of problems, tend to be the kind that (forgive the term) newbies ask a lot of. Hence the merit of adding it to a faq.

for example: 'I'm building a terrain with a vehicle driving across it but it keeps falling through the floor, what do I do?'(real past example)

answer: Program it to NOT go thorough the floor. (It's blunt, and rude, but it's also very true, a simple 'if below floor, then go above floor', totally suffices and follows directly from the advice)

I think it's really a question of confidence, too many people with problems like this forget that They are the Programmer, and don't take the time to think about what solutions their problem might imply...

Sorry for the OffTopic
but if you look at what I said and clean it up to be less arrogant and rude it *might* have a valid point to be remembered
END

##### Share on other sites
ON Topic

Are all your obstacles convex? -no dents or 'pockets' that your character might walk into and get trapped?

If everything's convex you can just get away with walking right into stuff and sliding around to one side.

To make it look less 'dumb' you can even make those obstacles invisibly larger and slide around that invisible border instead, so it looks like an intelligent early avoidance.

##### Share on other sites
OFF TOPIC

lol i know thats not what u were refering to.

##### Share on other sites
Thanks to everyone for the inputs.
For now, I just searching google for 3d pathfinding
I only got pathengine from the results which is commercial
It doesn't seem to be a corresponding source found in the open source community
Thanks
Jack

##### Share on other sites
Steering behaviours help with small obstacles. I believe there is an OpenSteer library available for you.

##### Share on other sites
if you want path finding then try the A* algorithm.
if you want a demo of it go to www.gametutorials.com and it's in one of their windows examples.

However, if you want a cheap n cheerful path finding then try my own very special brand:

at way point 1. Want to go to way point z.
get yaw required from pt1 to ptz. Choose the waypoint connected to pt1 that is closest to this yaw - call this pt2. Go to this pt2.
Then repeat the above:
get yaw required from pt2 to ptz. Choose the waypoint connected to pt2 that is closest to this yaw (but don't choose pt 1 unless there are no other connections)- call this pt3
Then repeat the above:
get yaw required from pt3 to ptz. Choose the waypoint connected to pt3 that is closest to this yaw (but don't choose pt 2 unless there are no other connections)- call this pt4
repeat until you get to point z.

By the way - this is efficient but not too good when there are dead ends.

cheers

##### Share on other sites
Dear,
Seems good. But I am worrying about the load of the GPU.
Because I have a fair bit of objects to implmement at the same time
Can your approach apply to multi-objects scenrio?
Thanks
Jack

##### Share on other sites
sorry it took a while to get back to you - in my game I have 300 buildings, 180 enemies and the average fps is about 90fps.
Not sure how much gaming experience you have but:

1) frustum cull all of the buidings so you're only drawing the ones nearby
2) if you have a lot of bots then only bother doing the AI for enemies nearby - if they're further than 200m say then don't bother doing the AI for them.

##### Share on other sites
ade-the-heat -> A* is just a little more complex that that, and it works well even with non-convex polygons (so long as you give it the right nodes to choose from).

lucky6969 -> Assuming you mean CPU load, an easy way to do this is with a priority que for the bots pathfinding, with the priority being how close they are to the player.

Those right next to him get their paths done instantly, those further away have to wait longer and longer and those that are very very far away may be starved entirely (until the player walks closer).

Maybe a kd tree or similar to efficiantly determine the bots closest to the player ? (which might come in handy later on as well)

##### Share on other sites

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

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628711
• Total Posts
2984341

• 23
• 11
• 10
• 13
• 14