Offline

Python Games in the Browser: Teaching with WebAssembly

Track:
Community Building, Education, Outreach
Type:
Talk
Level:
intermediate
Duration:
30 minutes
View in the schedule

Abstract

This talk explores how Python games can run entirely in the browser using WebAssembly (WASM) and how they can also be written and modified directly in the browser using Python itself.

Rather than treating the browser as a mere deployment target, this talk presents it as the primary learning environment. Learners interact with a browser-embedded code editor where they write Python code that directly controls and modifies a game, which is also implemented in Python. This creates a zero-install, highly interactive learning experience where Python concepts are introduced through familiar game mechanics instead of traditional REPLs or slide-based instruction.

The focus of this talk is not on building a game engine, but on how educators and instructors can leverage WASM to safely run Python in the browser for teaching purposes. The talk introduces a tool I built that enables instructors to design browser-based Python tutorials using common game concepts such as scenery, sprites, and swatches, making it easier to create engaging, game-driven learning content.

The talk covers:

  • How Python can be executed in the browser using WebAssembly
  • A comparison of Pyodide vs. pyscript, highlighting their benefits and limitations in educational contexts
  • How browser-based execution changes assumptions around security, isolation, and infrastructure In the latter part of the talk, this approach is packaged as an XBlock, the modular unit used to build courses in Open edX. This demonstrates how WASM-based Python execution can be integrated into large-scale learning platforms and how it compares to traditional server-side execution models such as CodeJail, highlighting improvements in safety, reduced infrastructure complexity, and an improved learner experience.

WebAssembly enables a new class of interactive, game-based Python learning experiences that run securely and entirely in the browser, without requiring local setup or server-side code execution.