MCPcopy Index your code
hub / github.com/aduros/wasm4

github.com/aduros/wasm4 @v2.7.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.7.1 ↗ · + Follow
677 symbols 1,314 edges 117 files 45 documented · 7%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

WASM-4 Logo WASM-4

Build retro games using WebAssembly for a fantasy console

WebsiteShowcaseDocsDiscussions

About

WASM-4 is a low-level fantasy game console for building small games with WebAssembly. Game cartridges (ROMs) are small, self-contained .wasm files that can be built with any programming language that compiles to WebAssembly.

Key Features

  • No Glue Code: If you've ever tried to write even a simple "Hello World" with WebAssembly before, you'll know it usually involves writing a bunch of JS and HTML glue. WASM-4 removes all of that, games interface directly with the system through a small API.

  • Minimalist: Fantasy consoles force developers to work with limited resources. This makes them simple to learn, and easier to focus on finishing your game.

  • Language Agnostic: Use any programming language, as long as it can compile to WebAssembly. Out of the box we currently support: AssemblyScript, C/C++, D, Go, Nelua, Nim, Odin, Rust, WAT, and Zig.

  • Portable: WASM-4 is designed to run on any device that can execute WebAssembly, even outside of the web! It includes a lightweight runtime written in C that runs even low-powered microcontrollers and obsolete hardware.

  • Netplay: Instant online multiplayer, featuring rollback netcode. All games that support local multiplayer automatically support netplay. WASM-4 handles syncing controller inputs over the Internet.

🚀 60 Second Quickstart

# Install the w4 command
npm install -g wasm4

# Create a project
w4 new --assemblyscript hello-world

# Setup toolchain
cd hello-world
npm install

# Build and run your game!
npm run build
w4 run build/cart.wasm

For more info and guides, check the full documentation.

🎮 Hardware Specs

  • Display: 160x160 pixels, 4 customizable colors, updated at 60 Hz.
  • Memory: 64 KB linear RAM, memory-mapped I/O, save states.
  • Cartridge Size Limit: 64 KB.
  • Input: Keyboard, mouse, touchscreen, up to 4 gamepads.
  • Audio: 2 pulse wave channels, 1 triangle wave channel, 1 noise channel.
  • Disk Storage: 1024 bytes.

🙏 Contributing

Contributions are welcome! Here are just a few ways to help:

  • Build a game or experiment, we'll feature it on wasm4.org!
  • Improve our documentation or write a tutorial.
  • Submit a bug report or feature request on Github.
  • Answer questions on the discussions forum.
  • Implement support for a new tool or language.
  • Give the project a star on Github for visibility.

Extension points exported contracts — how you extend this code

Draw (Interface)
(no doc) [3 implementers]
examples/pong/src/geometry.rs
AudioWorkletProcessorImpl (Interface)
(no doc) [1 implementers]
runtimes/web/src/audioworklet.d.ts
BufferedData (Interface)
(no doc) [1 implementers]
devtools/web/src/devtools-manager.ts
Collide (Interface)
(no doc) [1 implementers]
examples/pong/src/geometry.rs
AudioWorkletProcessor (Interface)
(no doc)
runtimes/web/src/audioworklet.d.ts
MemoryViewComputedProperties (Interface)
(no doc) [1 implementers]
devtools/web/src/models/MemoryView.ts
Move (Interface)
(no doc) [1 implementers]
examples/pong/src/geometry.rs
AudioWorkletProcessorConstructor (Interface)
(no doc)
runtimes/web/src/audioworklet.d.ts

Core symbols most depended-on inside this repo

text
called by 20
examples/pong/src/wasm4.rs
show
called by 17
runtimes/web/src/ui/notifications.ts
createFuncType
called by 17
runtimes/native/src/backend/wasm_wasmer.c
send
called by 16
runtimes/web/src/netplay/peer-manager.ts
join
called by 15
runtimes/web/src/netplay/index.ts
bounds_check
called by 12
runtimes/native/src/runtime.c
getMemoryPointer
called by 12
runtimes/native/src/backend/wasm_wasmer.c
drawControl
called by 11
examples/sound-demo/src/main.c

Shape

Function 318
Method 213
Class 112
Interface 31
Enum 3

Languages

TypeScript58%
C31%
Rust8%
Go2%
C++1%

Modules by API surface

runtimes/native/src/backend/main_libretro.c44 symbols
runtimes/web/src/runtime.ts36 symbols
examples/snake/src/main.ts32 symbols
runtimes/web/src/ui/app.ts30 symbols
runtimes/native/src/runtime.c29 symbols
runtimes/native/src/backend/wasm_wasmer.c25 symbols
runtimes/web/src/netplay/index.ts23 symbols
runtimes/native/src/backend/wasm_toywasm.c20 symbols
examples/pong/src/pong.rs18 symbols
runtimes/native/src/framebuffer.c17 symbols
runtimes/web/src/framebuffer.ts15 symbols
runtimes/web/src/ui/menu-overlay.ts14 symbols

For agents

$ claude mcp add wasm4 \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact