A multiplayer 3D tank battle game written in C for the WASM-4 fantasy console. Features real-time 3D rendering and netplay support for up to 4 players.
You can give it a try here: Tank Wars.
- Arrow Keys: Navigate menus and select options
- X Button: Confirm selections and start game
- Z Button: Go back to previous menu
- Arrow Keys: Move tank forward/backward and turn left/right
- Z Button: Precise turning (slower rotation)
- X Button: Fire projectiles (3-second cooldown)
- WASI SDK - Download and set
WASI_SDK_PATHenvironment variable - WASM-4 CLI - Install the
w4command
Build the game:
makeRun the game:
w4 run build/cart.wasmRun with live reload during development:
w4 watchClean build artifacts:
make cleanRun code linting:
make lintsrc/
├── main.c # Main game loop and core logic
├── menu.c/h # Menu system and UI
├── render.c/h # 3D rendering pipeline
├── object.c/h # Game object management
├── models.c/h # 3D model definitions
├── draw.c/h # Drawing utilities
├── io.c # Input/output handling
└── wasm4.h # WASM-4 API definitions
- Debug build:
make DEBUG=1- Includes debug symbols and optimizations disabled - Release build:
make(default) - Optimized for size and performance
- Main Menu: Select "New Game" or "Help"
- Player Selection: Choose 2-4 players for the match
- Battle: Players spawn in different corners of the arena
- Objective: Hit other tanks with projectiles to score points
- Victory: First player to reach 10 points wins
- Return: Game automatically returns to menu after victory screen
The game supports WASM-4's built-in netplay system for 2-4 players.
- Engine: Custom 3D rendering engine with matrix transformations
- Graphics: 160x160 pixel display with 4-color palette
- Performance: 60 FPS target with optimized polygon rendering
- Memory: Fits within WASM-4's 64KB memory limit
- Audio: Uses WASM-4's tone generator for sound effects
- WASM-4 Documentation: Learn more about the fantasy console
- WASM-4 GitHub: Platform source code and issues