266 Commits

Author SHA1 Message Date
Tom di Mino
99e6ca228f docs: GNPRTB Rosetta Stone + 109 decompiled functions + game object layout
Major RE discoveries:

## GNPRTB Parameter Binding (FUN_0053e450)
Mapped 26 GNPRTB parameter IDs (0xa00-0xa21) to their global data addresses.
FUN_0053e390(param_id, &global) binds parameters; FUN_0053e3e0 adds per-side
(Alliance/Empire) variants. This is the key to decoding all 213 parameters.

## Game Object Layout (Capital Ships)
- +0x58: Combat flags bitfield (active, phase enables)
- +0x60: Hull value (int, validated by FUN_00501490)
- +0x64 bits 0-3: Shield recharge rate (4-bit nibble)
- +0x64 bits 4-7: Weapon recharge rate (4-bit nibble)
- +0x78 bit 7: Special entity flag
- +0x96: Regiment strength (short, ground troops)
- +0xac bit 0: Alive/combat-ready flag

## DAT Type Registry (FUN_00569280)
Maps info strings to parser functions:
- "GeneralParamTableEntry" → FUN_00585640 (GNPRTB)
- "IntTableEntry" → FUN_0058fb90 (mission tables)
- "SideParamTableEntry" → FUN_005858c0 (SDPRTB)
- "SeedFamilyTableEntry" → FUN_0058f460
- "SeedTableEntry" → FUN_0058f1a0

GNPRTB runtime struct: 68 bytes (vtable + 8 x i32 difficulty values at offset 36)

## New Functions Decompiled (109 total)
- FUN_00422ce0 (11,446B): Strategy map GDI rendering
- FUN_004927c0 (9,163B): Major game logic with entity type processing
- FUN_00597610 (9,220B): Ship database initializer (all ship names)
- Hull/shield/weapon validation functions with error string cross-refs
- Force/Jedi system: FUN_004f1e00, FUN_004f1ea0, FUN_0058a3f0
- Character skill setters: Enhanced Diplomacy/Espionage/Combat/Loyalty
- Difficulty modifier: FUN_004fd600 (side 1=Alliance, side 2=Empire)
- Scripted events: Luke Dagobah, Bounty Hunters, Palace sequence
- DumpAllGameFunctions.py: exhaustive 4,938-function catalog with strings

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 11:47:15 -04:00
Tom di Mino
298878d7b5 feat: HD asset pipeline + 3D tactical model generation infrastructure
Add three-pipeline asset system for upscaling original 1998 BMPs and
generating 3D models for tactical combat. Encyclopedia viewer now loads
HD PNGs with fallback to original BMPs.

Pipelines:
- HD upscaling: waifu2x-ncnn-vulkan + PBRify_UpscalerV4 (2000s game textures)
- 3D models: Hunyuan3D Pro (fal.ai) + WaveSpeedAI Rapid + Meshy + Trellis 2
- Sprite sheets: Blender batch render with Spritehandler 2 addon (deferred)

New files:
- agent_docs/assets.md — pipeline reference with tool choices and WWW lessons
- scripts/upscale-assets.py — batch BMP→PNG with manifest caching
- scripts/generate-rebellion-models.py — dual-provider 3D generation (36 models)
- scripts/prepare-rebellion-models.sh — GLB simplify + DRACO compression

Code changes:
- rebellion-render: PNG support, EncyclopediaState.hd_path, HD fallback loader
- Corrected STRATEGY.DLL→REBEXE.EXE across ghidra-re.md, game-domain.md, roadmap

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 11:44:17 -04:00
Tom di Mino
3145afaec9 docs: exhaustive combat RE — 40+ decompiled functions, modular docs
Complete reverse engineering of REBEXE.EXE combat systems with modular
documentation structure.

## Combat Call Chain (fully traced)

System Battle Orchestrator (FUN_00514a60) dispatches to:
- Space combat: 7-phase pipeline (weapon→shield→hull→fighter→result)
- Ground combat: troop iteration with per-unit resolution
- Bombardment: Euclidean distance formula / GNPRTB divisor
- Fleet combat: object-level engagement

## Space Combat Architecture

