TCP Multiplayer Game
Systems Programming • 2025 • Course Project
Overview
A concurrent TCP server in C that hosts rock-paper-scissors games between remote players with support for rematches, requeueing, and process-based concurrency.
Role: Systems Programmer
Tools: C, TCP Sockets, fork(), Linux
Problem
Build a multiplayer game server capable of hosting real-time rock-paper-scissors games between clients, with proper concurrency, rematch support, and graceful handling of quit/rejoin behavior. The challenge was to maintain a smooth and responsive experience despite unreliable clients, competing rematch logic, and race conditions from forking processes.
My Approach
- Matchmaking Engine: Implemented a two-slot matching system to track connected players and fork new child processes for each game
- Game Protocol: Designed and enforced a message-passing protocol for JOIN, PLAY, QUIT, CONTINUE, and RESULT exchanges
- Rematch Logic: Built a requeue system to store players who choose to rematch and pair them with new opponents
- Disconnection Handling: Added logic to detect when a player quits mid-game, ensuring the remaining player is correctly requeued or exited
- Testing: Simulated game rounds using rc and gc clients to debug edge cases and validate protocol compliance
Final Build
Developed in C using TCP sockets and fork() for concurrent game sessions Fully supports game state tracking, valid rematch cycles, quit behavior, and malformed input handling Passed all course test cases, including complex quit/requeue edge conditions

Reflection
This project pushed me to deeply understand concurrency, networking, and lifecycle management in Unix. Debugging zombie processes and socket reuse taught me the importance of careful process cleanup and player state tracking. I’m proud of implementing full rematch and requeue support without race conditions—this was my most technically complex C project to date.