Archived

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

d000hg

Awkward collision avoidance situations..

Recommended Posts

d000hg    1199
If you''re travelling close to the wall and there''s an obstacle too close to pass between it and the wall, what do you do? Or with two rocks and you can''t get between them. Naive avoidance code will end up leaving you stuck between them. What''s a nice way to do this - prioritise the closest rock as the one to avoid?

Share this post


Link to post
Share on other sites
d000hg    1199
Well currently I just try to avoid what''s in front of me. Thinking ''I''ll nip through this gap'' is a whole level of complexity above this. I guess you could look to see if where you want to go there is a free path wide enough, using simple geometry, but if you''re moving parallel to a wall you can''t see it to make these checks.

Share this post


Link to post
Share on other sites
Peon    276
I have a variable called DistanceTraveled and every frame that I move forward, it gets increased. However, if I make a turn, I reset it to 0. If DistanceTraveled gets to a somewhat large number, I can deduce that I am stuck on something. I can then reverse a few units, and change my direction.

I also have a function called FindClosestObject() that returns the index of the closest object. I don''t know how you''re doing your avoidance code, but I use that function to find out what I should be avoiding.

Share this post


Link to post
Share on other sites
liquidAir    314
Well, this is quite odd and somewhat stupid, but I make my bot to turn left fast, ie, 180 degrees, every 6 seconds when it hasn''t seen the enemy. It helps my bot to get out of places where it''s stuck; and it works 95% of the time.


"We know you''re in here, poppet!" - Pirates of the Carribean


InitGames Software
http://www.initgames.breezeland.com/

Share this post


Link to post
Share on other sites
Peon    276
Every six seconds? It seems like you''d just end up pacing back and forth if you did that. The method I use above is pretty similar, except that I check for a lack of an object every few seconds; not an enemy.

Then again, your (earlier revision) bot pwns my bot, so I shouldn''t talk

Share this post


Link to post
Share on other sites
MelvinElvin    122
i would change the way you calculate your distance travelled var. Only increment it by the distance between your current (new) position and your position from the previous frame. If this value doesn't increase between frames by some reasonable amount, then you're stuck. It would avoid the obvious problems of "if my distance travelled gets too big then i'm stuck".

[edited by - MelvinElvin on August 13, 2003 8:40:58 PM]

Share this post


Link to post
Share on other sites
d000hg    1199
An obvious choice would be to make some kind of map in memory. However how do you keep this correct when you could easily get stuck when reversing/strafing in a dog-fight situation? I guess you could make a very basic pattern matcher to recognise ''constellations'' amongst objects and thus correct your map, or use the walls somehow. If you can find a corner you can locate yourself well, but finding it is tricky!

Share this post


Link to post
Share on other sites
d000hg    1199
Oh and is it just me, or when you're right up against an obstacle is turning toward it somtimes impossible?
Plus when I see a rock is directly in front of me it's at 0degrees right? And the same for walls?

[edited by - d000hg on August 14, 2003 4:32:53 AM]

Share this post


Link to post
Share on other sites