piweb

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 4 Imported by: 0

README ¶

piweb

Pi backend for web browsers.

A replacement for piebiten and Ebitengine.

Play the Snake game in the browser


🎯 Project Goals

The aim of this project is to create a new backend for Pi games that runs efficiently in modern web browsers and offers significant improvements over the standard piebiten backend:

📦 Smaller Binary Size
  • At least 2× smaller .wasm output
🔊 Better Audio
  • Minimal latency — as low as 20 ms (compared to 60 ms in piebiten)
  • Glitch-free playback — thanks to audio processing in a high-priority, separate audio thread

🧪 How It Works

These improvements are possible thanks to:

  • Audio Worklet API – the browser-native API for real-time, low-latency audio processing
  • SharedArrayBuffer - a high-performance way to exchange data between the main thread and audio processor in the browser.
  • Writing the code directly in JavaScript
  • Reducing the number of dependencies

🚧 Status

The project is ready to use. Most features are ready. Some platforms are not supported yet though:

  • graphics rendering using Canvas2D
  • keyboard support
  • gamepad support
  • mouse support
  • debug mode support
  • desktop web browsers - Chrome, Firefox, Edge, Safari etc.
  • mobile web browsers - virtual keyboard and gamepad support
  • audio support
  • 3x smaller WASM binary - Snake game is 3 MB (0.9 MB after gzip) instead of 10 MB
  • customizable template - developer can change all static files - HTML, CSS, JS etc.
  • works on itch.io and newgrounds.com
  • embedded HTTP server for rapid development
  • ability to release ZIP file
    • with embedded HTTP server
    • with CLI
  • documentation
  • automated tests

Documentation ¶

Index ¶

Constants ¶

This section is empty.

Variables ¶

View Source
var (
	GoBuild        = "go build -buildvcs=false -o {{.Output}} ." // executed on each webpage refresh.
	ReleaseGoBuild = "go build -o {{.Output}} ."                 // executed when creating release build.
)

go build commands

View Source
var HtmlDir = "." // change if you want to store html/javascript/css files in different directory than working one.

Functions ¶

func Run ¶

func Run()

Types ¶

This section is empty.

Directories ¶

Path Synopsis
Example of using the high-level audio API in Pi.
Example of using the high-level audio API in Pi.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL