UNO — Multiplayer Client-Server Game
Multiplayer UNO over TCP sockets with an encrypted wire protocol
Overview
A complete multiplayer UNO built from scratch on a client-server architecture over raw TCP sockets — no game engine, no networking library. A multithreaded server hosts several simultaneous game rooms, each ClientHandler running on its own thread, while ObjectInputStream/ObjectOutputStream exchange a custom serializable Message protocol (LOGIN, LOBBY_UPDATE, PLAY_CARD, UPDATE_STATE, GAME_OVER…) carrying turns, card effects (Skip, Reverse, +2) and the UNO penalty rule. The Swing UI runs custom-drawn components (GameButton, CardButton) with a dark theme and in-room chat. I later audited the traffic with Wireshark, found the protocol traveling in plain text, and closed the gap by wrapping every message in AES/CBC/PKCS5 encryption with a persisted key — then re-captured traffic to verify it was no longer readable. The repo also documents a RBAC role schema (Player/Premium/Moderator/Admin) sketched out for scaling the game into a larger service.
Highlights
- Client-server architecture over raw TCP sockets (java.net.Socket/ServerSocket) — chosen over UDP for guaranteed, ordered, lossless delivery of game state
- Multithreaded server: main thread only accepts connections, each client is handled on its own thread via a Runnable ClientHandler, so one slow client never blocks the rest
- Custom typed protocol: a Serializable Message class (enum type + data map) sent through ObjectOutputStream/ObjectInputStream, avoiding fragile hand-parsed text
- Found the wire protocol traveling in plain text via a Wireshark capture, then closed it: AES-128/CBC/PKCS5 encryption over every message, key persisted in a gitignored .secret file, re-verified with a second capture
- SOLID refactor of the server into specialized handlers (GameMessageHandler, GameRoomBroadcaster, GameStateUpdateHandler) instead of one monolithic class
- Custom Swing UI (GameButton, CardButton) with a dark theme and real-time in-room chat; designed an RBAC role schema (Player/Premium/Moderator/Admin) for scaling beyond the current single-role model