NES emulator · local ML lab

AI Training Lab

Train a recurrent neuroevolution agent directly against NES CPU RAM, with optional game-aware spatial sensing for Super Mario Bros. Trajectory Memory can reuse the previous generation’s champion inputs at 99%→0% takeover points while candidate networks stay recurrently warmed. Four independent Web Worker emulator instances can evaluate runs in parallel across available CPU cores.

Back to emulator

Experiment

Training setup

0 active rewards 0 observations 8 / 8 AI buttons

Experiment

Four workers create four independent NES/WASM instances. The browser can schedule them across separate logical CPU cores; web pages cannot pin a worker to a specific physical core.

Evolution

Every run restores the selected start state before frame 1. In Trajectory Memory Sweep, the first generation is 100% neural-network controlled. Later generations replay the previous champion for evenly spaced prefixes: with 100 runs that is 99%, 98%, …, 1%, 0%, then the candidate network takes over. During the replay prefix the candidate still receives every observation and updates recurrent memory; only its controller output is ignored.

Learning context

The SMB sensor activates automatically only for a detected Super Mario Bros. ROM. It converts the collision tile buffer and active enemies into a Mario-centered local map, so holes and obstacles are meaningful inputs instead of raw tile IDs.

Controller

Each enabled NES button remains an independent neural output every frame. Disable buttons the game should never use—for example Start after gameplay begins.

Enabled outputs can still combine freely in the same frame. “None” is always possible when no enabled output crosses its activation threshold.

Replay & retention

Estimated replay storage: --
Learning engine v5 · trajectory memory + resilient parallel workersTrajectory Memory preserves the best complete controller path found so far and branches candidate recurrent networks from different percentages of that path. Policy breeding scores only reward earned after neural takeover, while champion trajectory selection still uses the complete run. Up to four independent NES/WASM workers evaluate branches concurrently.
Load a ROM and configure at least one reward rule.
Generation0
Run0 / 0
Best trajectory reward--
Mean trajectory reward--
Best autonomous NN--
Champion memory--
Frames0
Speed--
Best world X--
A edges / run--
Workers0 / 4
Generation data Reset learned weights, trajectory memory, generation number, statistics and retained replays while keeping reward rules, observation memory, training settings and your checkpoint.
Local training data

Profiles, model weights, statistics, retained input replays, and the optional ~2 MiB training checkpoint are stored in IndexedDB on this browser. ROM files are not copied into the AI profile.

Training runtime

Game preview

Waiting for ROM
Keyboard controls work anywhere on this page (except while typing in a form field); the game iframe no longer needs focus.
ROM: none · CPU RAM values can be binary, packed BCD, or one-decimal-digit-per-byte BCD, contiguous or assembled from explicit non-contiguous byte addresses.
No checkpoint capturedPause at any in-game position and capture it. Every checkpoint-based run will restore exactly that state before frame 1.

Fitness

Reward memory rules

Reward values tell the trainer what should become better or worse. Each rule can use one base address for consecutive bytes or an explicit comma-separated address per byte. Binary 8/16/24/32-bit, packed-BCD, and byte-per-digit BCD values are supported. Change rules, edge-triggered target/threshold rules, and continuous While-rules are available. Continuous rewards can run every N emulated frames or every N game-seconds, so training speed does not change the reward rate. Up to 10 rules are supported.

OnLabelAddress / byte addressesTypeFeedback triggerTargetModeEveryStrengthWrapProgressEnd runValue

Example for Super Mario Bros. full running speed: $0057 · 8-bit signed · While = target → positive · target 24. Set Every to 1 game-sec for one reward per game-second at full speed, or 1 frame for a reward on every qualifying emulated frame.

Test reward: 0.00
Load a ROM, start the game, then start Reward Test to verify your memory rules before training.

Agent input

Observation memory

The agent learns from decoded RAM values. Reward values are automatically included. Observation rows now accept a single typed value, explicit composite bytes, or a range such as $0000-$00FF. A range is split into non-overlapping values of the selected type; with 8-bit unsigned this observes every byte in the range. Up to 2,048 effective neural inputs are supported across 64 rows.

0 / 2,048 inputsRanges are read directly from shared WASM CPU RAM.

RAM finder

Memory discovery

No scan

Choose the value width/type, take a RAM snapshot, then filter by change or enter a known current value directly. The scanner searches contiguous candidates and understands packed BCD plus one-decimal-digit-per-byte values such as the Super Mario Bros. timer. After discovery, a rule can be edited into a non-contiguous composite value when a game stores its bytes separately.

No candidates yet.

Generation replays

Replay archive

No generations saved

Controller masks are stored instead of videos. Current runs record one independently generated 8-button mask per emulated frame, with RLE compression for repeated masks. Older retained replays remain playable. Multi-run overlays and video export remain the next replay milestone.

No replay data yet.