Each phase follows: stat getter → per-side resolver → vtable dispatch:
- Weapon fire: type 0x04, vtable +0x1c4, final vtable +0x1f4
- Shield absorb: type 0x20, vtable +0x1c8
- Hull damage: type 0x80, vtable +0x1d0
- Fighter engage: type 0x100, vtable +0x1d4
- Difficulty modifier extracted from offset +0x24 bits 4-5

## Confirmed Formulas

Bombardment: damage = sqrt((atk[0]-def[0])² + (atk[1]-def[1])²) / GNPRTB
Ground: iterate troops at +0x96 (strength), per-unit vtable +0x330
Space: 7-phase pipeline with per-side resolution and observer dispatch

## Documentation Structure

ghidra/notes/:
- INDEX.md — complete file inventory
- combat-formulas.md — master reference (updated)
- COMBAT-SUMMARY.md — call chain + implementation notes
- space-combat.md — 7-phase pipeline docs
- ground-combat.md — troop resolution docs
- bombardment.md — Euclidean distance formula docs
- 40+ FUN_*.c files — decompiled C pseudocode

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 11:30:39 -04:00
Tom di Mino
ea0a9e92dd docs: Ghidra RE of REBEXE.EXE — 22,741 functions, combat function map
Key discovery: STRATEGY.DLL is resource-only (9KB code, 29MB sprites).
ALL game logic lives in REBEXE.EXE (2.8MB, 22,741 functions after
auto-analysis + FindAllFunctions.py prologue scan).

RE findings:
- 205 combat-related strings extracted (weapon types, damage notifs,
  battle states, mission outcomes, Jedi/Force system, scripted events)
- 20+ functions mapped via string xref tracing:
  Hull/shield/weapon damage setters at 0x502000-0x503900
  Fleet battle/blockade/bombardment triggers at 0x4ff7a0-0x4ff840
  System control (battle won, uprising) at 0x511000-0x513000
  Battle state machine at FUN_0040a700 (18-state switch)
  Tactical combat constructor at FUN_005a7500 (572 lines)
- Observer/notification architecture — virtual dispatch, no direct callers
- Mission type codes: 6=Sabotage, 7=Assassination, 0x15=Autoscrap
- Battle paths: CONVERT_TO_TACT (tactical 2D) vs CONVERT_TO_TACT_ABSTRACT (auto-resolve)

Ghidra scripts:
- FindAllFunctions.py — x86 prologue scanner
- DumpStrings.py — keyword string search to file
- DumpCombatXrefs.py — string→function xref tracer
- DumpCallers.py — direct caller finder (revealed virtual dispatch)
- DumpCombatRegion.py — full function listing in combat area
- FindCombatMath.py — combat math pattern search

Infrastructure:
- GhidraMCP plugin: LaurieWired v11.3.2 (caps /methods at 99)
- bethington v4.3.0 downloaded but needs Ghidra 12.0.3
- pyghidra-mcp config fixed (--project-path, --force-analysis)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 10:40:45 -04:00
Tom di Mino
b3fb12398d feat: v0.3.0 — War Room polish, WASM build, changelog (~42% complete)
Close the War Room milestone with Knesset Qedeshot (3 Sonnet daborot:
Sassuratu, Phikola, Hokhmah).

## WASM Compatibility
- Add #[cfg(not(target_arch = "wasm32"))] guards across 5 files:
  main.rs (args, exit), mods.rs (notify, fs), lib.rs (fs::read),
  encyclopedia.rs (BMP loader), textstra.rs (pelite PE parser)
- WASM stubs: hardcoded data path, panic instead of exit, no-op
  ModWatcher, bail on data loading, None for textures
- WASM build verified: 3.4MB artifact at web/open-rebellion.wasm

## Fixes
- events.rs doctest marked `ignore` (GameWorld has no Default impl)
- 91 unit tests + 3 doctests passing, 2 ignored

## Documentation
- War Room marked COMPLETE in roadmap.md
- CHANGELOG.md created (BG3SE-style: version, date, completion %,
  category, milestone, Added/Changed/Technical sections)
