Started with the game idea: What you don't see is not real
It's a 2.5D game where you play as Lumino, the ball with the magical flashlight
Anything you can't see without the flashlight only exists when it's lit by it
(LighterBlocks in 1-DIMENSION. I call it the LighterStairs)
(LighterBlocks in 2-DIMENSIONS)
This algorithm demonstrates how Lumino's flashlight works
What's my idea behind the 2-Layer-Buffer algorithm for the tracer,
is that if you want to prevent the CollisionToggles to be called on every tracer hit/miss
you'd want to have something that's one step behind (Less sensitive) to the tracer hits/misses:
-
Since there are multiple line traces (which reduces trace misses), we'd need to add an EXTRA DATA STRUCTURE to handle how many LighterBlocks we've hit in one group trace It's called the "HITSET"
-
HITSET in turn controls what objects we have in a list that contains the actual LIT ITEMS It's called the "LITSET"
-
We need the LITSET because we need to toggle the collisions on the LigterBlocks ONLY ONCE
- HitSet => It is PER-LINE-TRACE sensitive
- LitSet => It is PER-FRAME sensitive
-
Trace out N lines along your SpotLight's Cone
-
If you hit a LighterBlock on any of the traces a. Call the ToggleCollision function on it to enable collision b. Add it to the list of Lit Items
-
If all of your traces fail to find the LighterBlock a. Call the ToggleCollision again to disable collision b. Remove it from the list
- The ToggleCollision function only sets the target collision, but the real collision change occurs when NOTHING's overlapping the LighterBlock