Example 1: a platformer in about 150 lines

No image files here: every picture is a coloured shape. The level is text, a tilemap where each letter is a tile.

Click the game, then ← → or A D to move, Space to jump. A gamepad works too.

The whole game
Loading…

Example 2: collect and dodge

A top-down game: four-way movement, enemies that bounce off walls, a Timer that spawns gems, collision layers so enemies only bite the player, and a saved high score.

Click the game, then arrows or WASD. Collect gold, avoid red.

The whole game
Loading…

Game Design & Development · Our engine

Rosetta 2D: a game engine built to translate.

Rosetta 2D is our class's own 2D game engine. It is small enough to read in an afternoon, and it is shaped like the big engines on purpose: a scene tree of nodes, a fixed timestep for movement, named input actions and collision layers. Everything you learn here has a name in Godot, Unity, Unreal, GameMaker and Phaser, and the Tool Rosetta shows you which.

Why build our own?

Tiny and readable

One file, no install, no account, about 10 KB to download. Open the source and every feature is a few dozen lines you can follow.

Same shape as the big engines

ready, update, fixedUpdate, bodies, areas, tilemaps, signals and cameras work the way they do in professional tools, so moving on later is a change of vocabulary, not a fresh start.

Your work leaves with you

Levels save as plain JSON (serialization), tilemaps export to the free Tiled editor, and art is ordinary PNG. Nothing is locked inside our engine.

The engine in other engines' words

Every building block of Rosetta 2D, translated. Turn on the engine you plan to use next.

Start your own game

  1. Make a folder with an index.html file and paste this in.
  2. Open it through a local server (in VS Code, the Live Server extension works), because browsers block modules opened straight from disk.
  3. Change the Player class, add a TileMap.fromRows level, and build from there. Copy pieces from the examples above.
<canvas id="game"></canvas>
<script type="module">
  import { Game, Scene, Body, Shape } from 'https://mrscandrett.github.io/assets/js/rosetta2d/rosetta2d.mjs';

  class Player extends Body {
    ready() { this.add(new Shape({ w: 16, h: 16, color: '#e4572e' })); }
    fixedUpdate() {
      const move = this.game.input.vector('left', 'right', 'up', 'down');
      this.vx = move.x * 100;
      this.vy = move.y * 100;
    }
  }

  const game = new Game({ canvas: document.getElementById('game'), width: 320, height: 180 });
  game.input
    .bind('left', ['ArrowLeft', 'KeyA']).bind('right', ['ArrowRight', 'KeyD'])
    .bind('up', ['ArrowUp', 'KeyW']).bind('down', ['ArrowDown', 'KeyS']);
  game.start(new Scene({ children: [new Player({ x: 160, y: 90 })] }));
</script>