A small networked maze game in Java 17 and JavaFX, built as coursework for Distribuerede Informationssystemer (3rd semester, Datamatiker, autumn 2024). The goal of the assignment was to practise sockets, threads and synchronisation.
Players move around a shared maze and shoot each other; every client renders the same game state.
Serveraccepts TCP connections on port 6789 and starts oneServerThreadper client.ServerThreadreads commands from its client and hands them toServer.broadcast, which relays each command to every connected client. Clients apply commands locally (MOVE,CONNECT,DISCONNECT,PEWPEW, …).GUI/Appis the JavaFX client.
- The client list is a
CopyOnWriteArrayList; additions, removals and broadcasts are serialised on theServerclass lock, so every client receives messages in the same order. broadcastonly enqueues each message. Each client has its own outbound queue drained by a writer thread, so one slow or stalled client cannot block the others.- A disconnect (EOF, read error or write error) closes the socket and removes the client exactly once.
Open in IntelliJ (JavaFX SDK required), run game2024.Server, then start one game2024.App per player and enter the server's IP.
+1 per move and −1 for walking into a wall. Walking into another player gives you +10 and them −10. Shooting someone is worth +50, and they lose 50 and respawn.