Sonic PHP

The Master System Sonic (1991), remade in PHP and playable for free in your browser: all six zones, the bosses, the special stages, and races against bots.

Computer, phone or gamepad · nothing to install · no sign-up

Sonic rolled into a ball near the rings of Green Hill, a crab in his way

The 8-bit Sonic, the whole game

Run, jump, grab rings, smash the bonus monitors and reach the signpost at the end of each act. Six zones of three acts, a boss at the end of every zone, special stages full of rings and springs, and the ending.

The game keeps your best times and a ghost of your best run, to beat next time. Options include a CRT screen filter, PAL or NTSC speed, French or English, and a music jukebox.

The island map before Green Hill, with Sonic's lives
The island map, between two zones.

The six zones

Every zone has its own scenery, traps and boss. Screenshots of the game as it runs in the browser.

Green Hill: checkered hills, palm trees and rings
Green Hill · act 1
Bridge: cliffs and a log bridge over the water
Bridge · act 1
Jungle: a waterfall in the middle of the forest, and platforms
Jungle · act 1
Labyrinth: carved green blocks, underwater
Labyrinth · act 1
Scrap Brain: a factory in front of a city at sunset
Scrap Brain · act 1
Sky Base: blue girders in the night
Sky Base · act 1
The doctor in his flying machine above Sonic, at the end of Green Hill
The first boss · Green Hill, act 3
A special stage: stars, rings and springs
A special stage · rings and springs
A four-player race through Green Hill, the ranking at the top right
A four-player race against three bots.

Against the bots

In MULTIPLAYER, face 1 to 4 computer-controlled runners (up to 5 for flag), in the game's zones, with four rules:

Race: first to the signpost. Flag: hold it the longest. Rings: collect the most. Deathmatch: be the last one standing.

Want to face real players? That is in the full version.

The full version: sonic.mimichat.fr

This game comes from Sonic PHP, whose original, complete version is played at sonic.mimichat.fr. It has everything you see here, and more:

  • online multiplayer for up to 6 players, in race, flag, rings or deathmatch;
  • public rooms, or private ones with a 4-letter code; empty seats are filled by bots;
  • chat in the lobbies and in game;
  • replays of every match;
  • a desktop version (native PHP) that joins the same rooms as the browsers.
Play online ↗

Controls

Keyboard

← → run
↑ look up, ↓ roll into a ball
Space jump
Enter menus and pause
Esc back to the title

Gamepad

D-pad or stick to run, A, B, X or Y to jump, Start for menus and pause, Select to go back to the title.

Phone

A d-pad on the left to run; on the right JUMP to jump and ROLL for the ball, START to pause and MENU for the title. Hold your phone in landscape.

▶ Play now

How it was made

Sonic PHP is written entirely in PHP: physics, objects, enemies, bosses, camera and bots. The levels, graphics and their colour cycles were decoded from the original cartridge, and the music was rendered by running the game's Z80 sound program in an emulator.

Here, the game is ported to the JumPHP engine: the same code runs in a window on a computer and in the browser, where PHP is compiled to WebAssembly. The game logic is the original; only display, sound, controls and saves go through JumPHP.

The code: sonic-jumphp (this version) and sonicGamePhp (the full version).

The title screen, with the logo and the START, MULTIPLAYER, OPTIONS, BEST TIMES menu
The title screen and its menus.

Questions

Do I need to install anything?

No: the game runs in your browser, on a computer or a phone. The first load downloads about 25 MB (PHP in WebAssembly, the levels, graphics and music), then everything is cached.

How is it different from the full version?

The full version adds online multiplayer for up to 6 players, rooms, chat and replays. This one is the same game ported to JumPHP, to play alone or against bots.

Are my times saved?

Yes: best times, ghosts and options stay in your browser.

Can I play outside the browser?

Yes, with JumPHP and Docker: bin/jumphp run sonic opens the game in a window, with sound. See the GitHub repository.