[edited] collision response in a RTS
-
I have changed my mind about what I want to ask. I’m not interested in groups anymore. How do you solve units colliding at all? If it’s just two units is it about where the two units have been ( last visited node ) and where they are traveling towards? Also what if a unit collides with more than one unit in a short amount of time?
-
I have changed my mind about what I want to ask. I’m not interested in groups anymore. How do you solve units colliding at all? If it’s just two units is it about where the two units have been ( last visited node ) and where they are traveling towards? Also what if a unit collides with more than one unit in a short amount of time?
Hi, It sounds like you just need a push in the right direction. Have a look at the Flow Field family of algorithms. [Flow field algorithm](https://www.google.com/search?q=flow+field+algorithm) Did you have a C++ related question to ask?
-
Hi, It sounds like you just need a push in the right direction. Have a look at the Flow Field family of algorithms. [Flow field algorithm](https://www.google.com/search?q=flow+field+algorithm) Did you have a C++ related question to ask?
Thanks for advice
-
Thanks for advice
-
I have changed my mind about what I want to ask. I’m not interested in groups anymore. How do you solve units colliding at all? If it’s just two units is it about where the two units have been ( last visited node ) and where they are traveling towards? Also what if a unit collides with more than one unit in a short amount of time?
Every move requires distance and direction (target point; angle). Prior to the actual move, one checks for any units that will be "intersected" by moving to that point. Rectangles have position and size. Rectangles collide when they interest. (Unless rotated, then you need to deal with polygons) (The actual move is then shortened so you don't "pass through" the target). The "mover" then is obviously the attacker; the other the defender. If both moving, it was attacking and counter-attaching. The result of a "charge" is a melee or a repulse; followed by a pursuit. There are no "simultaneous" collisions. Any subsquent collisions creates another attacker-defender scenario. And infantry won't pursue other infantry; they fire them down. Cavalry will run down (dispersed) infantry. Cavalry can not be expected to pursue (and catch) other cavalry. Artillery is unable to "run" without limbering up.
"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
-
Every move requires distance and direction (target point; angle). Prior to the actual move, one checks for any units that will be "intersected" by moving to that point. Rectangles have position and size. Rectangles collide when they interest. (Unless rotated, then you need to deal with polygons) (The actual move is then shortened so you don't "pass through" the target). The "mover" then is obviously the attacker; the other the defender. If both moving, it was attacking and counter-attaching. The result of a "charge" is a melee or a repulse; followed by a pursuit. There are no "simultaneous" collisions. Any subsquent collisions creates another attacker-defender scenario. And infantry won't pursue other infantry; they fire them down. Cavalry will run down (dispersed) infantry. Cavalry can not be expected to pursue (and catch) other cavalry. Artillery is unable to "run" without limbering up.
"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
My guess is there is more than one way to solve the problem. Age of Empires version 1 for instance had some issues when a unit was caught between two other units, a problem Warcraft 3 didn’t have.
-
My guess is there is more than one way to solve the problem. Age of Empires version 1 for instance had some issues when a unit was caught between two other units, a problem Warcraft 3 didn’t have.
It's all in the "detecting". Collision detection involves enemies AND friendlies. Is the collision a "blocking" situation, or a "merge" in terms of hand to hand. What you're refering to are "bugs": "trapped" sprites. Regarding "group collisions": in the some "systems", any party "within a minute", is considered party to the "collision" / conflict; i.e. 100 yds for infantry, 300 yds for cavalry.
"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
-
It's all in the "detecting". Collision detection involves enemies AND friendlies. Is the collision a "blocking" situation, or a "merge" in terms of hand to hand. What you're refering to are "bugs": "trapped" sprites. Regarding "group collisions": in the some "systems", any party "within a minute", is considered party to the "collision" / conflict; i.e. 100 yds for infantry, 300 yds for cavalry.
"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
Thanks for your comments Gerry
-
Thanks for your comments Gerry
You're welcome!
"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