Game Development Community

Pushing objects?

by Cinder Games · in Torque Game Engine · 10/08/2005 (8:49 pm) · 5 replies

Anyone have some good code for this? i want the bots to be able to push each eachother around so they don't just bump into eachother. I've done this with applyimpulse but that's kinda violent way of shoving something around... was looking for something smoother. Could also be used for pushing crates or something i guess. but i'm more interested in having my bots be able to break thru a group of enemy bots to get to his goal.

#1
10/11/2005 (4:55 am)
*bump*
#2
10/11/2005 (5:34 am)
On collision, you could send a message to the other bot saying get out of the way.. that is, if the bot being collided with is not active.. otherwise you could end up with all of the bots telling each other to get out of their way and locking up the game for a while.
#3
10/11/2005 (5:38 am)
Yeah, i thought of that idea. with my code, it sets a flag for if you are pushing.. or being push. if you are being pushed... you can still push other others, that you're being pushed into... however, you can't push back againts a bot that's pushing you.
#4
10/11/2005 (7:04 am)
Well, the way I see it working is this...

Your bot hits another bot and sends a PleaseMoveOutOfTheWay message to the bot it collides with.
The bot attempts to move out of the way, but can't because another bot is in the way. So it tells the bot in the way, PleaseMoveOutOfTheWay and sets a scheduled function call to remind it to try again in a bit..

Eventually, the bots on the outside of the pack start moving out of the way and the other bots can follow, a path will open up for your bot to walk through.

It just might take a little time to happen that's all ;o)

You could tweak it so that the bots try to move in a direction at an angle to the direction you want to move to.


But, I'd say, you've got your work cut out for you on this, I've never seen a good implementation of this.. not even in AAA RTS games (although to be fair, I don't play that many)
#5
10/11/2005 (7:09 am)
At the very moment, i'm writing some routines for avoidance, which is working ok. but in case a bump occurs, i guess i'll keep what i have now, and try the "ask to move" and see how that goes.