Ballistica is the line-of-sight and trajectory calculation system used in Remixed Dungeon. It implements a digital differential analyzer (DDA) algorithm to determine the path between two points, taking into account obstacles and blocking terrain.
Mechanics
Digital Differential Analyzer (DDA): Uses a line-drawing algorithm to trace a path between two points
Obstacle Detection: Returns the last traversable cell when encountering blocking terrain
Character Blocking: Can optionally stop at characters in the path (depending on the hitChars parameter)
Object Blocking: Can optionally stop at level objects (depending on the hitObjects parameter)
Technical Implementation
Static Class: Contains static methods and variables for path calculation
Trace Array: Stores the calculated path in the static 'trace' array up to the 'distance' variable
Parameters: The cast method accepts parameters to determine if magic (can pass through some obstacles), whether to hit characters, and whether to hit objects
Algorithm: Implements an optimized version of Bresenham's line algorithm with obstacle detection