Skip to content

alejaalvar/ASCIIlosaurus

Repository files navigation

ASCIIlosaurus

A multiplayer terminal game built on a UDP client/server architecture. Up to 10 players share a live 60x20 ASCII grid, moving their characters in real time while the server broadcasts world state to all connected clients.

    _    ____   ____ ___ ___
   / \  / ___| / ___|_ _|_ _|
  / _ \ \___ \| |    | | | |
 / ___ \ ___) || |___ | | | |
/_/   \_\____/  \____|___|___|
 _
| | ___  ___  __ _ _   _ _ __ _   _ ___
| |/ _ \/ __|/ _` | | | | '__| | | / __|
| | (_) \__ \ (_| | |_| | |  | |_| \__ \
|_|\___/|___/\__,_|\__,_|_|   \__,_|___/

Features

  • UDP-based networking — lightweight, low-latency communication
  • Up to 10 simultaneous players, each with a unique symbol (@, =, $, …)
  • Wrapping movement across the grid (walk off one edge, appear on the other)
  • Supports WASD, vim (hjkl), and arrow-key movement
  • ncurses rendering with ~30 FPS refresh rate
  • Verbose logging mode for debugging (-v)
  • Graceful shutdown on Ctrl+C or q

Requirements

Dependency Notes
GCC C99 or later
ncurses libncurses-dev on Debian/Ubuntu
POSIX make GNU Make works fine

Building

make

This produces two executables: ASCIIlosaurus_server and ASCIIlosaurus_client.

To clean build artifacts:

make clean

Usage

Server

./ASCIIlosaurus_server [-P port] [-v] [-h]

  -P <port>   Port to listen on (default: 10011)
  -v          Verbose logging to stderr
  -h          Print help and exit

Server console commands (type and press Enter while the server is running):

Key Action
q Quit the server
h Show help
k List client movement keys
l List connected clients

Client

./ASCIIlosaurus_client [-H host] [-P port] [-v] [-h]

  -H <host>   Server IP address (default: 131.252.208.23)
  -P <port>   Server port (default: 10011)
  -v          Verbose logging to stderr
  -h          Print help and exit

Movement Keys

Key(s) Direction
w / k / Up
s / j / Down
a / h / Left
d / l / Right
q Quit

Quick Start (local machine)

# Terminal 1 — start the server
./ASCIIlosaurus_server -v

# Terminal 2 — connect a client (loopback)
./ASCIIlosaurus_client -H 127.0.0.1

Open additional terminals and run more clients to play with others.

Project Structure

ASCIIlosaurus/
├── ASCIIlosaurus_server.c   # UDP server — manages world state & player positions
├── ASCIIlosaurus_client.c   # UDP client — sends input, receives & renders state
├── ASCIIlosaurus_world.c    # ncurses UI helpers (draw_world, get_input, …)
├── ASCIIlosaurus_world.h    # Shared protocol types (player_t, world_state_t)
└── Makefile

Protocol Overview

All communication uses UDP datagrams on a single port.

  • Client → Server: a single int (network byte order) carrying the pressed key code.
  • Server → Client: a world_state_t struct (network byte order) containing the full grid state and each player's position, symbol, and active flag.

The server serializes coordinates with htonl before sending and the client deserializes with ntohl on receipt, making the protocol endian-safe.

License

MIT — see LICENSE.

About

ASCIIlosaurus — A UDP-based multiplayer terminal game for CS333 (Portland State, Winter 2026). Multiple clients roam a toroidal 60×20 grid rendered with ncurses. The server maintains world state and broadcasts updates to all connected clients in real-time. Built in C with poll()/select(), sigaction, and network byte-order handling.

Topics

Resources

License

Stars

Watchers

Forks

Contributors