Collision Response in a RTS game, still trying to figure it out.
-
The problem in a RTS is that you can move in a limited number of directions. A RTS is not a First Person Shooter or a physics engine, if you collide in a RTS the only options are keep going forward or go back where you came from until you reach the your last path node. Once there you have more options (but still limited to only several directions). For instance if two units move towards the same node, one heading West and the other heading South, South West or South East, I think the unit moving South Something should stop or go back while the other one should keep going. If two units A and B collide head on you can use the rule “use the right lane”, I tried that it works. However if a third unit already uses what is “the right lane” of unit A, unit A will have nowhere to go. How do you proceed in a situation like this?
-
The problem in a RTS is that you can move in a limited number of directions. A RTS is not a First Person Shooter or a physics engine, if you collide in a RTS the only options are keep going forward or go back where you came from until you reach the your last path node. Once there you have more options (but still limited to only several directions). For instance if two units move towards the same node, one heading West and the other heading South, South West or South East, I think the unit moving South Something should stop or go back while the other one should keep going. If two units A and B collide head on you can use the rule “use the right lane”, I tried that it works. However if a third unit already uses what is “the right lane” of unit A, unit A will have nowhere to go. How do you proceed in a situation like this?
If the "nodes" are pixels, it's not a problem ... you have a lot more "nodes" to work with. "The limited number of directions" are what you imposed; it's not a "feature" of RTS per se. (My units can "slide" around an object, if I let them; much like walking with one hand on a wall)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
If the "nodes" are pixels, it's not a problem ... you have a lot more "nodes" to work with. "The limited number of directions" are what you imposed; it's not a "feature" of RTS per se. (My units can "slide" around an object, if I let them; much like walking with one hand on a wall)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
>you have a lot more nodes to work with I think center of a tile or pixel is a question of resolution.
-
The problem in a RTS is that you can move in a limited number of directions. A RTS is not a First Person Shooter or a physics engine, if you collide in a RTS the only options are keep going forward or go back where you came from until you reach the your last path node. Once there you have more options (but still limited to only several directions). For instance if two units move towards the same node, one heading West and the other heading South, South West or South East, I think the unit moving South Something should stop or go back while the other one should keep going. If two units A and B collide head on you can use the rule “use the right lane”, I tried that it works. However if a third unit already uses what is “the right lane” of unit A, unit A will have nowhere to go. How do you proceed in a situation like this?
Handling collisions in an RTS is tricky. Use smart pathfinding algorithms like A*, and consider dynamic obstacle avoidance. When collisions happen, prioritize units based on criteria like size or speed. Also, think about predicting collisions and adjusting paths ahead of time. And hey, allowing players to set waypoints can give them more control. It's a bit like orchestrating a dance – you want your units to move smoothly and avoid stepping on each other's toes! 🕺💃