Skip to content

Breakout levels are fixed in code: add a level editor #84

Open

Description

@TMHSDigital

Summary

The roadmap lists a Breakout level editor, with no issue tracking it. Breakout's levels are already plain text grids, so the game is most of the way to supporting player-made levels; what is missing is a way to load a level that is not compiled in, and a screen to draw one.

Where

  • games/breakout/config.ts:32 to 40 (LEVELS, one string per row, . 1 2 3)
  • games/breakout/scenes/GameScene.ts:146 (LEVELS[this.level % LEVELS.length], the only place a layout is chosen)
  • README.md:368 (roadmap item)

Details

/**
 * Level layouts, one string per row, COLS characters wide.
 *   .  empty
 *   1  normal brick (1 hit)
 *   2  armored brick (2 hits)
 *   3  heavy brick (3 hits)
 */
export const LEVELS: string[][] = [ ... ];

The scene reads the layout from the constant directly, so there is no seam for a custom level.

Impact

Gives Breakout replay value beyond its built-in levels and gives contributors a no-code way to propose new ones.

Suggested fix

In steps, each shippable on its own:

  1. Move layout parsing and validation (row width, allowed characters, at least one brick) into a Phaser-free module with tests, and let the game scene take a layout through its start data.
  2. Add a CUSTOM entry to the Breakout menu that plays a level saved on this device (through shared/storage.ts). Custom runs should not count toward the best score or trophies.
  3. Add an editor scene: a grid the size of the brick field, cycle a cell through empty, 1, 2, 3 with click, tap or the action button, plus TEST and SAVE.
  4. Optional: encode a level in the URL so it can be shared, validated with the module from step 1.

Open questions: how many custom levels to keep, and whether saved levels belong in the backup file (shared/backup.ts checks each saved key against the shapes it knows).

Acceptance criteria

  • A level drawn in the editor can be saved, reloaded after a refresh and played
  • Invalid stored or shared level data is rejected without breaking the game
  • Custom levels do not change the best score, top five or trophies
  • The editor works with mouse, touch, keyboard and gamepad

Getting started

  • Relevant files: games/breakout/config.ts, games/breakout/scenes/GameScene.ts, games/breakout/scenes/MenuScene.ts, shared/storage.ts, shared/menu.ts
  • How to run tests: npm test
  • Related docs: CONTRIBUTING.md, the roadmap in README.md

Filed by repo-audit/feature-ideas at 5d19354. Severity: low. Effort: L. audit-key: enhancement|games/breakout/config.ts|LEVELS

Activity

  1. added
    enhancement
    severity: low
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementseverity: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions