Project
Treasure Hunt
Multiplayer game simulation inspired by a “treasure hunt”, developed in C using a TCP client–server architecture.
The system is designed to support multiple players simultaneously, coordinating their interactions and maintaining a centralized game state in a distributed environment.
The server acts as the core game engine. It accepts multiple client connections and manages each player concurrently through POSIX threads (pthreads). Each client represents a player who must authenticate before joining the game session, simulating access to a shared multiplayer environment. Player credentials are stored in a configuration file and verified by the server upon connection.
Once authenticated, players interact with the game by sending textual commands that represent in-game actions. The server processes these commands, updates the global game state, and ensures consistency across all connected players. Shared resources are protected using mutex-based synchronization, preventing race conditions and guaranteeing correct behavior in a concurrent setting.
The project simulates key dynamics of a multiplayer treasure hunt, such as simultaneous player presence, concurrent action execution, and coordinated interaction within a shared game space. Although the interface is entirely text-based, the system is structured to model a real distributed game logic, where multiple players participate in the same session and influence the overall game state.
A persistent logging system records all significant events, including player logins, disconnections, game actions, and error conditions. Each event is timestamped and written to a log file, enabling post-execution analysis of both player behavior and server activity.
From a systems perspective, the project demonstrates effective use of low-level network programming, multithreading, signal handling (such as managing SIGPIPE to prevent server crashes due to unexpected client disconnections), and file-based persistence. Build and execution scripts are included to automate compilation and simplify deployment in a local environment.