o
odin.langpkg.dev
packages / app / natrinet

natrinet

e87c137app

TetriNET 2-inspired multiplayer Tetris game built with Odin and Raylib

No license · updated 5 months ago

Natrinet

A TetriNET 2-inspired multiplayer Tetris game built with Odin and Raylib.

Features

  • Full TetriNET 2 gameplay with all special blocks (Add Line, Nuke, Gravity, etc.)
  • 6-player multiplayer support
  • Standalone server (runs in Docker or locally)
  • Windows client with modern graphics via Raylib
  • TDD-focused development with comprehensive test suite

Project Structure

natrinet/
├── client/          # Raylib-based graphical client
├── server/          # Headless game server
├── shared/          # Common code (protocol, game types)
├── tests/           # Unit and integration tests
├── .claude/         # Claude Code configuration
│   ├── commands/    # Slash commands (/test, /build, etc.)
│   └── agents/      # Domain-specific subagents
├── build.bat        # Windows build script
├── build.sh         # Linux/Mac build script
└── docker-compose.yml

Prerequisites

  • Odin compiler (dev branch recommended)
  • Raylib 5.0+ (for client)
  • Docker (optional, for server deployment)

Quick Start

Building

# Windows
build.bat all debug

# Linux/Mac
./build.sh all debug

Running Locally

# Terminal 1: Start server
./build/natrinet-server --port 31457 --debug

# Terminal 2: Start client
./build/natrinet-client --server localhost:31457 --name "Player1"

Running with Docker

# Build and start server
docker-compose up -d natrinet-server

# Connect client
./build/natrinet-client --server localhost:31457

Development

This project uses Claude Code for AI-assisted development. Key commands:

  • /test - Run test suite
  • /build - Compile client and server
  • /run-server - Start the game server
  • /run-client - Start the game client
  • /lint - Check code quality

Test-Driven Development

Write tests first:

@(test)
test_piece_rotation :: proc(t: ^testing.T) {
    piece := create_piece(.T)
    rotated := rotate_cw(piece)
    testing.expect_value(t, rotated.rotation, 1)
}

Then implement:

odin test tests/unit

Controls

Key Action
←/→ Move piece
Rotate clockwise
Z Rotate counter-clockwise
Soft drop
Space Hard drop
C Hold piece
1-6 Use special on player
Enter Send chat
Esc Menu / Quit

Special Blocks

Block Name Effect
A Add Line Adds garbage line to opponent
C Clear Line Clears your bottom line
N Nuke Clears your entire field
R Random Clear Clears 10 random blocks
S Switch Swaps fields with opponent
B Block Bomb Explodes surrounding blocks
G Gravity All blocks fall down
Q Quake Shifts lines randomly
O Block Quake Scatters blocks

License

MIT