DEV Community

Paul Krause
Paul Krause

Posted on

I Built a Pentomino Game That Escalates From 2D to 5D in a Single HTML File

You don’t just unlock higher dimensions in this game. You have to earn them.

LVL5 is a pentomino puzzle that starts as familiar 2D and progressively adds dimensions — all the way to 5D. Each new tier doesn’t just give you more space. It adds rotation planes, changes how pieces behave, and demands better spatial reasoning. There’s no hand-holding when you cross from 3D into 4D or 4D into 5D.
If you can’t get to 4D chess, you wouldn’t like it there anyway.

What it actually is

LVL5 is a single HTML file. No frameworks, no build step, no server, no dependencies. Open it in a browser and it just works.
The core loop is classic pentominoes, but the well wraps toroidally in every axis perpendicular to gravity. Pieces are always 5 cells. As you clear layers, the game advances:
• 2D — Classic wrapping pentominoes
• 3D — Pentacubes on a toroidal floor
• 4D — Pieces now span multiple 3D slices
• 5D — Full 5D with an isoclinic double rotation (a motion that literally cannot exist in lower dimensions)

The piece generation uses signed permutations with canonicalization so the same underlying shapes work across dimensions. 5D pieces are essentially 4D pieces with an extra axis fixed at zero. The coloring uses the golden angle. Scoring is Fibonacci-based with combo multipliers.

Everything — rendering (including isometric projection and slice views), collision, rotation across all planes, controls, and progression — lives in one file.
Why I built it this way
I wanted the dimensional jump to feel earned.

Most “higher dimensional” games either throw you straight into the deep end or simplify things so much that the extra dimensions feel like a gimmick. I wanted the game to respect the player’s growing understanding. If you brute-force your way through 2D and 3D without developing better intuition, 4D and 5D will punish you.

The controls also evolve. By 5D you have access to an isoclinic rotation — a simultaneous rotation in two orthogonal planes. It’s disorienting at first, which is the point.

Technical notes (for the curious)
• Piece shapes are generated using signed permutations across N dimensions, then deduplicated via canonical sorting.
• Toroidal wrapping is handled with a proper modular coordinate system.
• Rendering switches between 2D grid, 3D isometric cubes, and sliced multi-view for 4D/5D.
• All rotation planes are precomputed. In 5D there are 10 possible rotation planes.
• The entire game (including the adaptive on-screen controls) is under 500 lines of JavaScript.

You can see the full source here:
https://github.com/onePaulKrause/LVL5-Game-5D

Play it

Try it here: https://lvl5.hom3.org
It works on desktop and mobile. Keyboard controls are available, and there’s a full touch control pad that adapts to the current dimension.

Final thought
Higher dimensions in games are often treated as spectacle. In LVL5 they’re treated as a skill check. The game doesn’t congratulate you for reaching 5D. It just quietly raises the bar and waits to see if you can keep up.
Some people will hate that.
I’m fine with it.
.-.
1<3
Paul
Hom3.org

Top comments (0)