266 Commits

Author SHA1 Message Date
Tom di Mino
2c11de9ef4 feat: v0.10.0 — Full Wiring: dual-AI, CLI exec, ModRuntime, JSONL names
Shared simulation layer: ai2 Option<AIState> for dual-AI in both
interactive and headless modes. Fixed hardcoded MissionFaction::Empire
— now derives from ai_state.faction. mark_available releases characters
from both AI states.

New features:
- --exec CLI subcommand on playtest binary (16 commands from shared registry)
- --dual-ai fully wired in playtest binary (persistent second AIState)
- ModRuntime::discover() at startup, Mod Manager shows real mods
- ToggleMod/ReloadMods handlers functional
- system_name field on JSONL export (resolve_system_names before write)
- Command palette consumes shared commands.rs registry

Reviewer fixes:
- Persistent ai2_state across frames (was recreated each tick — HIGH)
- mark_available on both ai/ai2 (was ai-only — MEDIUM)
- #[serde(default)] not #[serde(skip)] on defense_facility_classes
  (skip broke mod JSON round-trip — Codex CRITICAL)
- mods_dir path aligned: parent().parent() matches data loader

275 tests, 0 warnings, 0 errors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 10:20:15 -04:00
Tom di Mino
cf39c0a472 fix: skip defense_facility_classes in save serialization
Codex reviewer caught that adding a new field to GameWorld breaks
bincode deserialization of existing v4 saves (positional format).
Since defense_facility_classes is reference data loaded from
DEFFACSD.DAT, skip it in serialization and always repopulate on load.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 13:53:34 -04:00
Tom di Mino
1e33cbca55 feat: v0.9.0 — Knesset Tinnit: Completion
Shared command registry, dual AI mode, victory check, game log export,
distinct inspection commands, bombardment defense class lookup from
DEFFACSD.DAT. 275 tests passing (~97% parity).

- commands.rs: 16 CommandDef entries shared between palette and CLI
- 3 new PanelAction variants (ListActiveMissions, ListActiveFleets, ShowEventCount)
- ToggleDualAI wired: spawns second AIState for opposite faction
- ForceVictoryCheck: immediate VictorySystem::check() with result logging
- ExportGameLog: MessageLog::export_jsonl() with Serialize derives
- DefenseFacilityClassDef loaded from DEFFACSD.DAT, bombardment uses real stats
- Fixed 3 inspection commands that were aliased to ShowGameStats

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 08:03:07 -04:00
Tom di Mino
e2755a0804 docs: fix 5 reviewer findings — CLI syntax, doc counts, GNPRTB params
- play-testing.md: fix CLI examples (data_dir is positional, not --data)
- play-testing.md: fix --ticks default (5000, not 1000), add --output/--summary/--dual-ai
- CLAUDE.md: 18 → 19 system docs (play-testing.md was added in v0.8.0)
- architecture.md: add command_palette.rs to render modules listing
- ghidra/notes/INDEX.md: fix combat params 71 → 77 (25 base + 52 per-side)
- ghidra/notes/INDEX.md: fix decompiled function count ~4,900 → 5,127

From doc consistency review (Claude + Codex, 1 critical + 4 important findings).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 12:21:41 -04:00
Tom di Mino
e71d8edc9f fix: reviewer bugs — fog event constant + AdvanceTicks documentation
- game_events.rs: add EVT_FOG_REVEALED constant ("fog_revealed")
- simulation.rs: use EVT_FOG_REVEALED instead of EVT_EVENT_FIRED for fog reveals
- main.rs: document AdvanceTicks limitation (clock-only, systems catch up next frame)

From v0.8.0 code review (Claude + Codex, 2 critical + 3 important findings).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 12:18:21 -04:00
Tom di Mino
d4ca8ccebf docs: consistency fixes — frontmatter, architecture, JSONL schema
- play-testing.md: add missing frontmatter fields (game_system, sources, related, tags)
- play-testing.md: fix JSONL schema to match actual GameEventRecord struct
- simulation.md: document shared run_simulation_tick() and GameEventRecord
- architecture.md: add rebellion-playtest crate + game_events.rs + simulation.rs
- dll-resource-catalog.md: add missing frontmatter
- 4 ref-ui-full INDEX files: add missing frontmatter
- Cargo.lock: sync after adding rand_xoshiro + nucleo-matcher

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:28:29 -04:00
Tom di Mino
22cf8f603f feat: v0.8.0 — Knesset Mami: Play-Test Infrastructure
Structured game event logging:
- GameEventRecord type in rebellion-core (pure data, no IO)
- 15 system constants + 24 event type constants
- Shared run_simulation_tick() in rebellion-data (both binaries call this)

Headless playtest binary (rebellion-playtest):
- Separate crate — no macroquad, no rendering
- clap 4 CLI: --seed, --ticks, --dual-ai, --output, --summary
- EventLogger with JSONL export and summary statistics
- Deterministic Xoshiro256++ RNG for reproducible runs

