Web

Mario in Python

WebAssembly Pygame Port

Pygame platformer ported to WebAssembly via Pygbag and deployed on GitHub Pages, with mobile touch D-pad, SharedArrayBuffer COOP/COEP fix, async game loop rewrite, and a Windows EXE build.

Mario in Python interface
  • Zero-install play in browser, shareable via URL
  • Mobile touch D-pad with keyboard event bridge
  • Windows EXE packaged for offline distribution

Problem and approach

The problem

Pygame games run locally only, no way to share a playable demo without asking people to install Python.

The approach

Rewrote the blocking game loop to async/await for Pygbag WASM, fixed COOP/COEP headers with coi-serviceworker.js, added mobile touch D-pad overlay with keyboard event bridge.

Full Mario-style platformer playable in browser via WebAssembly. Also ships as a Windows EXE via PyInstaller. Mobile touch controls overlay runs on any device.

Architecture

How data moves through the system. Select a step to see why it’s there.

Step 01

Game loop

Rewritten from a blocking loop to async/await.

Pygame

Results

  • Zero-install play in browser, shareable via URL
  • Mobile touch D-pad with keyboard event bridge
  • Windows EXE packaged for offline distribution

The Business Case

The same project, read the way a product owner would

Before

Pygame games run locally only, no way to share a playable demo without asking people to install Python.

What changed

Rewrote the blocking game loop to async/await for Pygbag WASM, fixed COOP/COEP headers with coi-serviceworker.js, added mobile touch D-pad overlay with keyboard event bridge.

After

Zero-install play in browser, shareable via URL

Value levers

Lower operating costLess manual effort for each unit of output

Stack

PythonPygamePygbagWebAssemblyGitHub Pages