Advertisement

Wall Avoidance

Started by January 25, 2011 04:34 PM
15 comments, last by IADaveMark 13 years, 9 months ago
Oblong walls. Consider a wall 1 unit thick by 35 units long. Its "sphere of influence" must be 35 units across to encompass the entire wall. Now the agents approaching it perpendicularly will start steering away long before they reach the actual surface.

Yes, you could do irregular regions of influence - OBBs/ellipsoids/convex polyhedra/whatever - but at that point your worst-case complexity decays into doing a couple of raycasts towards the level geometry anyways.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]


Oblong walls. Consider a wall 1 unit thick by 35 units long. Its "sphere of influence" must be 35 units across to encompass the entire wall. Now the agents approaching it perpendicularly will start steering away long before they reach the actual surface.

Yes, you could do irregular regions of influence - OBBs/ellipsoids/convex polyhedra/whatever - but at that point your worst-case complexity decays into doing a couple of raycasts towards the level geometry anyways.


Thanks for explaining that.

When creating feelers using rays, do I only need to account for the current heading direction?

If so why would I need more than one ray?
Advertisement

When creating feelers using rays, do I only need to account for the current heading direction?
If so why would I need more than one ray?

Just one ray might pass through a gap too narrow for the agent to pass through, also if the agent has to flee, where does he flee to?
Fuzzy logic can help a lot. Here's a (rather complex, but you'll get the idea) example I did for my university course.
This uses 64 rays and a technique similar to the one that Schwartz86 mentioned. You can use less rays or cast less often, but it's a good way to handle unknown environments.
Stickmen Wars 2 is in development.
Meanwhile try Bloodridge
Since it's 2D, have you considered a collision map? Compared to polygons, they're faster and easier, but use more memory.
Anthony Umfer

[quote name='ApochPiQ' timestamp='1296777463' post='4769258']
Oblong walls. Consider a wall 1 unit thick by 35 units long. Its "sphere of influence" must be 35 units across to encompass the entire wall. Now the agents approaching it perpendicularly will start steering away long before they reach the actual surface.

Yes, you could do irregular regions of influence - OBBs/ellipsoids/convex polyhedra/whatever - but at that point your worst-case complexity decays into doing a couple of raycasts towards the level geometry anyways.


Thanks for explaining that.

When creating feelers using rays, do I only need to account for the current heading direction?

If so why would I need more than one ray?
[/quote]

Theoretically, you want a cone in front of you that is slightly wider than you are. However, because the sim rate is likely far faster than you are moving, you can get away with casting one ray per frame, scatter it around that cone, and be, in essence, testing the entire cone as you move. If your rays are 2 units long and it takes you 2 seconds to move those 2 units, think of how many feeler rays you can fire off in that time at one per frame. And lets face it, doing one ray cast per frame beats doing 360 of them!


Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"


Theoretically, you want a cone in front of you that is slightly wider than you are.



Does this also apply to ledges or sudden changes in height?

For example an agent will avoid hitting a wall by sending feelers out around it. To avoid falling down holes should those feelers originate from the same point but be angled towards the floor (or ceiling for low hanging obstacles)?


EDIT:

Why would I require two separate methods for obstacle and wall avoidance? If a feeler can detect a wall, it can also detect a moving object or obstacle?
Advertisement
I thought this was a 2D top-down game? But yes, you need to use feelers to account for height changes as well, although depending on how exactly your locomotion system works you may find it easier to use a pie-slice-shaped wedge instead of a 3D cone to get the right semantics.

Feelers can certainly detect moving objects, yes. However, they can't tell you anything about the trajectory of moving objects. An intelligent steering system can help you avoid a moving obstacle not just in its current position, but its future positions as well - think dodging.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

If you detect a dynamic object, you can then ask it for its movement information and calculate based on that. Just an extra step, really.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

This topic is closed to new replies.

Advertisement