-
Notifications
You must be signed in to change notification settings - Fork 0
Game Remake
Navigation: Home - Title screen & UI - Game Remake
Faithful C++ reimplementation of Might & Magic II (Amiga), driven by the
68k disassembly and decoded .dat / asset formats in EXTRACTED/.
-
100% ASM/Amiga fidelity — match original 68k behaviour exactly; no invented
UX. See Game remake (
game/) inCLAUDE.md. -
AGA port (planned) — 6 bitplanes, extension palette, multi-monster combat art,
future UI, and additive dungeons/content:
EXTRACTED/docs/41-aga-port-plan.md.
| Platform | Backend | C/C++ runtime |
|---|---|---|
| Windows, Linux, macOS | SDL2 | Host libc + libstdc++ |
| Amiga (68000+) | ACE (AmigaPorts/ACE) |
mini-std + custom new/delete/operator[] — no libstdc++ |
Desktop builds use SDL2 directly (not ACE’s experimental SDL shim). Amiga builds
link ACE for blitter/copper/input/audio and route all dynamic allocation through
mm2::runtime (memAlloc / memFree).
game/
CMakeLists.txt
include/mm2/ Shared headers (platform-neutral game API)
src/
main.cpp Entry (desktop) or thin wrapper (Amiga + ACE generic main)
Game.cpp High-level setup / tick / draw
TitleScreen.cpp Title attract/menu (320×200), logo, peekers
ui/ Character UI backends (AmigaClassic / Stub)
gfx/ 320×200 compositor + Mm2Font8x8.inc
platform/sdl/ SDL2 window, input, file I/O
platform/amiga/ ACE viewport, chip/fast mem, OS file hooks
runtime/ Allocators, freestanding buffers
EXTRACTED/decomp/ Pure-C codecs lifted from RE (shared with editor tools)
flowchart TB
subgraph host [Host layer]
SDL[SDL2 PC/Linux]
ACE[ACE Amiga]
end
subgraph plat [mm2::platform]
IO[File I/O]
IN[Input]
VID[Present / blit]
CLK[Timer]
end
subgraph core [Game core — portable C++]
GS[GameState A4 workspace]
MAP[map.dat + 3D view]
EVT[event VM 0x172CA]
CBT[combat 0x12A22]
SVC[town services]
end
subgraph data [Data layer — C codecs]
DAT[.dat loaders]
GFX[.32 / .anm codecs]
STR[str.dat]
end
SDL --> plat
ACE --> plat
plat --> core
core --> data
-
Bootstrap (done) — 320×200 compositor (
ScreenCompositor), title screen (intro.32@ (3,0) +introclips.32pegasus/peekers +nwcp.32logo +book.32menu on black), roster viewer (roster.dat), 2× SDL present. Menu text usesMm2Font8x8.inc(plain ASCII). Title animation spec:EXTRACTED/docs/39-title-screen-animation.md. Character UI is pluggable — see39-character-ui-view-create.md. -
Data + state (in progress) — wire all
.datcodecs; materializeA4workspace (mm2_gamestate.h). Done:map.datcodec (mm2_map_codec.{h,c}+tools/mm2_map_codec.py),world/MapWorld(map+attrib, neighbor pages, screen-enter per0x256E/0x923E),GameStateView(include/mm2/GameState.h: screen/x/y/facing- per-era calendar
-$79DE/-$79CA), party launch → A4 apply.
- per-era calendar
-
3D view + movement (Milestone 2 done) —
0x2900hood renderer plusgameplay/Movement(turn @0x5838, step @0x5816, passability first gate @0x9424, screen edge @0x1D0A, time tick/light drain @0x69DC). Arrow/keypad →$F0..$F3viaPlaySessionInput(no WASD — doc 43 §1 rawkey table). Offline checks:view3d_middlegate_check,playscreen_golden,movement_middlegate_test,playsession_input_test,event_middlegate_test. -
Exploration commands (Phase 2) — in-town input from doc 43:
Ctrl-Q quit prompt (
$12F4), Q Quick Ref party table ($595Cvia0x907A), digits 1–8 in-game character sheet ($8C8A/$39B4) with digit-chain character switch, O/P right-column OPTIONS/Protect toggle (-$79B2), Protect panel Light/Magic/Forces from-$79AB..-$79A6(0x5E28), C Controls modal (0x13CCE), sheet sub-keys E/R/D equip/remove/drop (class mask fromitems.dat), C/U/G/S/T stubbed toward ASM handlers. Play HUD chrome (PlayScreenChrome): black viewport/status/party fills, red-809Econsole box around the bottom party band (0x5600), and full-screen black + red border for Q Quick Ref / digit character sheet overlays. B/D/E/M/S/U exploration keys wired with status stubs; R Rest restores HP/SP (minimal stub toward0x19E20). Codecs:mm2_items_codec.{h,c}+tools/mm2_items_codec.py. -
Scripted scene graphics (Phase 4+) —
events/ScriptedSceneEnginedrives castle/scene illustration beats separate from the event VM (doc46-scripted-scene-graphics.md): Corak intro (viewport ghost overlay + loc 60str[8]+ OPTIONS panel) and Guardian Pegasus C2 (intro.32full-sheet blit — notintroclipstitle cels —- loc 11
str[5]+ Protect panel). Wired intoGameSession(auto-queue on new-game Middlegate / first enter map 11; debug Ctrl+G / Ctrl+P). Offline demos:scripted_corak.png,scripted_pegasus.pngviaevent_op_demo. OP_0B wired:ServiceSignResolver+ViewportAnmOverlay(62.anmblacksmith demo). GAP: Corak ghost castle-bytecode confirm (remake uses 51.anm candidate), mode$17placement table A4-$56E, party byte0x74bit0x40pegasus gate, castle tile hook0x78A8.
- loc 11
-
Event processing (Phase 4 — text ops) —
events/EventRuntimeloadsevent.datper screen (0x92F2), tile scanner @0x175E2, script VM @0x172CAfor OP_01..OP_07, OP_09, OP_0F, and OP_10/OP_11 token skip. Text draw viaevents/EventTextView+PlayScreenChromecell grid (doc44-event-text-rendering.md). Wired intoGameSession::tick()after movement (-$7952latch); movement blocked while SPACE/Y/N wait active. Middlegate acceptance: door labels (event 01OP_04"Middlegate Inn" @ (7,5)/DIR_N?), city gates Y/N (event 20OP_01+OP_09). Offline:event_middlegate_test. GAP: OP_0E town services, OP_0E town services, OP_0C map transition, OP_12 combat, str.dat cross-refs, outdoor/overland events. Visual opcode demos:event_op_demorenders OP_01..OP_07, OP_09, and OP_0B (stub) on the Middlegate play-screen base frame →build/event_demos/*.ppm(PNG if Pillow installed). OP_06 demo = B2 Archers Only outdoor signpost (not the red character-UI frame). Seebuild/event_demos/README.md:./build/event_op_demo.exe .. -
Main loop —
0x1280mode dispatch (overland, town, combat, menus). -
Events (services + combat ops) —
OP_0Etown-service dispatch, full VM. - Combat — round loop, player bar, monster AI, rewards.
-
Audio — Paula tone path from
master.32or MOD export fallback on desktop. -
Copy protection — externalize globe/disk strings (already extracted to
EXTRACTED/embedded_strings.json).
RE references: EXTRACTED/docs/README.md,
EXTRACTED/mm2.capstone.annotated.asm, per-location events in EXTRACTED/docs/events/.
Requires CMake ≥ 3.16, C++17, network on first configure (SDL2 fetched via FetchContent).
cd game
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build
./build/mm2 ../ # pass MM2 data directory (contains map.dat, town.32, …)
./build/mm2 ../ --ui=stub # text-only character UI fallbackView Party (P) and Create (C) use a swappable layer (game/include/mm2/ui/):
| Backend | Select |
|---|---|
AmigaClassic (default) |
--ui=classic, MM2_UI=classic, or -DMM2_UI=classic
|
Stub (text overlay) |
--ui=stub, MM2_UI=stub, or -DMM2_UI=stub
|
Requires book.32 in the data directory for the classic sheet backdrop.
See EXTRACTED/docs/39-character-ui-view-create.md.
Validate .32 decode (C codec vs Python reference):
cmake --build build
python ../tools/test_image32_golden.py --data-dir ..Same setup as ../Amiga/LandsOfLore: VS Code “Amiga Debug”
(BartmanAbyss amiga-debug) provides m68k-amiga-elf-gcc, elf2hunk, and sys-include.
The toolchain is auto-detected under %USERPROFILE%/.vscode/extensions/bartmanabyss.amiga-debug-*
(override with -DAMIGA_VSCODE_BIN=…/bin/win32).
cd game
cmake --preset m68k-bartman-1.8.2
cmake --build build/m68k-bartman-1.8.2 --parallel
# -> build/m68k-bartman-1.8.2/mm2.exe (ELF2HUNK hunk executable)Each Amiga link copies all *.dat, *.32, and *.anm from the MM2 repo root
(../ relative to game/) into the same folder as mm2.exe, so the default data dir
. matches WinUAE’s working directory. Rebuild after you change data files on disk.
Optional: still pass ../../.. (or another path) as argv[1] if you prefer not to copy.
Presets live in CMakePresets.json; toolchain files in cmake/ (mm2-m68k-bartman.cmake,
AmigaCMakeCrossToolchains/m68k-bartman.cmake). ACE is fetched from AmigaPorts/ACE main with ACE_USE_AGA_FEATURES enabled. VS Code kit: .vscode/cmake-kits.json + amiga.json.
Amiga uses -fno-exceptions -fno-rtti and CppStdCompat.h instead of libstdc++.
6bpp AGA screen (LoL screen.c pattern, TAG_VPORT_BPP 6 not LoL’s 8):
src/platform/amiga/mm2_amiga_display.c, defines in include/mm2/platform/amiga/Mm2AmigaConfig.h.
Rendering is planar end-to-end (mm2_amiga_planar.c): .32 assets decode straight
to bitplanes and blit via ACE — no chunky RGBA buffer and no c2p needed.
presentFrame() ignores the RGBA argument and just paces/refreshes the display.
-
Endianness:
.datmultibyte fields are little-endian on disk (see rootCLAUDE.md). -
Graphics: planar 5-bp
.32/.anmimage chunks —mm2_image32_codec.c. -
Naming: lifted routines keep
sub_<addr>_<purpose>until fully understood. - No Blitz3D: original 68k ASM is the source of truth for runtime behaviour.
- Docs Wiki Hub ← full doc index
- Getting Started ← read this first
- Overview
- Workspace Notes
- Open Questions
- Full Analysis
- Game Remake
- Startup and Init
- Runtime Memory Map
- Main Loop and Map
- Exploration Input and Options
- Party and Session
- Game State Struct
- Data Hunk mm2 data 00
- Time Era Calendar
- GFX Loading
- ANM TV Format
- PC DOS graphics
- SNES graphics
- 3D View and Game Screen
- Amiga 3D Render Process
- Scripted Scene Graphics
- Event Graphics Opcodes
- Title Screen Assets
- Title Screen Animation
- Format inventory
- items.dat
- monsters.dat
- roster.dat
- attrib.dat
- map.dat
- spells & item use
- event.dat
- Events by location ← 71 maps
- Events hub (numbered)
- Event Script Opcodes
-
Event Script DSL ←
.mm2evtauthoring - Event Text Rendering
- Event Graphics Opcodes
- Combat Overview
- Combat System
- Encounter Tables
- Spell Cast ASM
- monsters.dat abilities
- Spells and item use
- Amiga audio in exe ← Paula / DATA / remake
- Controls: Sounds / Walk Beep
- MM2 music format (superseded)
- Title/death audio paths (superseded)
- Known songs catalog (superseded)
- Town Services
- Spell Sources
- Character Mechanics
- Skills and Hirelings
- Commerce Formulas
- Commerce World Services
- Mount Farview Class Quest
- Class Quest HP Bug
- Event Runtime
- Event to String Path
- Embedded Exe Strings
- Copy Protection
- Time Era Calendar
- Game State Struct
- MM1 Overview ← hub + decode status
- MM1 MAZEDATA format
- MM1 to MM2 outdoor
- MM1 WALLPIX by sector
- MM1 art & graphics
- MM1 items / monsters (status)
- MM1 map walker ↗
- MM1 2D maps gallery
- MM1 WALLPIX gallery