- Completion assessment: 42% overall (Data 75%, Simulation 30%,
  UI 50%, Infrastructure 45%, Game Completeness 15%)
- Swarm report and plan file updated to reflect final status

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v0.3.0
2026-03-14 08:59:05 -04:00
Tom di Mino
6d47a10440 feat: Living Galaxy + War Room — full simulation and UI integration
Ship the Living Galaxy milestone (complete) and War Room milestone (near-complete)
from a single Knesset Athirat swarm session — 4 Sonnet daborot (Deborah, Kaptaru,
Mami, Melissa) plus Opus lead, ~45 minutes total execution.

## Simulation Systems (rebellion-core, ~4.2K LOC, 90+ tests)

All follow the stateless advance() pattern — pure functions that never mutate
GameWorld, return result events for the caller to apply, and accept caller-provided
RNG for determinism:

- tick.rs: GameClock with Paused/Normal/Fast/Faster speeds
- manufacturing.rs: Per-system production queues with overflow propagation
- missions.rs: Diplomacy + recruitment with quadratic probability (from rebellion2)
- events.rs: Conditional triggers (TickReached, CharacterAtSystem, Random, EventFired)
- ai.rs: Rule-based opponent — officer assignment, production priority, fleet deployment
- movement.rs: Fleet hyperspace transit with slowest-ship speed model
- fog.rs: Per-faction monotonic visibility with advance intel at 50% transit

## Data Layer (rebellion-data, ~1.2K LOC)

- seeds.rs: 9 seed table loaders for starting unit/facility deployment
- mods.rs: Mod loader — TOML manifests, RFC 7396 merge patch, semver dependency
  resolution via Kahn's topological sort, hot reload via notify (native only)

## DAT Parsers (dat-dumper, 29 new files)

- All 51/51 DAT files now parsed with round-trip byte validation
- New parsers: missions, fleets_seed, entity_table, all_facilities, int_table,
  syfc_table, textstra (TEXTSTRA.DLL PE string extraction via pelite)

## Render Layer (rebellion-render, ~3.3K LOC)

- message_log.rs: Scrollable egui feed with 6 color-coded categories
- fleet_movement.rs: Diamond fleet icons, dashed route lines, ETA labels
- fog.rs: Two-tier dim overlay (explored-not-visible vs never-seen)
- encyclopedia.rs: 4-tab browser with lazy BMP texture cache from EData/
- audio.rs: AudioVolumeState + SfxKind + MusicTrack (egui UI layer)
- panels/: Faction select, officers, fleets, manufacturing, missions (5 panels)

## Audio Engine (rebellion-app/src/audio.rs)

- quad-snd backend (shares miniquad subsystem — avoids kira/alsa link conflict)
- CoreAudio (macOS), ALSA (Linux), WebAudio (WASM)
- Looped music + one-shot SFX, graceful no-op on missing files

## Main Loop Integration (rebellion-app/src/main.rs)

- Refactored draw_info_panel into composable egui functions, eliminating all
  unsafe pointer casts — egui_macroquad::ui() now lives in main.rs where it
  owns all mutable state directly
- CameraView struct returned by draw_galaxy_map for fog/fleet overlay alignment
- Full rendering pipeline: galaxy map → fog overlay → fleet overlays → egui pass
- Panel action handler routes UI events to simulation state
- Keyboard shortcuts: O/F/M/N/E (panels), Space/1/2/3 (speed), R (reset camera)
- SFX hooks on manufacturing/missions/fleet events
- All audio guarded by #[cfg(not(target_arch = "wasm32"))]

## Agent Docs (3 new, 3 updated)

- simulation.md: 7 systems, advance() contract, state ownership, integration order
- modding.md: Manifest format, RFC 7396 semantics, load order, hot reload
- ghidra-re.md: STRATEGY.DLL RE setup, MCP bridge, combat formula targets
- Updated: architecture.md, game-domain.md, roadmap.md

## Remaining

