How mogara/qsanguosha works
QSanguosha is a Qt-based online implementation of the Sanguosha board game. A player enters through the desktop application, joins a lobby or room, and plays through client/server messages that drive game state and present prompts, cards, and logs. The engine supplies shared game definitions, including packages, scenarios, cards, and Lua-backed extensions; server-side rules and AI support game execution. The README documents audio, font rendering, and Lua extension support. Some subsystem links are inferred from documented roles and the file tree because the sampled source is partial.
Main entry points: client.cpp Game client · engine.cpp Game engine · main.cpp Application startup · server.cpp Network server
Components 18
Application and UI
- Application startup
src/main.cpp - Main window
src/dialog/mainwindow.cpp - Game interface
src/ui/roomscene.cpp - Game log
src/ui/clientlogbox.cpp
Game definitions
- Game engine
src/core/engine.cpp - Cards and skills
src/core/card.cpp - Game packages
src/package/package.cpp - Scenarios
src/scenario/scenario.cpp
Online play
- Game client
src/client/client.cpp - Network server
src/server/server.cpp - Game room
src/server/room.cpp - Game rules and AI
src/server/gamerule.cpp - Message protocol
src/core/protocol.cpp
Runtime integrations
- Lua runtime
src/lua/lua.c - Audio service
src/core/audio.cpp - Wi-Fi discovery
src/util/wifimanager.cpp - Crash reporting
src/breakpad/client/linux/handler/exception_handler.cc
Other components
- Player
Connections 20
- Player → Application startup: launches
- Application startup → Main window: creates
- Application startup → Audio service: initializes
- Player → Main window: uses
- Main window → Game client: starts play
- Game client → Message protocol: encodes messages
- Network server → Message protocol: parses messages
- Game client → Network server: sends packets
- Network server → Game client: notifies
- Network server → Game room: dispatches room packets
- Game room → Game rules and AI: applies rules
- Game client → Game interface: updates interface
- Game client → Game log: delivers logs
- Game log → Game engine: looks up cards
- Game engine → Cards and skills: manages definitions
- Game engine → Game packages: registers packages
- Game engine → Scenarios: registers scenarios
- Game engine → Lua runtime: uses scripting
- Main window → Wi-Fi discovery: discovers servers
- Application startup → Crash reporting: uses crash handling