Log inGet started
Package

projectileKit.testSuite

README.md

projectileKit.testSuite

Tests for projectileKit: the flight maths (bullets, ballistic shells, homing missiles, lead), the shot loop (hits, arrivals, recycling shot tables, the shot budget) and the render pools (entities made once and reused frame after frame, parked when unused).

Running

In edit mode:

tools.use("tests", "run", { suites = { "projectileKit" } })

Each test clears shots and counters before it runs and restores the budget and clears the pools afterwards, so the suite leaves nothing behind.

What it checks

projectileKit maths

  • vec.of reads arrays, xyz tables and vectors; the quaternion helpers turn +Z where asked.
  • A shell solved by solveBallistic lands exactly on its aim point and peaks arc metres above the higher end.
  • A bullet flies straight at its speed and hits a target standing on its line.
  • A homing missile launched straight up turns onto a target that walks sideways and hits it.
  • lead() aims ahead of a walking target so a bullet and the target meet.

projectileKit shots and pools

  • Fired shots run through PK.step and call onHit once each; finished shot tables are reused by later shots.
  • Over the shot budget a shot lands at once instead of flying, so no hit is lost.
  • Drawing reuses pooled entities: the same number of tracers on later frames makes no new entities, and unused ones are parked at zero scale.
  • Budget presets exist for desktop, web and phone and set every number.
  • Beams last only while they are called, and arcs, puffs and bursts are effects with a lifetime.