Online: …

Make a game for Back to Simple Games

Thanks for making games for the site! This page explains what a game needs and how to send it. It is short, promise.

What your game needs

Make it work on phones

.board { width: min(100%, 460px, calc(var(--bsg-stage, 100svh) - 8rem)); aspect-ratio: 1; max-height: calc(var(--bsg-stage, 100svh) - 8rem); }

Change the 8rem to match your title, score and buttons. Rules sit beside or below the frame on the site, so you don't need to repeat them in the game. Extra lobby bits (chat, invite, QR) can go under the board — the page will scroll, but the board itself should stay fully on screen while playing. Don't set min-height: 100vh on body (it fights the frame and can add a scrollbar).

How to send it

  1. Put your game in a folder (or just the one HTML file).
  2. Add your rules as rules.txt if they are not in the HTML.
  3. Zip the folder (right-click, Compress / Send to, Zipped folder) and email the zip as an attachment to the address you were given. A single HTML file can be attached as it is.
  4. Say in the email if it is single player or multiplayer, and how many players it needs.

We put it on a secret preview link first, test it, and send you the link. It only goes public on the home page once it is approved.

Multiplayer games

The site has a ready-made multiplayer system, so you don't need your own server. Add the script and it draws the whole lobby for you: nickname, online count, public rooms, private rooms with a code, Quick play, players list, chat, a Start button, and reconnecting if someone's Wi-Fi drops.

How it works: the player who made the room is the host. Other players send their moves to the host. The host checks each move, updates the game, and shares the new game state with everyone. If the host leaves, the next player becomes host and keeps going.

The main pieces:

Here is a complete tiny game you can copy and change. Players take turns adding 1 or 2, and whoever reaches 10 wins:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Race to 10</title>
</head>
<body>
<div id="lobby"></div>
<div id="game" style="display:none">
  <h1 id="count">0</h1>
  <p id="status"></p>
  <button onclick="move(1)">+1</button>
  <button onclick="move(2)">+2</button>
  <button id="again" onclick="room.rematch()">Play again</button>
</div>
<script src="/sdk/bsg-multiplayer.js"></script>
<script>
var room = null, state = null;

// Only the host runs this: check the move, update the game, share it.
function applyMove(playerId, n) {
  if (!state || state.winner || state.order[state.turn] !== playerId) return;
  if (n !== 1 && n !== 2) return;
  state.count = Math.min(10, state.count + n);
  if (state.count >= 10) state.winner = playerId;
  else state.turn = (state.turn + 1) % state.order.length;
  room.setState(state);
}

// Any player presses a button.
function move(n) {
  if (!room || !state) return;
  if (room.isHost) applyMove(room.me, n);
  else room.send({ add: n });
}

function render() {
  document.getElementById('game').style.display = state ? 'block' : 'none';
  if (!state) return;
  document.getElementById('count').textContent = state.count;
  var turnId = state.order[state.turn];
  document.getElementById('status').textContent = state.winner
    ? room.playerName(state.winner) + ' wins!'
    : (turnId === room.me ? 'Your turn' : room.playerName(turnId) + "'s turn");
  document.getElementById('again').style.display = state.winner ? '' : 'none';
}

BSG.lobby({
  el: document.getElementById('lobby'),
  onJoin: function (r) { room = r; state = r.started ? r.state : null; render(); },
  onPlayers: function (r) { room = r; render(); },
  onStart: function (r, info) {
    room = r;
    if (r.isHost && !info.resumed) {
      r.setState({ order: r.players.map(function (p) { return p.id; }), turn: 0, count: 0, winner: null });
    }
  },
  onState: function (s) { state = s; render(); },
  onMessage: function (data, fromId) { if (room && room.isHost && data) applyMove(fromId, data.add); },
  onLeave: function () { room = null; state = null; render(); }
});
</script>
</body>
</html>

Good to know:

Scores and leaderboards

The site can keep a weekly and all-time leaderboard for a game. Players use a nickname (no accounts). A private id stays in their browser so two people with the same nickname don't get mixed up.

Multiplayer games are recorded automatically from the room on our server, once a finished game between two different players is checked. You don't call anything. Quick quits and games against yourself don't count. Drop Four works this way already.

Single-player games send a score with BSG.reportScore. Include /sdk/bsg-score.js (or rely on the site adding it) and, for a puzzle, ask the server for the puzzle first so it can check the solve:

<script src="/sdk/bsg-score.js"></script>
<script>
// 1. Get a puzzle the server knows about.
BSG.newPuzzle({ game: 'lights-out', size: 5 }).then(function (p) {
  // p.seed, p.size, p.grid  — show p.grid, remember p.seed
});

// 2. When the player solves it, send the move list (not just the number).
BSG.reportScore({
  game: 'lights-out',
  name: BSG.getName() || 'Alex',
  seed: seed,
  size: 5,
  moves: [{ r: 0, c: 1 }, { r: 2, c: 2 }],
  time: Date.now() - startedAt
}).then(function (r) {
  if (r.ok) { /* saved */ }
});
</script>

Useful helpers: BSG.clientId(), BSG.getName(), BSG.setName(n) (max 16 characters). Keep nicknames polite; rude ones are rejected.

A new game is not added to the public leaderboard until we have a way to check its scores on the server. Until then, reportScore returns an error and nothing is stored. Tell us how your scoring works when you send the game.

Each game page shows a compact leaderboard under the game, and all boards are listed at /leaderboards.

Questions?

Just reply to the email thread. Have fun making games!