What it does
createPlatformer builds an independent simulation from a config of surfaces, ladders, coins, a start, a goal and the
movement settings. You feed it input each 1/60 second step, a move axis, a held jump button, a climb axis, a drop,
and it moves the player on the physics solver from physics-2d, in a world of its own with no renderer. Jump
buffering and coyote time are counted in frames, and releasing jump early shortens the jump. Wall kicks and wall
slides happen only on surfaces you mark for them, so ordinary walls never grant them by accident.
Terrain is a set of optional surface properties. A surface can be a slope, one-way from any side, a conveyor, a lift on a waypoint route, a deck swinging from a distance joint, a seesaw on a revolute joint, a crate, a door, a spring, crumbling, cycling in and out, breakable from above or below, or a ledge to catch. Buttons and pressure plates send signals that open, activate or reverse other surfaces, and water and wind zones push the player. You render the live surface positions the simulation reports, so dynamic bodies are drawn where they really are.
The generators are what make it more than a motor. generatePlatformer builds a course from a seed, a difficulty, a
family and a profile; generatePlatformWorkshop builds one focused on a single mechanic or mixing them. A witness
controller plays each candidate with real inputs, an independent replay confirms the win, and the ground courses also
check that just holding left or right does not win. A course that fails is regenerated, and if none succeeds the
generator throws rather than handing back a fixed level.
Features
- A tuned motor — acceleration and braking, variable jumps, coyote time and buffering in frames, ladders, drop through one-way floors, and wall kicks and slides on marked surfaces.
- Modern terrain — slopes with a walkable limit and floor snapping, one-way platforms facing any side, conveyors and traction for ice or sticky ground.
- Physical moving parts — waypoint lifts that start on a ride or a signal, swinging decks on joints, seesaws, crates to push and stand on, and crush rules for lifts.
- Timed and breakable terrain — crumbling platforms that fall or vanish and respawn, cycling platforms with a warning, springs and blocks broken from below or by a stomp.
- Optional abilities — crouch, ledge grab on permitted corners, up to three air jumps, a dash and swimming.
- Switches, water and wind — buttons and pressure plates with latched or momentary signals, water flow and wind forces.
- Rewind and retry — rewind a chosen number of frames by exact replay, retry from the last safe checkpoint, and reset.
- Recorded inputs — serialisable, compressible input recordings and replay, never stored positions.
- Seeded courses — seven course families with easy to very-hard difficulty and 3 to 10 rooms, each certified by a replay.
- Mechanic workshops — courses that introduce one of 21 mechanics, from slopes and seesaws to dashing and wind, or mix them, with a short lesson for each.
Good for
- Exploration platformers where the player sets the pace, with ladders, lifts and optional upper routes.
- Precision platformers with wall kicks, dashes, air jumps and crumbling or timed platforms.
- Physics puzzle platforming, with seesaws, swinging decks, crates and pressure plates that open doors.
- Daily or seeded course modes, a new verified course from each seed.
- Tutorial levels, one mechanic per course with its lesson text.
- Level design tools, since every course and authored level replays exactly from its inputs.
Make it yours
Authored configs choose every surface and ability flag, gravity, speed and jump speed, slope limits, dash travel and
the death line. Two profiles set the generators' rules: classic has ladders, drop-through, variable jumps and six
frames of coyote time and buffering; adventure adds wall slides and wall jumps on marked surfaces. Seven families,
meadow, highlands, descent, switchback, caverns, machinery and ground, shape the course, and difficulty lengthens the
route, widens gaps and narrows resting platforms while the physics stay the same.
Two quite different uses: a classic ground course with a mostly continuous lower route, real pits, stairs, terraces and ladder lofts, cleared without wall jumps; or a hard mixed workshop that strings slopes, swinging decks, switches and wind into one course and hands back the lesson for each. An authored level can be as simple as a few rectangles, since every terrain feature is optional.
A quick look
A seeded course, played a step at a time, and its certificate replayed:
import {generatePlatformer, createPlatformer} from '@phaser-ae/platformer-2d';
const level = generatePlatformer({seed:29, difficulty:'medium', profile:'adventure'});
const run = createPlatformer(level.config);
run.tick({move:1, jump:true}); // one 1/60-second step
run.tick({move:1, jump:false}); // early release shortens the jump
const verification = createPlatformer(level.config);
verification.replay(level.solution); // state.won === true
Works with
physics-2d— the rigid-body solver the motor runs on, in a world of its own.autorun-platformer-2d— for one-button courses where the runner never stops.platform-map,platform-walkerand the other platform packs — for single-screen arcade platforming with enemies and ladders.ninja-rope-2d— for rope swinging, which this pack leaves out.
Good to know
- No enemies and no combat; it is a traversal motor.
- A course allows 180 surfaces, 30 ladders, 30 triggers, 30 zones, 100 coins and 24,000 frames, and a surface has one motion model.
- Slopes are triangular ramps rather than freeform terrain, and swinging decks hang from a single joint, not a chain of links.
- Ledge grabs need static rectangular surfaces, and crush rules cover waypoint lifts only.
- A certificate proves a course can be cleared from the start, not that every mistake is recoverable; the route planner is not a general solver for authored levels.