- Wire fog/fleet/panel draw calls need play-testing for visual polish
- ENCYBMAP.DLL lookup for system encyclopedia images (placeholder for now)
- Ghidra RE of STRATEGY.DLL combat formulas (blocks War Machine milestone)
- WASM build verification

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 18:11:29 -04:00
Tom di Mino
ed93094ebf Move menu screenshot below divider, above opening paragraphs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 09:19:18 -04:00
Tom di Mino
ae92ec01b1 Credit Claudius, Artifex Maximus in README footer
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 17:34:13 -04:00
Tom di Mino
9b62cd65cb Add Rebellion main menu screenshot and restore Metasharp credit
- Add menu screenshot from @oldyzach's tweet at top of README
- Hyperlinked caption crediting source
- Restore Metasharp's editor credit in Architecture section

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 17:33:52 -04:00
Tom di Mino
eefc47de34 Revise README: attached em dashes, authentic community references, reduce redundancy
- Fix all em dashes to attached style (no spaces)
- TheForce.Net: Vergere/Sith debate and Jacen's lesson in Traitor
- RPG forums: play-by-post on private InvisionFree boards
- Jedi Academy: sabers down on honor servers
- Remove redundant "you supply your own copy" and Metasharp from Architecture
  (credited in Community Roots)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 17:31:10 -04:00
Tom di Mino
0b0a4c2e02 Add MIT license
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 17:12:52 -04:00
Tom di Mino
85f612abfa Add README, CLAUDE.md, and agent docs for Open Rebellion
- README.md: community-facing intro addressed to the Star Wars modding
  community — TheForce.Net, SWG, JKA, swrebellion.net veterans
- CLAUDE.md: project instructions for Claude Code sessions
- agent_docs/: architecture, DAT formats, game domain, roadmap
- assets/tanit.svg: Minoan Mystery LLC project mark

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 17:12:39 -04:00
Tom di Mino
22b61a6157 Fix 4 issues from quality review
- Hover hit-test now picks nearest system instead of first slotmap hit
- Extract convert_character() to deduplicate major/minor character loading
- SectorGroup mapping errors on unknown values instead of silent fallback
- dat-dumper summary denominator uses total file count, not success+failed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 14:42:27 -04:00
Tom di Mino
fc968ec94e Implement galaxy map renderer, data loader, and WASM build (Phase 0 Steps 4–7)
- rebellion-data: load_game_data() converts DAT binary structs → GameWorld with
  slotmap arenas and cross-referenced sector/system keys
- rebellion-render: interactive galaxy map with pan/zoom/click-to-select,
  faction-colored system dots, egui side panel with system info
- rebellion-app: macroquad main loop with CLI GData path, ESC quit, R reset
- web/: WASM deployment shell (index.html + gl.js loader)
- scripts/build-wasm.sh: automated WASM build + artifact staging
- dat-dumper: added [lib] section so rebellion-data can import its types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 14:32:18 -04:00
Tom di Mino
59054975b3 Implement dat-dumper (22/22 DAT files) and rebellion-core types
dat-dumper: Complete binary parser for all 22 documented .DAT files
with round-trip validation (parse → serialize → byte-compare).
Three structural patterns:
- Pattern 1: 11 entity tables (CAPSHPSD, FIGHTSD, TROOPSD, SPECFCSD,
  MJCHARSD, MNCHARSD, SYSTEMSD, SECTORSD, DEFFACSD, MANFACSD, PROFACSD)
- Pattern 2: 2 parameter tables (GNPRTB, SDPRTB)
- Pattern 3: 9 seed tables (CMUN*, FACL*) via generic SeedTableFile

rebellion-core: Two-layer architecture:
- dat/ — binary-mirror enums (Faction, GalaxySize, SectorGroup, etc.)
- world/ — runtime simulation types with slotmap keys (GameWorld,
  System, Sector, Fleet, Character, SkillPair, ship/facility classes)
- ids.rs — DatId newtype + 11 slotmap key types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 12:54:13 -04:00
Tom di Mino
4e258bb724 Scaffold Cargo workspace for Open Rebellion
Five-crate workspace: rebellion-core, rebellion-data, rebellion-render,
rebellion-app, and dat-dumper tool. ByteReader/ByteWriter codec,
DatRecord trait, round-trip validation. Directory structure for
game data, Ghidra notes, assets, and mods.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 00:17:54 -04:00