Staredit Network > Forums > SC1 UMS Theory and Ideas > Topic: Directional Collision Detection
Directional Collision Detection
Aug 7 2011, 3:09 am
By: Sacrieur  

Aug 7 2011, 3:09 am Sacrieur Post #1

Still Napping

Traditional collision detection can be done with a single location by simply overlapping a location over a unit. However, detecting where the collision occurred is more difficult. The system is made possible with use of skewed locations. Four different locations put a buffer around a unit and can detect a collision in any one of four cardinal directions.

There is a limitation: inverse logic must be used, so a collision on any two opposite sides at the same time will confuse the system. The logic is simple, however.

A: the unit is in the skewed location
B: the unit is not in the non-skewed location

If A and not B, then the unit is above or to the right.
If B, then the unit is down or to the left.

Since the non-skewed location hangs over both sides of the unit, SC will detect a collision regardless of the side. However, by adding the inverse of the second condition (not B), which side the collision took place on can be determined. But in solving this problem, we create another: if a collision occurs on both sides of the unit, the system will not detect the non-skewed direction. Fortunately, Aristocrat presented a solution:

If there are at least two B, but only one A, then then there is a collision on both sides.

While this solves the problem, it is not a true fix, since adding another A would invalidate the triggers. Fixing this with the same method would be invalidated by three As, and so on.

---

The uploaded map demonstrates this system.

Attachments:
DCD.scm
Hits: 16 Size: 39.12kb

Post has been edited 5 time(s), last time on Aug 20 2011, 7:14 am by Sacrieur.



None.

Aug 7 2011, 3:14 am TiKels Post #2



"Shifted locations" is already a term for a location that is bigger than the map in at least one dimension, usually 2x the size of the map. Also interesting application and use of the odd sized location thing.

You have to use 4 locations but there are two ways of doing it. Let's say this is a pixel grid and there is a unit that is 1 pixel large.
Code
123
456
789

Location 1 would encompass 5 and 6, location 2 would encompass 4 and 5, location 3 would encompass 2 5 and 8, and location 4 would encompass all of the squares. If a unit enters location 4 he has collided. You then detect which sides he has hit. I think this would be the ideal way of doing it since you only need 1 trigger to detect if they collide, but I didn't bother to look at your map to see if this is what you did.

Post has been edited 1 time(s), last time on Aug 7 2011, 3:22 am by TiKels.



"If a topic that clearly interest noone needs to be closed to underline the "we don't want this here" message, is up to debate."

-NudeRaider

Aug 7 2011, 3:18 am Sacrieur Post #3

Still Napping

Calling them skewed locations now.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2026-7-18. : 2:27 am]
Symmetry -- https://staredit.net/topic/18903/ THE REVIEWS ARE HERE! "ok these are pretty good memes" - ssj9Kevin
[2026-7-17. : 2:58 pm]
Ultraviolet -- Symmetry
Symmetry shouted: Man I wish we had this tech back in the day when people played ums lmao
fr fr
[2026-7-17. : 2:39 am]
Symmetry -- Man I wish we had this tech back in the day when people played ums lmao
[2026-7-16. : 6:28 am]
NudeRaider -- EUD actions, specifically. The conditions remained. Today we can even have actions again, but they're all virtualized/whitelisted (not sure on the actual technical implementation) so you can only use them for specific intended purposed, not arbitrary code injections.
[2026-7-16. : 6:26 am]
NudeRaider -- I mean yes, maps - through EUDs - were theoretically able to do that as well, but that was patched quickly.
[2026-7-16. : 6:25 am]
NudeRaider -- Symmetry
Symmetry shouted: Ohhh imagine a SC map that could delete itself
not the map, the editor
[2026-7-16. : 2:28 am]
Symmetry -- I vaguely remember Voy doing some ACE back in the day, but I had no idea EUDs could do that kind of shit. I am very much catching up on the technology
[2026-7-16. : 2:28 am]
Symmetry -- Ohhh imagine a SC map that could delete itself
[2026-7-15. : 8:51 pm]
NudeRaider -- Symmetry
Symmetry shouted: NudeRaider Is EUD editor capable of writing shit onto the player's harddrive? That seems like it would be dangerous
yeah an editor that isn't allowed to write files sounds rather pointless, so I'd assume it can. Like most other programs too btw. and yes, obviously that's dangerous, but also kinda necessary. MS introduced that virtualization for exactly that reason.
[2026-7-15. : 4:10 am]
Ultraviolet -- I don't think so. I think they shut that shit down after 1.16, maybe even earlier
Please log in to shout.


Members Online: IskatuMesk