
This project aims to recreate an engine very similar to the SNES Mega Man X trilogy. Published builds are available from GitHub releases. The current source targets .NET 9; older published builds use the runtime required by their particular release.
Since November 2026, this project has utilized GPT/Codex to accelerate its development, a resource that proved indispensable, particularly in analyzing the original games, such as by accurately replicating the behavior of enemies and bosses, as well as reproducing various nuances of the games’ physics.
Current production entry points load imported level assets without a ROM.
XSharpDemo remains the authored Penguin demo; XSharp.LevelSandbox loads stages
from X1/X2/X3 using --game=X2 --stage=8 --checkpoint=1 or --level=<asset>.
Press F8 or choose Select level from the sandbox window’s system menu
to change the game, stage and checkpoint during play.
The sandbox includes Visual Studio launch profiles for common test stages.
See level assets, importer commands, authored classes and game managers.
The Penguin demo opens the native Mega Man X pause menu with Enter/Start
by default. Its small XSharp.Assets.X1.Menus data assembly is included by the
demo project; no ROM or manual --asset-package argument is required. The menu
adapts to the client viewport while retaining the demo’s existing gameplay
profiles. Explicit player/menu profile configuration remains available. See
native pause menus for controls, source evidence
and independent menu-profile selection.
GameManager owns session policy. Campaigns have persistent progression/inventory;
the Penguin demo and level sandbox use separate transient session contexts.
ROM extraction stays in ROMExporter / MegaEDXCore. The optional
XSharp.RomCompatibility assembly is only for direct-ROM research and legacy states.
The partial camera-request correction restores complete Gap and Stag motion/camera agreement with native cadence and records remaining autonomous timing differences. The earlier verification preserves the regression measurements.
The reusable X2 runtime research register indexes ROM/runtime findings, revision-pinned evidence, portable investigation exports and synchronized metadata for the internal MegaEDX API and HunterBaseStudio. The Stag calibration record records fourteen corrections, complete player-motion/camera agreement under explicitly supplied native cadence, and remaining autonomous/RNG/scene differences; the Stag/Gator baseline preserves earlier measurements.
A video showing the version v0.2.1-alpha released on March 23, 2023 can be watched at https://www.youtube.com/watch?v=5SOOVi5R4s8
You can control the X using the following keys:
Keyboard actions can be rebound through the developer console,
for example with bind space +jump. Joypad support uses the existing controller
mapping (tested with a DS4 through DS4Windows).
Shortcut Keys:
| : Next frame, if in frame advance mode. Otherwise, start the frame advance mode. |
demos/latest.bk2.Demos record one SNES joypad input per accepted simulation tick and include an initial XSharp save state. Playback holds the final frame until stopped. State loading, no clip and camera-constraint shortcuts are blocked while a demo is active. See demo recording, BK2 interchange and frame traces for the API, compatibility limits and tests. The BK2 input timeline and session controller can be tested without opening graphics or audio devices; the current full game lifecycle still initializes both devices.
The X1 enemy combat audit documents the reviewed health/damage values, ROM revision, save-state migration and remaining behavior audits. These checks establish the listed combat values; full frame-by-frame parity with all three original games remains in progress.
New game content is organized into six projects for common enemies and bosses from X1, X2 and X3. Applications explicitly reference and register the modules they need. The airborne Sine Faller and its sprite asset live in XSharp.Enemies.X1; Bosspider, Petitpider and their sprite asset live in XSharp.Bosses.X1. The demo registers both modules. Other entry points are prepared for translated content. Legacy actors still in the core are being migrated, so the full separation remains in progress. See the Bosspider validation notes for battle coverage and remaining parity work.
Run the renderer-independent regression suite with:
dotnet test XSharp.Tests/XSharp.Tests.csproj
The module documentation includes application configuration, save-state type aliases, migration boundaries and a Windows integration probe.
The EnemyExtractor C# console and reusable API scan the supported X1/X2/X3 ROM revisions and produce per-object palettes, tile atlases, composed sprite sheets and 65C816 code packets for conversion into those content projects. The program embeds its identification catalog and runs without Python, rendering or audio. It preserves source addresses, contextual aliases and unresolved code/resource diagnostics. The current AI workflow is direct C# adaptation of that original material, without requiring a transpiler. Creeper retains its earlier generated procedures; direct ROM-derived controls across X1/X2/X3 now include scripted parent/child behavior, triggered traps, reflective projectiles and terrain interaction. The native conversion ledger tracks all 104 recent actors, partial coverage and deferred behavioral validation.
Modifications currently in progress:
Some Pending Fixes:
Future additions:
The Windows demo selects a renderer with --renderer=dx9, --renderer=dx11, or
--renderer=opengl. The XSHARP_RENDERER environment variable accepts the same
values. Direct3D 9 is the default when neither option is supplied.
Direct3D 11 and OpenGL share the XSharpSDL implementation. SDL creates the
explicitly requested native renderer. Indexed pixels, mutable palettes, fading,
sprites, scene layers, render targets and debug drawing use the existing engine
contracts. Palette expansion and fading currently run on the CPU before texture
upload. SDL native libraries are supplied by the referenced NuGet package.
Run the native rendering regressions on Windows with
dotnet test XSharp.Render.Tests/XSharp.Render.Tests.csproj.
The suite requires both graphics drivers and checks pixel readback, palette
updates, mirroring, alpha, sprite-sheet crops, render targets and resource lifetime.
Set XSHARP_PHYSICS to common, legacy, x1, x2, or x3 before starting the engine.
The default legacy profile preserves the previous movement parameters. Code can
select the next spawn’s profile with
BaseEngine.Engine.PlayerPhysics = PlayerPhysicsProfile.MegaManX2.
The intentional held-Dash ground-jump extension remains enabled by default in all profiles.
Set AllowHeldDashGroundJumps = false in a custom profile for native demo comparisons;
the comparison host does this explicitly. See profile configuration.
A player captures the profile when spawning. Changing the selection takes effect
on the next spawn or reload. Custom immutable profiles can be created with a
record with expression and are validated before selection.
The X2 base walking, dashing, jump and gravity parameters match the supplied USA ROM bytes. The presets retain the engine’s existing remaining parameters, with its X1 walking-animation pause and collision-width conventions. Further original frame traces are required to certify complete movement parity, especially slopes, water, wall jumps and input timing. The profile selection is runtime configuration. Save-state restoration uses the currently selected profile; keep that selection unchanged during replay comparisons. Native demos require the matching core build because saved simulation fields can change as the engine evolves.
Run movement regressions with dotnet test XSharp.Tests/XSharp.Tests.csproj.
The physics documentation describes the separate XSharp.Physics library,
X2 ground-jump preparation/cancellation, original-game traces, reproduction commands and
remaining parity limits. Run its device-independent regression suite with
dotnet test XSharp.Physics.Tests/XSharp.Physics.Tests.csproj.
Movie calibration covers the user-recorded BizHawk X2 demos, isolated original-runtime captures and headless regressions for the final Sponge ladder gaps.
The continuous BK2 comparison console runs all
Gap Jumps inputs on the ROM-loaded Sponge stage, compares player/camera motion and RNG,
and records original/engine entity timelines. The scene-wide analysis
documents source captures, current divergences and save-restoration coverage. Full scene parity remains pending.
Sprite image loading preserves original dimensions and palette colors across non-power-of-two sheets. See the sprite palette regression for D3D9 evidence and native test commands.
The X2 BizHawk debug controls provide camera unlocking, XSharp-style no clip with a mapped Dash boost, checkpoint navigation and a live debug form. The script supports BizHawk 2.11 with BSNESv115+ and Snes9x using frame events and WRAM, with separate headless and real-core regressions.
The optional X1 Ride Armor supports X boarding, walking, dash/jump/punch, ejection and timed overheat, with separate ROM-derived Armor Soldier boarding and stolen-armor gunner logic.
The standalone AudioExtractor console/API renders X1/X2/X3 ROM audio to PCM16 stereo WAV using the original SPC driver and an external Snes9x libretro core. Music and effects are extracted independently; no engine or render host is required. See its README for setup, cmd examples, revision support and explicit duration/loop/bank coverage limits.
The imported native audio assets are
separated by original game and include music, shared effect clips and native
bank/command manifests. Use tools/Import-NativeAudio.ps1 to regenerate them
and tools/Test-NativeAudioAssets.ps1 to validate the local collection.
Generated game folders are ignored by Git. Music defaults to introduction plus
one native control-flow cycle with loop manifests; WAV, FLAC and MP3 are supported,
and imports default to lossless FLAC. See loop analysis and timing limits.
The native audio playback API reads those
manifests and applies decoded-PCM loop coordinates for WAV, FLAC and MP3.
XSharp.Audio.NAudio is the shared Windows audio backend for the desktop
renderers; XSharp.Audio.Tests validates decoding and playback independently
of graphics and ROM extraction.
Native assets are copied only by executable hosts that import
build/NativeAudioAssets.targets, keeping the collection out of library and
test output directories. Validate this boundary with
tools/Test-NativeAudioAssetCopy.ps1.
Player equipment profiles select X1/X2/X3/custom
movement, busters, and shared combat and pickup audio independently of the stage.
Select a bundle with XSHARP_PLAYER or set individual policies in the initialization
callback. Games can configure armor, register special weapons, and enable the
equipment menu with XSHARP_PAUSE_MENU=1. Optional asset assemblies
provide profile descriptors and media for level precache.
Mixed armor equipment selects each part’s
source game and optional X3 chip through startup environment bindings or console
convars. Source-backed X2/X3 stored arm shots, scoped Neon Jump behavior, X3 air
dashes/body barriers and independent trilogy armor layers are integrated;
remaining armor abilities and native presentation details are tracked there.
The X1/X2/X3 asset bundles supply native equipment displays,
selected independently of the stage with XSHARP_PAUSE_MENU=x1|x2|x3
after mounting the matching package. Native normal-resume clocks and unpause input history are integrated;
other source paths and stage-exit parity remain in progress.
Engine scripting provides private LogicScript scopes,
Lua as the default language, an explicit capability API, frame-based delayed
calls and deterministic save-state/demo restoration. Additional language
adapters use the standalone XSharp.Scripting contracts. Imported level packages
can declare scripts directly; the Penguin demo includes an embedded Lua example.
Declarative level audio selects stage music from level.json
or a Source-style ambient_generic entity; script control remains available.