How bhdj0107/ldjmafia works
Project type and purpose
• This is a two-tier client-server game application (“Mafia Game”) written in Python.
• It uses SSL/TLS-wrapped sockets for secure communication.
• The client tier has a Qt-based GUI (login, lobby, room, game screens), and the server tier handles authentication, game logic, state management, and persistence.
File structure
• Top-level (Server side):
– main.py → server entrypoint, socket listener
– socketHandler.py → low-level SSL/TLS socket accept/send/recv
– mafiaProtocol.py → message framing & parsing rules
– mafiaRequest.py / mafiaResponse.py → request/response DTO definitions
– mafiaManagers.py → game logic, user/login state, role assignments
– id2nicknametable, logintable → simple flat files for user-ID to nickname & credentials
– samplecode/ → proof-of-concept SSL vs non-SSL socket tests
– requirements.txt → Python dependencies
• ClientSide/ (Client tier):
– main.py → client entrypoint, Qt application bootstrap
– main.spec → PyInstaller spec for building a standalone client
– *.ui → Qt Designer forms for loginForm, lobbyForm, roomForm
– mafiaProtocol.py, mafiaRequest.py, mafiaResponse.py → mirrored DTO & framing logic
– mafiaUi.py → glue between UI forms and application logic
– socketHandler.py → SSL/TLS socket wrapper for client
– roomTest.py, test.py, test2.py → unit/integration tests for client modules
– images/ → embedded assets used in the UI
README for additional insights
• The README is a slide deck of 31 pages showing the SSL/TLS handshake, message flows, client & server component interactions, and screen-by-screen UI flows.
• It confirms the layered breakdown: UI layer, application/request-response layer, network layer with SSL, and server-side game engine & persistence.
Detail
– Show the repro-usable protocol modules as a shared “contract” between tiers
– Capture how state flows through managers and back to the UI