← projects

TRON — Network Game

Team of 4 · 2023

PythonPygameTCP socketsClient-ServerLinux

GitHub

Overview

My first networked game, written on Linux: a multiplayer TRON light-cycle game after the 1982 film. Ride your bike, leave a solid trail behind you, and avoid every trail, including your own, plus the walls of the arena. Last driver alive wins.

The main menu artwork: a neon light-cycle in a synthwave city
The main menu.

Client and server, four players

One machine runs server.py and owns the truth. It holds the grid, applies every player’s direction change on its own tick, resolves collisions, and broadcasts the resulting state. The clients run client.py: they draw, they send input, and they never decide who died. Players join over the local network, wait together in a lobby until the room fills, and get a colour assigned on connection. Underneath it is a plain TCP socket per player, the same building block I used to wire a Python signal pipeline into Unity on 2D-EMG-GAME.

The waiting-room screen
The lobby, while the room fills up.
The arena backdrop
The arena backdrop.
The four player light-cycles
The four light-cycles, one per seat in the room.

What it taught me

Sockets, mostly. Also that a render loop and a network loop do not want to run at the same speed. And the rule everything after it depends on: authority lives in exactly one place, and that place is never the client.

Local network only, so not internet-playable. Built with Wu Yedong, Keith Udani and Antoine Martinet. There is a video walkthrough linked from the GitHub README.