megadev-math
Installation
SKILL.md
Megadev Math
Start with the game's units and maximum values. Choose the format from those requirements, then prove every intermediate fits. The Lab's orbit display, colors, controls and motion are illustrations, not design defaults.
Workflow
- Inspect the project's Megadev revision, compiler flags and existing numeric helpers. Read actual
lib/math.handlib/fixed.h; names alone are not an API contract. See the SDK audit and arithmetic contracts. - Write down position/velocity units, fractional bits, maximum delta, product width and rounding rule. Signed Q8.8 is useful for local offsets but cannot hold an absolute 320-pixel screen coordinate. Use a wider position or an integer origin plus a bounded offset.
- Use checked operations at trust boundaries. Reject overflow or zero division before executing a trapping instruction, and preserve the old result on failure. Do not turn a numerical failure into an accidental wraparound teleport.
- Select the cheapest sufficient geometric operation. Compare squared distances for radius tests; normalize only when a unit direction is required. See vectors and trig.
- Separate time from interpolation progress. Keep authoritative state in the fixed game tick, advance render clocks through the existing timing owner, and specify endpoint/interrupt behavior. See interpolation and integration.
- Run independent host oracles and compiled original-M68000 execution checks. Then inspect PAL/NTSC motion in ares. Emulator success does not qualify real-hardware timing.
Standalone example
Run scripts/create_project.py with a new destination. It copies Math Lab, including application helpers, generated quarter-wave table, procedural art, host checks and a Megadev boot/module shell. It refuses an existing destination.
Use ewrogers/megadev:latest with explicit linux/arm64 or linux/amd64, --cpus=2, a bind mount and at most two make jobs. Follow the Lab README for complete commands. No SGDK library, fix16, sinFix16 or floating-point runtime is assumed.