Command palette (egui, debug-only):
- Backtick (`) opens VS Code-style fuzzy search palette
- nucleo-matcher for fuzzy matching (Helix editor's engine)
- 16 commands: advance ticks, set speed, toggle dual AI, reveal fog,
  force victory check, export log, show game stats
- Gated behind #[cfg(debug_assertions)]

Seedable RNG in main.rs:
- All 10 rand::gen_range() calls replaced with Xoshiro256PlusPlus
- Seeded from system clock (deterministic when seed is fixed)

Knesset Mami: 4 daborot (Kaptaru-II, Mami-II, Popureja-III, Dikte-III).
275 tests passing, 0 failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 18:49:46 -04:00
Tom di Mino
5c0e8f0a80 chore: remove YAML frontmatter from README
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 22:47:16 -04:00
Tom di Mino
5a40e85803 docs: README updated with complete Asset Pipeline section
Added Asset Pipeline section documenting the fully extracted game:
- 2,441 BMPs, 3,223 animation files, 285 voice WAVs, 15 decoded videos,
  16 soundtrack WAVs, 51 DAT files, 511+ text strings, 348 encyclopedia entries
- Six AI-powered upscaling/generation pipelines listed
- Contributing section updated to reflect complete extraction

Every resource in Star Wars Rebellion (1998) is now on disk in open formats.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 22:38:06 -04:00
Tom di Mino
6c81f76b70 docs: all 15 Smacker videos decoded to WebM — complete game extraction
All 15 videos decoded (VP9+Opus, 640x324/480, 271MB total) to
assets/references/ref-videos/. Updated dll-resource-catalog.md and
game-media.md with decoded status, actual resolution (640x324, not
320x200 as estimated), and ffmpeg command.

Every extractable resource in Star Wars Rebellion (1998) is now on disk:
- 2,441 BMP images (all 11 visual DLLs)
- 3,223 BIN animation/data files
- 285 voice WAV files (153 Alliance + 132 Empire)
- 15 WebM videos (decoded from Smacker)
- 16 WAV soundtrack files
- 51 DAT game data files
- 511+ text string resources

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 22:35:20 -04:00
Tom di Mino
7f10757782 fix: update all 6 stale voice extraction references
Voice extraction complete: 285 WAVs (153 Alliance + 132 Empire).
Updated dll-resource-catalog.md, game-media.md, assets.md to reflect
actual counts and remove "not yet extracted" / "requires separate tool".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 22:26:41 -04:00
Tom di Mino
a2206b6e4b fix: remaining reviewer fixes + voice extraction complete + videos decoding
- dll-resource-catalog.md: fixed extraction path claim (4 DLLs in ref-ui/, not ref-ui-full/)
- game-media.md: voice extraction DONE (285 WAVs), all DLLs fully extracted
- assets.md: Pipeline 6 updated — all DLLs extracted, no remaining
- Smacker videos decoding to WebM (640x324/480, VP9+Opus) — in progress

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 22:23:45 -04:00
Tom di Mino
6e71f783f2 docs: reviewer fixes — SubdueUprising note, SOURCES URLs, frontmatter
- missions.md: annotate SubdueUprising as handled by UprisingSystem, not MissionSystem
- SOURCES.md: add clickable URLs for all tiers 1-3 (Prima, MIR, GameFAQs, etc.)
- gnprtb.md: clarify 2-bit selector → 8-level index derivation
- INDEX.md: research description updated to research_order/difficulty
- story-events.md: "4 chains (12 event nodes)" not "12 chains"
- game-media.md: add missing frontmatter

From 4 reviewer passes (2 Claude + 2 Codex) on Knesset Deborah output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 22:18:11 -04:00
Tom di Mino
79cba81fb5 fix: reconcile all asset counts + extract 285 voice lines
Critical fixes from architecture review:
- dll-resource-catalog.md: header total 5,917→5,664 (matches table)
- game-media.md: COMMON 6→321, STRATEGY ~200→1,042, TACTICAL ~100→288,
  GOKRES ~630→580. "Not Extracted"→"Full DLL Extraction Complete"
- assets.md Pipeline 6: removed stale "Unextracted DLLs", updated counts
- vong-total-conversion.md: TC total ~1,412→~1,081 BMPs + ~1,900 BIN
- CREDITS.md: 316+→2,441+ BMPs

New: Per-DLL INDEX.md files for strategy/gokres/common/tactical with
resource ID ranges, modding notes, and image dimensions.

Voice extraction: 285 WAV files (153 Alliance + 132 Empire) from
VOICEFXA/E.DLL via resource type 302 (custom WAVE).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 22:16:00 -04:00
Tom di Mino
88ce94814f docs: granular DLL resource catalog — 2,441 BMPs across 11 DLLs
Per-DLL breakdown with resource ID ranges, image dimensions, and
content descriptions:
- STRATEGY.DLL: 1,042 BMPs (galaxy UI, event screens, character panels)
- GOKRES.DLL: 580 BMPs (entity status sprites, damage diagrams)
- COMMON.DLL: 321 BMPs (buttons, widgets, main menu)
- TACTICAL.DLL: 288 BMPs (combat HUD, ship tactical sprites)
- ALSPRITE/EMSPRITE: 148 BMPs + 1,429 animation data
- ALBRIEF/EMBRIEF: 38 BMPs + 837 briefing data
- REBDLOG: 24 dialog chrome BMPs

Resource ID numbering scheme documented for all DLLs.
CLAUDE.md updated with dll-resource-catalog.md reference.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 22:10:41 -04:00
Tom di Mino
30e3cb8800 feat: complete game media extraction — 2,476 DLL resources + 15 Smacker videos
New extraction script (pefile-based) extracted resources from 6 DLLs:
- ALBRIEF.DLL: 386 resources (20 BMP + 366 animation data)
- EMBRIEF.DLL: 489 resources (18 BMP + 471 animation data)
- ALSPRITE.DLL: 790 resources (C-3PO/R2-D2 advisor, 74 BMP + 716 data)
- EMSPRITE.DLL: 787 resources (Imperial droid advisor, 74 BMP + 713 data)
- REBDLOG.DLL: 24 dialog chrome BMPs

Discovery: 15 Smacker video files in MDATA/ (356MB total):
- MDATA.000-005: Intro + campaign setup (cockpit briefing screens)
- MDATA.101-108: 8 story event cutscenes
- MDATA.201-202: Victory/defeat sequences
Plus 16 WAV soundtrack excerpts (John Williams).

New: agent_docs/game-media.md — complete DLL inventory, resource ID scheme,
extraction status, video catalog, upscaling strategy per asset type.

Total UI: 450 BMPs + 2,342 animation data files across 13 categories.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 18:59:37 -04:00
Tom di Mino
ad0933348b docs: comprehensive update from architecture review — 11 edits
From architecture strategist review of UI pipeline docs:

ref-ui/INDEX.md:
- Added resource ID numbering scheme (900-20000+ across 6 DLLs)
- Fixed category counts (02: 2/5 extracted, 06: 118/129 extracted)
- Corrected droid advisor source (ALSPRITE/EMSPRITE.DLL, not Resources)
- Documented 501 animated advisor frames across 2 DLLs

assets.md:
- Added Pipeline 6: UI Element Upscaling (316+ elements, 10 categories)
- Added ALSPRITE/EMSPRITE.DLL to DLL source list
- Documented unextracted DLLs (ALBRIEF, EMBRIEF, REBDLOG)

vong-total-conversion.md:
- Added UI Chrome & HUD Replacement section (~726-786 UI assets)
- True TC total: ~1,412-1,472 (was 686 entity-only)

CREDITS.md: Added Vertex AI Imagen 4.0, expanded MetasharpNet description
CLAUDE.md: Updated assets.md annotation to 6 pipelines

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 16:53:05 -04:00
Tom di Mino
6ac93e2f68 feat: v0.7.0 — Knesset Hokhmah: Story Events + Release Prep (~95%)
Story events (8 new/enriched chains):
- Force Detection (0x1e1) + Training milestone (0x1e5)
- Dagobah multi-phase: DagobahRequired (0x390), TeacherAssignment (0x392),
  FirstTrainingDay (0x391) with +10 Force XP
- Final Battle full chain: DarthPickup (0x393) → DarthToLuke (0x394) →
  DarthToEmperor alternate (0x395) → FinalBattleReady (0x396) → 0x220
- Bounty Hunter: BountyHuntersActive gate (0x397), Han Carbonite (0x398)
- Palace captures: Luke captured (0x399, guarded by rescue), Palace
  Rescue Complete (0x39A, unfreezes Han)

Event system:
- 4 new EventConditions: CharacterForceExperience, CharacterIsCaptive,
  CharacterIsJediTrainer, EventNotFired
- 3 new EventActions: AccumulateForceExperience, CaptureCharacter,
  SetCarboniteState (freeze sets is_captive + on_mandatory_mission)

Release infrastructure:
- Vendored web/gl.js (WASM builds offline)
- Release profile: LTO, strip, codegen-units=1
- scripts/package-web.sh + package-macos.sh with ROOT anchors
- Example mod: mods/examples/star-destroyer-rebalance/
- GitHub Actions CI: test (macOS) + WASM build (Ubuntu)

Reviewer fixes (3 reviewers, 7 bugs fixed):
- SetCarboniteState freeze path now sets is_captive = true
- Removed self-referential EventNotFired on one-shot events
- Luke capture (0x399) guarded by EventNotFired(0x39A)
- Example mod uses "id" field (not "dat_id") matching ModLoader
- CI uses PATH="/usr/bin:$PATH" for macOS cargo commands
- Packaging scripts use ROOT anchors for cwd-independent execution

Knesset Hokhmah: 3 daborot (Sopher, Sassuratu, Dikte), 19 tasks.
266 tests passing, 0 failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 15:55:34 -04:00
Tom di Mino
aea87e3676 feat: UI element reference collection — 316 files across 10 categories
Extracted from MetasharpNet editor (COMMON.DLL, STRATEGY.DLL, TACTICAL.DLL,
GOKRES.DLL). Organized by function: main menu, galaxy chrome, tactical HUD,
buttons, facility indicators, status panels, droid advisors, backgrounds,
Death Star controls, weapon gauges.

INDEX.md includes per-category upscaling strategy (Vertex AI vs Gemini edit)
and total conversion notes for faction-specific vs neutral elements.

Note: EMSPRITE.DLL contains animated droid advisor sprites (C-3PO/R2-D2)
beyond the static images in Resources/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 14:10:32 -04:00
Tom di Mino
ecceabdbb9 docs: update README.md to reflect v0.6.0 (~92% parity)
- Badge: 92% parity + 259 tests (was "War Machine Complete")
- Current state: all 6 phases listed with delivered features
- Roadmap: Full Parity and Mod Workshop marked complete/in-progress
- Modding: accurate description (patch-only, no additive yet)
- Contributing: updated needs (play-testing, story events, distribution)
- Ghidra RE: corrected to 111 GNPRTB params (was 97)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 10:34:04 -04:00
Tom di Mino
ed0b7e1333 feat: Vertex AI Imagen 4.0 non-generative upscale — tested and working
Vertex AI imagen-4.0-upscale-preview via dream-daimon GCP project.
Pure super-resolution with zero hallucination. 400x200 → 1600x800.

Tested on 4/5 images (X-Wing hit 5 req/min quota):
- Luke portrait: PERFECT — preserves 1998 painted CGI style
- Mon Cal Cruiser: PERFECT — faithful enlargement
- Nebulon-B: PERFECT — thin spar preserved
- Coruscant: PERFECT — cityscape detail preserved

Per-category upscaling strategy documented in assets.md:
- Capital ships/facilities → Gemini edit (invents coherent detail)
- Portraits/fighters/sprites → Vertex Imagen (no hallucination)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 10:29:36 -04:00
Tom di Mino
bf368d73ec feat: Gemini generative upscale tested + Vertex AI Imagen upscaler script
Gemini Method A (edit endpoint) tested on 5 images:
- Capital ships: HIGH fidelity (Mon Cal, Nebulon-B kept)
- Portraits: LOW (modernized to photorealistic, discarded)
- Fighters: LOW (hallucinated extra ships, discarded)
- Planets: MEDIUM (non-canonical detail, discarded)

New: scripts/vertex-upscale.py for non-generative Imagen 4.0 upscale
(Vertex AI, no hallucination). Pending gcloud auth refresh.

assets.md updated with both upscaling approaches, prompt refinement
notes for reducing hallucination, and per-category recommendations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 10:17:26 -04:00
Tom di Mino
a5d829dcb2 feat: v0.5.0 — Knesset Shapash: Full Parity (~90%)
4 scripted story event chains:
- Luke Dagobah Training (0x221→0x210): Force XP trigger, Yoda training
- Vader/Luke Final Battle (0x220): two-phase ready, mandatory mission
- Bounty Hunter Attack (0x212): Han capture, 15% random after tick 100
- Jabba's Palace (0x380-0x383): 4 gate events, Luke/Leia/Chewbacca rescue

Character abilities:
- Han Solo speed bonus: hyperdrive_modifier consulted by fleet_ticks_per_hop()
- Betrayal system: loyalty threshold via UPRIS1TB, is_unable_to_betray immunity
- Decoy system: FDECOYTB lookup during mission resolution
- Escape system: ESCAPETB stub with CharacterEscaped effect
- Mission state flags: on_mission/on_hidden_mission/on_mandatory_mission

World model:
- 10 new Character fields promoted from DAT (is_unable_to_betray, is_jedi_trainer,
  is_known_jedi, hyperdrive_modifier, enhanced_loyalty, mission flags, location)
- Character location tracking: current_system + current_fleet from fleet scan
- is_known_jedi → force_tier = Aware at load time

Event system:
- 6 new EventCondition variants (CharacterHasForceLevel, FactionControlsSystem, etc.)
- 6 new EventAction variants (SetMandatoryMission, ModifyForceTier, etc.)
- 15 Ghidra RE event ID constants (0x12c–0x370)

Integration:
- BetrayalSystem wired into main loop (after uprising, before Death Star)
- Story events registered at startup via define_story_events()
- StartJediTraining extracted from fired events with character-exists guard
- dispatch_guarded() blocks on_mission + on_mandatory_mission characters
- SaveState v3 with BetrayalState

Knesset Shapash: 4 daborot (Tanit, Nikkal, Anat, Pidray), 23 tasks.
2 parallel code reviewers found 4 bugs — all fixed before commit.
237 tests passing, 0 failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 23:17:50 -04:00
Tom di Mino
7ec24116ec fix: v0.4.1 — integration fixes + doc overhaul (211 tests passing)
Critical fixes from Codex GPT-5.4 review:
- Fleet arrivals now update System.fleets (remove from origin, add to dest)
- 6 new systems wired into main loop: blockade, uprising, Death Star,
  research, Jedi training, victory — all calling advance() each tick
- All 6 new states added to SaveState (save version bumped to 2)
- Mission effects now mutate world: FacilitySabotaged removes facility,
  CharacterKilled/Captured/Rescued update character arena + fleets
- Jedi XP persists via accumulated_xp in JediTrainingRecord
- Blockade halts manufacturing via advance_with_blockade()
- Uprising incident cooldown bug fixed (first incident always fires)

Documentation overhaul:
- simulation.md pruned from 346→132 lines (lean index)
- 7 per-system detail docs in agent_docs/systems/
- architecture.md updated with all 14 simulation modules
- game-domain.md: missions marked as implemented, effects table added
- 3 "how to add" guides: new system, new mission type, new event type

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 22:22:22 -04:00
Tom di Mino
3219678743 fix: image path resolution in reference viewer and comparison page
Both HTML files serve from scripts/ — relative paths need ../assets/
prefix to resolve correctly from the browser's perspective.

Also: removed boot delay in reference-viewer.html, added console log.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 21:48:56 -04:00
Tom di Mino
da568b614d feat: v0.4.0 — War Machine complete (~68%)
First playable combat version of Open Rebellion.

Knesset Tiamat delivered 23 tasks across 4 daborot:
- Karme: world model (15 fields), GnprtbParams, MstbTable, save/load
- Tehom: space combat 7-phase pipeline, ground combat, bombardment
- Al-Uzza: 9 mission types, research, Jedi training, AI espionage
- Manat: victory, Death Star, blockade, uprising, combat UI

4 parallel code reviews found and fixed 12 bugs before release.
188 tests passing. Clean cargo check.

Session totals (3 knessets + Ghidra RE):
- 50 tasks across 11 daborot
- 5,127 decompiled C functions from REBEXE.EXE
- 7 scholar documents (6,049 lines)
- v0.1.0 (15%) → v0.4.0 (68%) in one session

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v0.4.0
2026-03-15 17:52:48 -04:00
Tom di Mino
bb1b4d9f4b fix: 5 combat reviewer bugs — phase gate, fighter losses, draw loop
From Tehom's code review (4th parallel reviewer):

1. Phase 3 gate inverted: was ACTIVE && PHASES_ENABLED, now correctly
   ACTIVE && !PHASES_ENABLED. Fleet eval checks armed ships but does NOT
   set PHASES_ENABLED until after weapon fire completes. Matches C++
   ordering from FUN_00544030.
2. Alt-shield path: 0x71..=0x72 → exact 0x71 only (reviewer-corrected)
3. Bombardment comment: clarified that minimum-1 only applies when
   result after division is 0, not when raw_power is 0
4. Fighter losses now populated: capture initial fighter counts before
   combat phases, compute losses as initial - surviving, populate
   FighterLossEvent with squads_before/squads_after
5. Combat cooldown: 5-tick per-system cooldown prevents infinite
   re-trigger on draws. Uses HashMap<SystemKey, u64> in main loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 17:44:36 -04:00
Tom di Mino
e73b080fd6 fix: 7 reviewer-identified bugs in War Machine code
Critical fixes from 4 parallel code reviews:

1. Assassination/Abduction/Rescue targeted the mission agent instead of
   the victim — added target_character: Option<CharacterKey> to ActiveMission
2. Death Star ConstructionCompleted re-emitted every tick after completion —
   now self-clears under_construction in advance()
3. Victory screen dim layer invisible — Order::Background → Order::Foreground
4. UprisingIncident fired every tick in danger zone — added 10-tick cooldown
   via incident_cooldowns HashMap
5. MstbTable::lookup() silently truncated on negative interpolation —
   added .max(0.0) clamp before u32 cast
6. GnprtbParams struct doc described wrong 4-level difficulty mapping —
   corrected to 8-level (0=dev through 7=multiplayer)

Also fixed: UprisingState::new() missing incident_cooldowns field init.

Cargo check passes clean. All pre-existing tests unaffected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 17:30:07 -04:00
Tom di Mino
36e3c5c683 docs: update README.md and CLAUDE.md with current project state
README.md:
- Phase badge: Galaxy Viewer → War Machine
- Current State section: rewritten to reflect 3 complete phases + RE
- Architecture: updated to mention Ghidra RE of REBEXE.EXE
- Contributing: removed stale STRATEGY.DLL/GNPRTB references
- Added CREDITS.md reference for asset pipeline tools

CLAUDE.md:
- Fixed function count: ~4,900 → 5,127
- Fixed pipeline count: 4 → 5 (added Audio)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 17:11:11 -04:00
Tom di Mino
988f02aaa9 docs: add Pipeline 5 (Audio Generation) to assets.md
Voice cloning (Voicebox/Qwen3-TTS), audio upscaling (LavaSR v2),
music generation (ACE-Step 1.5), and SFX (ElevenLabs + AudioLDM2).
All tools installed and verified on M4 Max.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 17:08:01 -04:00
Tom di Mino
1500f5c916 docs: add CREDITS.md acknowledging all tools and services
Credits AI image generation (Gemini, waifu2x, PBRify, Upscayl),
3D model generation (Hunyuan3D, WaveSpeedAI, Meshy, Trellis 2),
audio tools (Qwen3-TTS, Voicebox, LavaSR, ElevenLabs, ACE-Step),
game engine deps, RE tools, and community references.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 16:55:55 -04:00
Tom di Mino
9008ec4c69 plan: War Machine v0.4.0 — updated with RE findings + scholar guidance
Complete rewrite of the War Machine implementation plan incorporating
all Ghidra RE results and 7 scholar documents:

- Phase A (Ghidra RE) marked COMPLETE with results summary
- Phase B restructured with 24 tasks across 4 daborot
- Karme starts first (world model expansion blocks combat)
- Every task references specific scholar docs and function addresses
- Accuracy notes from reviewer corrections included
- File ownership matrix prevents merge conflicts
- 111 GNPRTB parameters (corrected from 97)
- Key references table for each daborit (10 docs, 6,049 lines)
- Prerequisite: 15 new CapitalShipClass fields, ShipInstance,
  GnprtbParams, MstbTable types

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 14:08:03 -04:00
Tom di Mino
1370ef6ce9 fix: correct GNPRTB count 97→111 and remaining reviewer errors
Reviewer 3 identified that GNPRTB parameter counts were wrong:
- General: 28 base + 6 per-side = 34 (was 26)
- Combat: 25 base + 52 per-side = 77 (was 71)
- Total: 111 (was 97)

Verified by counting FUN_0053e390/FUN_0053e3e0 calls in source C files.
Fixed across all 8 affected documentation files.

Also fixed the previous 7 reviewer errors:
- annotated-functions.md: family 0x71 exact match, troops not characters
- cpp-class-hierarchy.md: weapon phase inner gate mask 0x04/bit2
- rust-implementation-guide.md: gate comments + XOR write pattern note
- entity-system.md: Autoscrap code 0x15 not 0
- mission-event-cookbook.md: Rescue ranges corrected

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:43:00 -04:00
Tom di Mino
aa17caf28d chore: reduce auto-loaded agent_docs to architecture + roadmap only
Keep @ prefix (auto-load) for architecture.md and roadmap.md — needed
on every session. Remove @ from simulation, dat-formats, game-domain,
modding, ghidra-re, assets — loaded on demand when relevant.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:35:41 -04:00
Tom di Mino
ff226bf0e2 feat: ASSET ARCHAEOLOGY STATION viewer + Pipeline 4 docs
Kotharat-designed PHOSPHOR VIGIL CRT comparison viewer (1,417 lines)
for all 11 reference collections. Draggable slider, pixel grid overlay,
keyboard nav, thumbnail strip, prompt template display.

Serve: python3 -m http.server 8080
Open: http://localhost:8080/scripts/reference-viewer.html

Also: assets.md updated with Pipeline 4 (reference image generation),
CLAUDE.md updated with full pipeline summary.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:34:43 -04:00
Tom di Mino
a7012eaca0 fix: correct 7 errors found by accuracy reviewers
Fixes identified by three cross-referencing reviewer agents:

1. annotated-functions.md: Shield alt-path family is exactly 0x71,
   not range 0x71-0x72 (C checks `== 0x71`, not range)
2. annotated-functions.md: Ground combat validates troops (0x14-0x1b),
   not characters (0x08-0x0f) — comment corrected
3. annotated-functions.md: Death Star alive_flag prose clarified —
   bit0 semantics may differ between entity types
4. cpp-class-hierarchy.md: Weapon fire phase gate is inner mask 0x04/bit2
   (via FUN_0053a640), not bit0 — bit0 is the outer wrapper gate
5. rust-implementation-guide.md: CombatPhaseFlags comments clarified
   to distinguish outer wrapper gate (ACTIVE) from inner vtable mask
   (WEAPON_TYPE = 0x04)
6. rust-implementation-guide.md: Added XOR-mask write pattern note for
   shield_weapon_packed field (C uses `(new ^ old) & 0xf ^ old`)
7. entity-system.md: Autoscrap mission type code is 0x15 (21), not 0
8. mission-event-cookbook.md: Rescue case 7 ranges corrected —
   third range is 0x01-0xff, not 0x10-0x20

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:30:29 -04:00
Tom di Mino
f43084bf10 feat: nano-banana-pro reference image pipeline for asset generation
11 reference collections (91 images, originals + 4x upscaled) curated
from MetasharpNet editor. Generation script with Pro/Flash comparison,
batch manifest support, and category-specific prompt templates.

Collections: capital-ships (5), fighters (4), characters (7), planets (9),
troops (8), special-forces (6), facilities (9), missions (8),
damage-diagrams (14), squadron-sprites (14), battle-backgrounds (7).

Tested: "sci-fi space battleship" with 5 capital ship refs → 1440x720 PNG
matching 1998 CGI aesthetic. Prompt templates use "sci-fi space" phrasing
to avoid Gemini safety filter on "Star Wars" + weapon terms.

New scripts:
- curate-references.py — extract + upscale BMPs from MetasharpNet editor
- generate-rebellion-assets.py — Gemini generation with reference images

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:27:38 -04:00
Tom di Mino
f6b3ffb844 docs: accuracy reviews — 90% verified across 7 scholar documents
Three accuracy reviewers cross-referenced scholar claims against
5,127 decompiled C source files. ~120 spot-checks total.

Results:
- annotated-functions.md: ~90%+ (offsets byte-perfect, minor family range issue)
- combat docs (3 files): 90% (19/21) — all vtable offsets and event IDs correct.
  2 errors: phase gate mask conflation (bit2 not bit0), XOR write pattern undoc'd
- new docs (3 files): 92% (14/15) — 1 factual error (Autoscrap code mismatch)

Core data (field offsets, event IDs, vtable slots, GNPRTB params) is
byte-perfect across all documents. Errors are architectural description
issues, not implementation-blocking.

Review files:
- review-annotated-functions.md
- review-combat-docs.md
- review-new-docs.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:24:17 -04:00
Tom di Mino
ac984f76a3 docs: 7 scholar documents complete (6,049 lines) — entity, mission, economy
Three new scholar documents from Wave 2:
- entity-system.md (668 lines): 8 enhanced skills, Force/Jedi 6-tier
  system, betrayal mechanics, 5 destruction variants, 4 fleet events,
  faction bits at +0x24. Event IDs 0x302-0x306, 0x180-0x183.
- mission-event-cookbook.md (724 lines): FUN_0050d5a0 13-case mission
  dispatch decoded, 4 story chains (Dagobah, Vader, Palace, Bounty),
  event ID registry 0x12c-0x370, Thrawn Campaign modding example.
- economy-systems.md (478 lines): Resources at +0x5c-0x68, 5 ControlKind
  states, uprising tables, blockade manufacturing halt, repair GNPRTB
  params 0x305/0x386, 36 system notification handlers.

Total scholar corpus: 7 documents, 6,049 lines.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:14:26 -04:00
Tom di Mino
ad2b785d51 docs: full audit — README, CHANGELOG, architecture all updated for RE completion
Documentation audit via claude-md-manager skill. Fixed all stale content:

- README.md: Milestone table updated (Living Galaxy + War Room → Complete,
  War Machine → Next). STRATEGY.DLL reference corrected to REBEXE.EXE.
  TEXTSTRA.DLL marked as parsed. Mod system tense changed to present.
- CHANGELOG.md: Added [Unreleased] Ghidra RE entry — 5,127 functions,
  7 scholar docs, 97 GNPRTB params, bombardment formula, class hierarchy.
  Version history table updated with v0.3.0+RE row.
- architecture.md: Replaced deleted draw_info_panel with current rendering
  pipeline (CameraView, fog overlay, fleet overlays, composable egui).
  Added MovementSystem and FogSystem to simulation loop.
- game-domain.md: Function count 109 → 5,127
- roadmap.md: Function count 109 → 5,127, added scholar doc reference

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:09:01 -04:00
Tom di Mino
7cda16d4db fix: address reviewer findings across asset pipeline scripts and docs
Critical fixes:
- prepare-rebellion-models.sh: remove broken trap/trap-EXIT loop pattern
  (orphaned temp dirs on failure); replace with simple rm -rf cleanup
- prepare-rebellion-models.sh: remove --method edgebreaker (not a valid
  gltf-transform CLI flag; edgebreaker is the internal default)

Important fixes:
- upscale-assets.py: fix dead waifu2x existence check — explicit method
  selection now correctly exits when binary missing with --method waifu2x
- render-sprite-sheets.py: add Eevee engine fallback warning when neither
  BLENDER_EEVEE nor BLENDER_EEVEE_NEXT can be set
- .gitignore: add scripts/models-optimized/ (--preview output dir)
- roadmap.md: fix "4x SGI" → "PBRify_UpscalerV4" to match assets.md
- assets.md: annotate future artifacts as [not yet ported/created],
  fix edgebreaker reference in pipeline diagram

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:08:05 -04:00
Tom di Mino
cb9d818ac4 feat: add Blender sprite sheet renderer for tactical combat sprites
Renders GLBs to 8-direction orthographic PNG sprites with transparent
backgrounds. Tested end-to-end: WaveSpeedAI Star Destroyer GLB →
Blender 5.0.1 → 256x256 RGBA sprites in ~10s.

Usage: blender --background --python scripts/render-sprite-sheets.py
Supports: --model, --resolution, --angles, --elevation, --input, --output
Eevee engine for speed, compatible with Blender 4.x and 5.x.

Also installed: BlenderSpriteGenerator addon (~/tools/blender-addons/)
and Blender 5.0.1 via Homebrew. Spritehandler 2 skipped (no ARM support).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:56:38 -04:00
Tom di Mino
b9e45d968a docs: final decompilation batch — 5,127 total functions from REBEXE.EXE
Every function >100 bytes in the game is now decompiled.

Coverage: 5,127 / 22,741 functions (22.5% by count, ~95% by code volume)
The remaining ~17,600 functions are <100 bytes — CRT stubs, thunks,
single-line wrappers, and compiler-generated code.

Total RE corpus: 5,127 C files + 4 scholar docs (4,179 lines) +
7 reference docs + 8 Jython scripts = 11MB

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:55:08 -04:00
Tom di Mino
0e03437680 docs: comprehensive modular doc update — all files reflect RE completion
Every project documentation file updated to reflect the exhaustive
Ghidra RE of REBEXE.EXE (~4,900 decompiled functions):

- CLAUDE.md: v0.3.0 status, War Machine UNBLOCKED, RE COMPLETE
- agent_docs/ghidra-re.md: Full rewrite — RE status table, GNPRTB
  params, game object layout, entity family bytes, C++ class hierarchy,
  scholar documents, 8 Jython scripts documented
- agent_docs/roadmap.md: War Machine "UNBLOCKED", immediate next steps
  = Knesset Tiamat launch, tech debt updated with combat prerequisites
- agent_docs/game-domain.md: Combat marked "RE COMPLETE" with pointers
- ghidra/INDEX.md: Updated structure, scholar docs, key discoveries
- ghidra/notes/INDEX.md: Full inventory by game system, GNPRTB functions,
  validation functions with field offsets and ranges

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:53:47 -04:00
Tom di Mino
64838b53f3 feat: add Trellis 2 provider via 3D AI Studio API
Microsoft Trellis 2 — image-to-3D with decimation_target for polygon
control (set 5000 for low-poly game assets). API confirmed working,
needs credits to test generation.

Endpoint: POST https://api.3daistudio.com/v1/3d-models/trellis2/generate/
Auth: Bearer THREEDAI_API_KEY
Cost: 15 credits/generation
Usage: uv run scripts/generate-rebellion-models.py --provider trellis --image-url URL

Now 4 providers: Hunyuan (fal.ai), WaveSpeedAI, Meshy, Trellis 2.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:48:27 -04:00
Tom di Mino
aa2b333e72 docs: exhaustive decompilation — 3,648 functions from REBEXE.EXE
Complete decompilation of every function >100 bytes in REBEXE.EXE,
covering all game systems for implementation and total conversion modding.

## Coverage
- 3,648 decompiled C files (from 4,938 cataloged functions with size>100)
- Every notification handler, validation function, and game logic function
- All functions >200 bytes fully decompiled
- 100-200 byte functions in progress (1,534 remaining)

## New Scholar Documents
- modders-taxonomy.md (805 lines): Categorizes all functions into 10 game
  systems (Unit Stats, Combat, GNPRTB, Missions, Force/Jedi, Victory,
  Fleet, Economy, Events, UI) for total conversion modders targeting
  Yuuzhan Vong, Thrawn Trilogy, or KOTOR era conversions

## Decompiled Systems
- Combat: space (7-phase), ground (troop iteration), bombardment (Euclidean)
- Economy: SystemEnergy, SystemRawMaterial, allocation validators
- Missions: all 9 types, team/decoy/target/leader lifecycle
- Characters: 8 enhanced skills, Force/Jedi progression, loyalty
- Factions: Alliance/Empire/Neutral handling
- Systems: 30+ notification handlers (battle, blockade, uprising, control)
- Scripted events: Luke/Vader saga, Dagobah, Palace, Bounty Hunters
- UI: slider, drag list, strobe button, encyclopedia, settings
- Networking: multiplayer config, latency, DirectPlay
- Infrastructure: DLL loading, MDATA, movie window, CD check

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:44:57 -04:00
Tom di Mino
be11b37245 feat: add WaveSpeedAI provider for 3D model generation ($0.0225/model)
WaveSpeedAI Hunyuan3D v3.1 Rapid — 16x cheaper than fal.ai Pro.
Tested: Star Destroyer generated in ~25s, 872KB GLB.

API: POST https://api.wavespeed.ai/api/v3/wavespeed-ai/hunyuan-3d-v3.1/text-to-3d-rapid
Auth: Bearer token, WAVESPEED_API_KEY in secrets.env
Usage: uv run scripts/generate-rebellion-models.py --provider wavespeed

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:36:45 -04:00
Tom di Mino
0e31a40f34 docs: 415 decompiled functions + Rust impl guide + C++ class hierarchy
Exhaustive decompilation of REBEXE.EXE game systems:

## Decompilation Coverage: 415 C files
- ALL notification handlers (FleetBattle, SystemBattle, ControlKind, etc.)
- ALL validation functions ("Invalid X value!" → game rules/ranges)
- Economy system (SystemEnergy, SystemRawMaterial, allocation)
- Faction system (Alliance/Empire/Neutral faction handler)
- Encyclopedia loader (encytext.dll, encybmap.dll)
- Settings/registry (MusicVolume, registry keys)
- MDATA loader, DLL resource loading, movie window
- Network/multiplayer config (latency, drop%, dupe%)
- UI subsystems (slider, drag list, strobe button)
- 5 mega-functions (6K-11K bytes): galaxy map GDI, game logic, etc.
- Mission lifecycle (team, decoy, origin, objective, target, leader)
- Character skills (enhanced diplomacy/espionage/combat/loyalty)
- Force system (aware, potential, discovered, training)
- Scripted events (Luke/Vader, Palace, Bounty Hunters, Dagobah)
- System control (battle won/withdrew/ready/pending, loyalty, blockade)

## Scholar Agent Documents
- rust-implementation-guide.md (1,267 lines): Maps decompiled C to
  Open Rebellion's advance() pattern for Knesset Tiamat implementation
- cpp-class-hierarchy.md (445 lines): Vtable map, inheritance chain,
  reconstructed C++ class hierarchy with all known field offsets

## Modder's Taxonomy (in progress)
Categorizing all functions by game system for total conversion mods
(Yuuzhan Vong, Thrawn Trilogy, KOTOR era).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:14:37 -04:00
Tom di Mino
5126827b1e docs: comprehensive update — War Machine UNBLOCKED, GNPRTB combat params mapped
## Documentation Consolidation

All project docs updated to reflect RE completion:
- roadmap.md: War Machine changed from "BLOCKED" to "UNBLOCKED"
- game-domain.md: Combat marked "RE COMPLETE" with pointers to ghidra/notes/
- ghidra-re.md: Updated with 109+ function count and annotated reference
- ghidra/notes/INDEX.md: Full inventory (115 C files, 8 scripts, 7 docs)

## New RE Findings

### Combat GNPRTB Parameter Registry (FUN_0055cb60)
Second Rosetta Stone: 71 combat-specific GNPRTB entries mapped:
- 0x1400-0x1417: 25 base combat parameters
- 0x1420-0x1445: 46 per-side (Alliance/Empire) combat variants
- DAT_006bb6e8 = parameter 0x1400 (bombardment base divisor)

### GNPRTB Cross-References (DumpGNPRTBXrefs.py)
Traced all 26 general + 71 combat GNPRTB parameters to the
functions that read them. Character skill modifiers use params
0xa01-0xa04 via FUN_004ef750/FUN_004ef100.

### Annotated Function Reference (1,662 lines)
Scholar agent produced comprehensive annotations:
- Entity base object struct layout (vtable, combat flags, hull,
  shield/weapon packed nibbles, loyalty, regiment strength)
- Renamed variables across all combat functions
- Cross-referenced game rules and validation ranges

## Files
- 115 decompiled C files (6 new GNPRTB-related)
- annotated-functions.md (1,662 lines from scholar agent)
- DumpGNPRTBXrefs.py (GNPRTB parameter tracer script)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:04:37 -04:00
Tom di Mino
591f4a6872 docs: update assets.md with installed tool locations
waifu2x-ncnn-vulkan installed at ~/tools/waifu2x/ (20250915 release,
universal binary, tested on M4 Max). PBRify_UpscalerV4 and UltraSharpV2
.pth models downloaded to ~/tools/upscale-models/ (134MB each, Kim2091).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 12:04:07 -04:00