Files
major_tom/TODO.md
Thomas df3bc29fb7 Support large maps up to 8192x8192 tiles
Raise hard map size cap from 4096 to 8192 via MAX_MAP_SIZE constant.
Replace fixed 16 KB fgets buffer with dynamic line reader that handles
arbitrarily long tile rows. Check calloc returns for tile layer
allocation.

Add entity distance culling: skip updates for entities beyond 2x screen
width from camera, skip rendering beyond 64 px margin. Dead entities
bypass culling so cleanup callbacks always run. Player, spacecraft,
drone, and moving platforms set ENTITY_ALWAYS_UPDATE to opt out.

Replace naive 4-neighbor flood fill with scanline algorithm (O(height)
stack instead of O(area)) for safe use on large maps.

Raise MAX_ENTITY_SPAWNS from 128 to 512 and MAX_EXIT_ZONES from 8 to
16 to support populated large levels.
2026-03-01 15:17:58 +00:00

4.0 KiB
Raw Blame History

TODO

Distance-based sound effects

Implemented: audio_set_listener(), audio_play_sound_at() with linear attenuation and stereo panning. Used by enemy death, asteroid impact, and powerup pickup.

Spacecraft art and entity

Implemented: spacecraft PNG spritesheet (5 frames, 80x48 each), full entity with state machine (FLYING_IN → LANDING → LANDED → TAKEOFF → FLYING_OUT → DONE), engine/synth sounds, thruster particles, level intro sequence with deferred player spawn.

Large map support (5000x5000)

Audited and fixed all engine bottlenecks for maps up to 8192x8192:

  • MAX_MAP_SIZE constant (8192) replaces hard-coded 4096 caps in tilemap loader and editor resize. Tile layers allocate fine at 5000x5000 (~143 MB).
  • Dynamic line reader in tilemap_load() replaces fixed 16 KB fgets buffer; handles arbitrarily long tile rows without truncation.
  • MAX_ENTITY_SPAWNS raised from 128 to 512; MAX_EXIT_ZONES from 8 to 16.
  • Entity distance culling: entity_update_all() skips entities beyond 2× screen width from the camera; entity_render_all() skips entities outside the viewport + 64 px margin. Player, spacecraft, and drone use ENTITY_ALWAYS_UPDATE flag to opt out of culling.
  • Editor flood fill replaced with scanline algorithm — O(height) stack usage instead of O(area), safe for very large maps.
  • Verified: tilemap rendering already viewport-culled, physics queries are O(1) local tile lookups, float precision fine up to ~1M pixels (62 K tiles).

Spacecraft at level exit

Implemented: spacecraft_spawn_exit() with is_exit_ship flag. Proximity trigger in level.c spawns exit ship when player is within ~2 screen widths of an exit zone. Ship flies in, lands near exit. Player overlaps landed ship → player deactivated, ship takes off, camera holds still, level transition fires after ship departs (SC_DONE).

Asteroid refinement

Implemented: base speed 120→200, accel 200→350, respawn 3→6s, stagger 0-3→0-8s, random horizontal drift (±60 px/s), moon level reduced from 24 to 8 asteroids.

Moon campaign: 3 levels with spacecraft transitions

Implemented: 3 moon levels connected by spacecraft takeoff/landing sequences.

  • moon01.lvl (1000 tiles) — Exit triggers spacecraft, transitions to moon02.
  • moon02.lvl (200 tiles) — Crater fields, tighter platforming. Spacecraft intro, 7 asteroids, unarmed. Exit to moon03.
  • moon03.lvl (150 tiles) — Dark side, hardest moon terrain. Spacecraft intro, 5 asteroids, unarmed until gun powerup near exit. Exit to level01.
  • level01.lvl — Space station with spacecraft landing intro (arriving from moon).

Level generator: height zones (verticality)

Implemented: tall level support (46 tiles, two screens) with height zones.

  • Camera vertical look-ahead (30px lead when player moves vertically > 50 px/s)
  • All segment generators (gen_flat, gen_pit, gen_platforms, gen_corridor, gen_arena, gen_shaft, gen_transition) accept ground_row parameter — platforms, enemies, and hazards are placed relative to the zone's ground level
  • SEG_CLIMB connector segment type: vertical shaft with alternating platforms, wall openings, optional moving platform and enemies, bridges height zones
  • levelgen_generate() assigns zones per theme: Surface → LOW (row 43), Base → HIGH (row 17), Station → alternates. SEG_CLIMB auto-inserted at zone boundaries. Single-theme levels stay at standard 23-tile height.
  • Station generator unchanged (23 tiles, corridor envelope constrains)
  • Tall test level: assets/levels/tall_test.lvl (40x46)

Jetpack boost blue flame effects

Implemented: particle_emit_jetpack_boost_burst() (electric blue core + blue-white flare, 18 particles mixed into regular burst) and particle_emit_jetpack_boost_trail() (blue sparks + pale blue wisps, 3 particles/frame). Both activate only when jetpack_boost_timer > 0. Burst fires on dash start, trail emits each frame during dash.