Skip to content

Ledge: deterministic platformer engine in core and a full platformer template - #6364

Closed
shai-almog wants to merge 14 commits into
masterfrom
ledge-platformer
Closed

shai-almog wants to merge 14 commits into
masterfrom
ledge-platformer

Conversation

@shai-almog

Copy link
Copy Markdown
Collaborator

Adds a deterministic 2D / 2.5D platformer engine to core (com.codename1.gaming.platformer), plus Ledge, a full platformer template built on it and offered by the Initializr.

Engine

  • The simulation half uses 16.16 fixed point, a 60 Hz tick and a seeded Rng, with no floats and no clock. It is marked @SharedWithBackend, so the server replays runs with identical code.
  • It provides a tile collision grid (solid, one-way, slopes, ladders, water, spikes), an Actor with ordered abilities, and the level pieces:
    • Abilities: move, jump with coyote time and buffering, crouch, ladder, wall jump, dash, jetpack, glide, swim and weapon.
    • Level pieces: health, checkpoints, pickups, doors, gates, switches, springs, crumbling blocks, moving platforms and AIBrain enemies.
  • LevelData reads levels from JSON. InputLog and Replay handle recording and replay.
  • The view half (platformer.view) adds parallax, sprite animation, particles, screen shake, tick interpolation, race ghosts and a 2.5D depth renderer.

Ledge template (scripts/ledge)

  • 13 levels in five worlds. The skyway world is drawn in 2.5D and the forge ends with a boss. All art and sound are generated by tools/make-art.py.
  • Server-verified runs: single-use tickets, full replay on the server, a daily challenge, boards (all time, week, today and friends), ghosts and races.
  • The level editor's Check runs the solver. Ask AI generates a level server-side with an LLM, then the solver proves it can be finished, with a fallback to the built-in generator.
  • The admin console shows stats, flagged runs, the daily seed, broadcasts, an audit log and a death heat map.
  • The shop sells scarves and grants rewarded ads.
  • The template is wired into the Initializr, samples.yml, samples-ios-nightly.yml and initializr-e2e.yml. It adds a developer guide chapter and the platformer*.md skill references.

Verified

  • The backend tests pass (30), including every level's route replayed on several seeds and the solver finishing every level.
  • The e2e runs in the simulator on phone and desktop passes (31 screenshots), in a Linux container.
  • Runs on the iOS simulator and the Android emulator.

Red team

  • Fixed:
    • Coins were paid for every finished run and could be farmed. They are now paid only for a new best and for the first daily of the day.
    • A daily finished after midnight counted toward the next day.
    • Run routes had no rate limit.
    • Failed attempts were unbounded and one account could paint the heat map. They are now capped per player per level per hour and pruned after 30 days.
  • Not fixed, documented in Runs.submit: because the levels never use the seed, a run can be replayed from a copied ghost. A copy can at most tie the original, and ties rank the earlier run first.

Notes

  • Class.getResourceAsStream returns null for app resources on ParparVM. Ledge now loads through CN.getResourceAsStream. Other samples that use the class form may be broken on iOS.
  • No builder reads android.screenOrientation. Ledge uses android.xactivity instead. Dash, papercut, skirmish, splat and brickyard still carry the dead hint.

🤖 Generated with Claude Code

shai-almog and others added 14 commits November 30, 2026 11:24
…tformer)

Fixed-point tile controller (solid, one-way, 45/22.5 slopes, ladders, moving
platforms), ability system (move, jump, crouch, ladder, wall jump, dash,
jetpack, glide, swim, fly, look, weapons), health, AI brains, entities
(pickups, springs, checkpoints, doors, gates, switches, crumble blocks,
projectiles), level JSON and replay verification. Shared with the backend so
a server can replay a run with the same code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…arsing

PlatformView plays a PlatformWorld at a fixed 60 Hz with interpolation, a
dead-zone/look-ahead camera, per-event feedback, keyboard/gamepad/touch input
mapping and procedural art; setDepth(true) draws the same world in 2.5D.
PhysicsWorld gains one-way bodies and a contact filter (preSolve was empty).
LevelData rejects hostile levels and Fx/Rng throw on zero divisors, since the
server replays player-published levels natively.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/make-art.py draws every tile set, actor, item, backdrop and sound;
tools/sketch.py compiles level sketches; the shared Go-Explore Solver proves
each shipped level completable. Core: PlatformView art scale, sprite
particles and goal drawing; enemies can open a channel on defeat; replay
results carry score, coins and secrets. The template tree is copied from
papercut and its client is rewritten in the next commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The client: world map, HUD drawn with the game's art, pause and result
cards, attract mode on the home screen, ghosts and recorded-run playback,
per-level and daily boards. The server replays every submitted run
through the shared simulation before it reaches a board, flags runs far
faster than the shipped solution, and seeds every run within 52 bits so
the seed survives a JSON parser that reads numbers as doubles.

Core: PlatformView gains ghosts, tile-textured 2.5D blocks and backdrops
laid out about the camera in depth; Replay.Result is public.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The editor paints a sketch with the world's own art, play-tests it in the
real view and proves it finishable with the solver the server trusts. A
description becomes a level through the backend's model, validated by the
solver and replaced by the piece generator when the model's level cannot be
finished. Also: 2.5D backdrop anchoring and sky clear colour, HUD layout,
result card, 52-bit seeds that survive JSON, and level regression tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Failed runs that replay are kept as attempts; the console's Deaths tab
replays a level's recent runs and attempts on the server and draws where
the hero died. Racing shows the gap to the ghost, and any run on the
public board can be raced, not only a friend's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ills

Wires the platformer template everywhere the arena shooter is: the
Initializr (offered from the release after the engine lands), samples
CI, the nightly iOS build and the Initializr end-to-end run. Adds the
developer guide chapter with screenshots, three skill references
(engine, levels, art) and a solver-backed demo recorder in LevelsTest
so a new level can be proven and packed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… e2e pass

Class.getResourceAsStream answers null on ParparVM, so the iOS build
crashed on launch with every image missing; art and sounds now load
through CN.getResourceAsStream, and a missing file is logged.
android.screenOrientation is not a hint any builder reads; the
landscape lock goes through android.xactivity. run-e2e.sh gains the
desktop pass E2e already described, with a DesktopTest touring the
levels, the 2.5D sky, the editor, a race and the console.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ight

Red-team findings on the run service: coins were paid for every
finished run, so replaying one known-good log minted them without
limit; they are now paid for a new best of a level and the first daily
of the day. A daily ticket taken before midnight was scored as the next
day's. Run start and submit are rate-limited per player, failed runs
are capped per player per level an hour and pruned after 30 days, so
one account can neither fill the table nor paint the death map.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Engine:
- 2.5D sprites anchored at their feet were drawn a full height below the
  ground: the billboard anchor offset was inverted (SpriteRenderer). The
  depth backdrops compensated for it and are placed by their top now.
- A world from LevelData.createWorld listed no entities until its first
  tick, so the editor's thing icons and any preview were empty.
- Backdrop copies were counted in art pixels, so far layers ended
  mid-screen.

Template:
- World map cards paint their world's art (rounded borders skip
  paintBackground); light locked tiles and empty stars on the dark map.
- Seeded rivals pause at a safe point on the route, so boards rank a
  spread of times instead of one repeated run; right-aligned scores.
- 2.5D ledges wear only the plank strip, not the squashed whole tile.
- Desktop lift for spacing and icons, console stat cards, wrapping heat
  map, outlined HUD text, seamless backdrop art, toolbar titles in e2e.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ks for

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…no template name

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shai-almog shai-almog closed this Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant