<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: mimi chat</title>
    <description>The latest articles on DEV Community by mimi chat (@mimi_chat_b3bf7a39a962a82).</description>
    <link>https://dev.to/mimi_chat_b3bf7a39a962a82</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4205435%2F98d46a60-aa6b-44b8-afe7-a98ea95ebe64.jpg</url>
      <title>DEV Community: mimi chat</title>
      <link>https://dev.to/mimi_chat_b3bf7a39a962a82</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mimi_chat_b3bf7a39a962a82"/>
    <language>en</language>
    <item>
      <title>PHP GAMES - Create and remix RETRO games, or build your own! PHP compiled to WebAssembly, running Sonic in the browser at 60 fps</title>
      <dc:creator>mimi chat</dc:creator>
      <pubDate>Thu, 29 Oct 2026 08:27:08 +0000</pubDate>
      <link>https://dev.to/mimi_chat_b3bf7a39a962a82/php-games-create-and-remix-retro-games-or-build-your-own-php-compiled-to-webassembly-running-320f</link>
      <guid>https://dev.to/mimi_chat_b3bf7a39a962a82/php-games-create-and-remix-retro-games-or-build-your-own-php-compiled-to-webassembly-running-320f</guid>
      <description>&lt;p&gt;Hi everyone,&lt;/p&gt;

&lt;p&gt;Yes, I know. PHP was built for request/response: a request comes in, a response goes out, then the process dies. A game needs a loop that runs 60 times per second, with input, audio, rendering and sometimes threads. That is pretty much the opposite.&lt;/p&gt;

&lt;p&gt;I wanted to see how far PHP could go anyway. The result is JumPHP: &lt;a href="https://jumphp.net/" rel="noopener noreferrer"&gt;https://jumphp.net/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's a platform for building games in pure PHP. Games are hosted automatically and run directly in the browser, on desktop and mobile.&lt;/p&gt;

&lt;p&gt;How it works under the hood&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One codebase, two targets. On desktop, it runs on PHP + SDL2 in a native window. In the browser, PHP is compiled to WebAssembly. The game code is the same for both.&lt;/li&gt;
&lt;li&gt;A real game loop. The engine calls update($dt) then render($r) around 60 times per second. Coordinates are virtual pixels, scaled to the screen.&lt;/li&gt;
&lt;li&gt;WebGL driven from PHP. 3D cubes and post-processing shaders (CRT, wave, 4-color palette).&lt;/li&gt;
&lt;li&gt;Threads in PHP. One demo renders a fractal with a pool of PHP threads (TrueAsync).&lt;/li&gt;
&lt;li&gt;A structure that will feel familiar. It looks a lot like a web framework:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;games//&lt;br&gt;
    config/game.yaml     # title, resolution (e.g. 320x180), first scene&lt;br&gt;
    config/input.yaml    # actions mapped to keyboard, gamepad, touch&lt;br&gt;
    src/Scene/&lt;em&gt;.php      # title screen, gameplay, pause...&lt;br&gt;
    src/Entity/&lt;/em&gt;.php     # player, enemies...&lt;br&gt;
    assets/              # sprites, sounds, music, levels&lt;/p&gt;

&lt;p&gt;If you've worked with Symfony or Laravel, you'll find your way around quickly.&lt;/p&gt;

&lt;p&gt;Four ways to make a game&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;From an Amstrad CPC disk image. Provide the .dsk file and the game is rebuilt in PHP. That's how the Rainbow Islands remake was made (7 islands, 28 rounds).&lt;/li&gt;
&lt;li&gt;From an open source game. Port C, Pascal or BASIC sources to PHP. Moktar runs on a PHP port of the OpenTitus engine with the original data files. Sapiens, a French adventure game from 1986, was ported from its GPL v3 C sources.&lt;/li&gt;
&lt;li&gt;From scratch, writing the code yourself.&lt;/li&gt;
&lt;li&gt;From a Claude prompt. Describe your game in a few sentences. Claude, connected to the platform through an MCP server, writes the PHP, tests it, builds the game's page and publishes it. The framework contract is documented in an AGENTS.md file in the repo.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;No lock-in: your game is your repo&lt;/p&gt;

&lt;p&gt;No lock-in: your game is your repo&lt;/p&gt;

&lt;p&gt;This is the part I care about most. Your game lives in a public GitHub repository under your account. Every push goes live in about a minute. You keep full control and can take your code wherever you want.&lt;/p&gt;

&lt;p&gt;I've done it with my own Sonic. It started as a Master System remake. Since then I've added multiplayer, ghosts, best times and races against AI runners.&lt;/p&gt;

&lt;p&gt;You can also fork any existing game and change it.&lt;/p&gt;

&lt;p&gt;Playable now, no account needed: Sonic PHP, Rainbow Islands, Moktar, Sapiens, Breakout, Pong (with online play), a 3D runner and a few tech demos.&lt;/p&gt;

&lt;p&gt;Coming soon: custom domains for your games.&lt;/p&gt;

&lt;p&gt;It works in any modern browser. Not IE6, sorry.&lt;/p&gt;

&lt;p&gt;Source code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Engine: &lt;a href="https://github.com/davidnurdin/jumPhp" rel="noopener noreferrer"&gt;https://github.com/davidnurdin/jumPhp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Platform: &lt;a href="https://github.com/davidnurdin/jumphp-playground" rel="noopener noreferrer"&gt;https://github.com/davidnurdin/jumphp-playground&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Three things I'd like your input on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PHP on WASM for real-time apps: is this a viable direction for the language, or a fun hack that should stay one? If you know the WASM or php-src internals well, I'd like your take on the architecture.&lt;/li&gt;
&lt;li&gt;The engine API: read the code and tell me what you'd design differently. Scenes and entities, input mapping, the update/render contract. Be honest.&lt;/li&gt;
&lt;li&gt;Testing: try to break it. Frame drops, mobile bugs, weird browser behavior, I want to hear about all of it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And if there's a retro game you'd like to see rebuilt in PHP, drop it in the comments.&lt;/p&gt;

&lt;p&gt;PS: please don't insult me too much.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://jumphp.net/" rel="noopener noreferrer"&gt;https://jumphp.net/&lt;/a&gt; : your PHP game studio.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foa6j8yihkxsbusmkpnnq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foa6j8yihkxsbusmkpnnq.png" alt=" " width="800" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>gamedev</category>
      <category>php</category>
      <category>webassembly</category>
    </item>
    <item>
      <title>Running a 21k-line PHP game at 60 fps in the browser with WebAssembly</title>
      <dc:creator>mimi chat</dc:creator>
      <pubDate>Sat, 24 Oct 2026 20:21:59 +0000</pubDate>
      <link>https://dev.to/mimi_chat_b3bf7a39a962a82/running-a-21k-line-php-game-at-60-fps-in-the-browser-with-webassembly-2cd3</link>
      <guid>https://dev.to/mimi_chat_b3bf7a39a962a82/running-a-21k-line-php-game-at-60-fps-in-the-browser-with-webassembly-2cd3</guid>
      <description>&lt;p&gt;I wanted to see how far PHP in WebAssembly could go. So I wrote a fan remake of &lt;strong&gt;Sonic the Hedgehog (Master System)&lt;/strong&gt; entirely in PHP, about 21k lines, and made it run both natively and in the browser.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Play it, no install: &lt;a href="https://sonic.mimichat.fr" rel="noopener noreferrer"&gt;https://sonic.mimichat.fr&lt;/a&gt;&lt;/strong&gt; (desktop and mobile)&lt;/p&gt;

&lt;h2&gt;
  
  
  How PHP runs in a browser
&lt;/h2&gt;

&lt;p&gt;PHP 8.3 is compiled to WebAssembly with Emscripten, together with an SDL2 extension for PHP. A small C glue starts PHP (&lt;code&gt;php_embed_init&lt;/code&gt;), runs the game, then plugs into the browser loop: on every &lt;code&gt;requestAnimationFrame&lt;/code&gt;, one tick of the game's ReactPHP event loop.&lt;/p&gt;

&lt;p&gt;The tricky part: ReactPHP's &lt;code&gt;Loop::run()&lt;/code&gt; is blocking, and a browser can't allow that. So the page queues a &lt;code&gt;futureTick&lt;/code&gt; that stops the loop right after its first turn, and the C glue then advances it one tick at a time. PHP is never shut down between frames (&lt;code&gt;php_embed_shutdown()&lt;/code&gt; is never called): every object and SDL resource stays in memory, the whole game state lives across frames.&lt;/p&gt;

&lt;p&gt;SDL2's Emscripten port renders to WebGL and plays sound through Web Audio. Saves go to IndexedDB (IDBFS).&lt;/p&gt;

&lt;p&gt;One lesson learned: use &lt;strong&gt;one&lt;/strong&gt; browser loop only. A second &lt;code&gt;setTimeout(0)&lt;/code&gt; loop ran the game between frames too, saturating the main thread so that input and audio came last.&lt;/p&gt;

&lt;h2&gt;
  
  
  Online multiplayer, up to 6 players
&lt;/h2&gt;

&lt;p&gt;Race, capture the flag, rings, deathmatch. Browsers talk directly over WebRTC; a relay written in PHP handles rooms and signaling, with coturn for difficult networks. A player on the native desktop version can join the same room through the relay. The network layer is its own library: php-wasm-network.&lt;/p&gt;

&lt;h2&gt;
  
  
  The website
&lt;/h2&gt;

&lt;p&gt;Symfony 8.1 on FrankenPHP: live rooms, stats, faithful replays of every game, and editors for levels, tiles (drawing and collisions), sprites, sounds and music. A published level is playable in the game right away. Visitors appear live as little Sonics running across the page, through Mercure subscription events.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Play: &lt;a href="https://sonic.mimichat.fr" rel="noopener noreferrer"&gt;https://sonic.mimichat.fr&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Build a level in the editor and play it in-game&lt;/li&gt;
&lt;li&gt;Create a private room and send the link to a friend&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Code: &lt;a href="https://github.com/davidnurdin/sonicGamePhp" rel="noopener noreferrer"&gt;sonicGamePhp&lt;/a&gt; (game), &lt;a href="https://github.com/davidnurdin/php-wasm-sdl" rel="noopener noreferrer"&gt;php-wasm-sdl&lt;/a&gt; (PHP + SDL in WASM), &lt;a href="https://github.com/davidnurdin/php-wasm-network" rel="noopener noreferrer"&gt;php-wasm-network&lt;/a&gt; (networking).&lt;/p&gt;

&lt;p&gt;It's a non-commercial fan project, Sonic belongs to SEGA. Questions about PHP in WASM are welcome in the comments!&lt;/p&gt;

</description>
      <category>php</category>
      <category>webassembly</category>
      <category>gamedev</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
