What it does
You describe the board as plain data, bottom to top. Each row is safe, road (its pieces are lethal vehicles),
river (its pieces are the only footing and carry the frog) or home. Each road or river row has a lane with a
direction, a speed, piece templates and lengths, a count, a minimum gap, convoys and, for river pieces, diving cycles
with a warning before they go under. The home row lists its bays and what lies on the bank between them. Bonus flies,
threats in empty bays, an escort riding a log and overlay hazards such as snakes are optional extras.
The pack runs it all. It hops the frog cell by cell, sweeping vehicles along the hop, carries it on platforms, and loses it for each cause the rules name, from a vehicle or the water to drifting off the edge, missing a bay or running out of time, then puts a new frog at the start. It scores hops, bays, time left, bonuses and a level clear, speeds up per bay and per level, and moves to the next level when every bay is full. You draw from the state each frame; piece positions and diving phases come from the same calculation the collisions use, so what the player sees is what kills them.
Every board is certified. generateFrogger lays the board out from the seed, plans a timed route through every bay with
the real collision rules, and replays it without losing a frog, trying up to eight seeded formations. A board that
cannot be crossed fails with a message naming the row that stopped it and what to change. The same search powers
hint(), and saves, undo, redo and reset rebuild real outcomes by replaying the history.
Features
- Boards as data — 4 to 64 cells wide, 3 to 30 rows, up to 32 lanes and 16 bays, in any order you like.
- Lanes — direction, speed, piece kinds and lengths, counts and gaps per difficulty, convoys, and a piece that turns into another kind from a given level.
- Diving platforms — surface, warning, submerged and rising times per lane, with some or all pieces diving.
- Piece behaviours — multi-part pieces, jaws that open while submerged, lethal ends, hazards with a rideable back.
- Bonuses and threats — a fly in an empty bay, a threat that takes a bay, an escort to bring home, and overlay hazard lanes from a level.
- Rule options — footprint or centre support, edge drift, bay tolerance, vehicle hitbox inset, frog size, hop time, buffered and platform-relative hops, timer refills, speed-ups, levels, lives and every score value.
- Certified boards — a timed route through every bay replayed without a loss, and clear errors naming the row at fault.
- Hints, saves, undo and redo — from any position, on any board.
- Two presets —
classic, the arcade layout with crocodiles, snakes and an otter in later levels, andcurb-hopper, a modern 13-row design with its own lane order. - Any renderer — the rules make no assumptions about drawing or input, for 2D sprites or 3D.
Good for
- Classic lane-crossing games in the style of Frogger, with five bays, diving turtles and crocodiles.
- Your own crossing from a design document, such as a street-and-pond crossing with lily pads.
- Long marathon boards with islands of safety, up to thirty rows.
- Gentler or harder variants for different players, by difficulty, timer and rule options.
- Puzzle-like single boards where a certified route guarantees the level can be done.
- 2D or 3D presentations of the same rules.
Make it yours
generateFrogger takes the seed, a preset, a board, rule overrides, difficulty, level, lives, the timer and the default
dive timing. A board sets the width, start position, rows and their lanes, piece kinds, hazards, the fly, the bay
threat, the escort and death messages. Rules set support, drift, bay tolerance, vehicle inset, frog radius, hop time,
hop buffering and carrying, the timer refill, speed-ups per bay and per level, the number of levels, hazards, extra life
and every score. Anything you leave out keeps the tested defaults.
Two materially different boards from one pack: the classic arrangement, fourteen cells wide with five traffic lanes, a
median, logs and turtles and five bays, footprint support and 99 levels; and curb-hopper, thirteen rows with its own
lane order, logs mixed with lily pads, faster-diving turtle pairs, centre support, edge drift, buffered and
platform-relative hops, a speed-up for every filled bay and a single level.
A quick look
A generated board played with key presses and real elapsed time:
const level = game.frogger.generateFrogger({ seed: 7, preset: 'curb-hopper' });
const crossing = game.frogger.createFrogger(level.definition);
crossing.apply({ kind: 'hop', direction: 'up' }); // on key press
crossing.apply({ kind: 'advance', seconds: dt }); // every frame
const s = crossing.state; // frog, homes, lives, score, status
for (const piece of game.frogger.froggerObjects(s)) draw(piece);
if (s.status === 'level-complete') crossing.apply({ kind: 'next-level' });
Works with
lane-control— required: lane motion, widths, spacing and diving phases; reach for it directly for released or stopping streams.crossy-road— for an endless, scrolling crossing.
Good to know
- Each road or river row has one lane, all its pieces at one speed and direction; overlay hazards add a second stream.
- Lanes wrap at the field edges, so traffic loops rather than spawning.
- Certification is a bounded search, so a board a person could only just cross may still fail; ease the row it names.
- A certificate guarantees one route, not that every position the player reaches stays recoverable.
- The classic timings are a play-tested reconstruction, not verified arcade timings, and there is no two-player alternating mode.






