Table of Contents

Machine-Readable: Ballistica Mechanic

Technical reference page for the Ballistica line-of-sight and pathfinding system.

Java Implementation

File: `RemixedDungeon/src/main/java/com/watabou/pixeldungeon/mechanics/Ballistica.java`

Class: `com.watabou.pixeldungeon.mechanics.Ballistica`

Static Fields

Methods

cast(int from, int to, boolean magic, boolean hitChars)

cast(int from, int to, boolean magic, boolean hitChars, boolean hitObjects)

getBacktraceCell(int distFromEnd)

Algorithm

The Ballistica system uses Bresenham's line algorithm for path calculation:

1. Calculate starting (x0, y0) and target (x1, y1) coordinates 2. Determine step direction for X and Y axes 3. Use major/minor axis stepping with error accumulation 4. Trace cells until target is reached or obstacle is encountered 5. Store each cell in the trace array

Usage in Game

Ballistica is used by:

Lua Interface

The `getBacktraceCell` method is exposed to Lua via @LuaInterface annotation for scripting support.