jtsymon/shadow

Doors

jtsymon opened this issue · 0 comments

Currently the map is completely static, and shadows are optimised with pre-calculated line-of-sight between corners of walls.
Changing this will affect both collision detection #7 and shadow rendering.
I see two basic ways this can be done:

  • Add a special wall type that can "disappear"
    Collision detection would ignore the door when open.
    The line-of-sight calculation would have a cached ordered list of doors that it hits, and a final non-door wall. When rendering, line-of-sight continues to the first closed door, or the wall.
    This avoids having to recalculate line-of-sight (probably more efficient), but complicates things like moving walls (although those could be implemented as a special type of door which does recalculate its line of sight when it is moving, but only if the range of possible positions are known).
  • Allow modifying any walls, and add some way of detecting the affected cached line-of-sight values.
    This allows completely dynamic walls, but is probably more expensive to do.
    Can be optimised by recalculating only the affected line-of-sight. This would tie into #1.
    Collision detection wouldn't require any changes (assuming nothing is pre-calculated/cached #7).