A C++ multiplayer room battle architecture that separates the server-authoritative game logic from the Unreal Engine presentation layer.
- Implements a WinSock-based TCP command server and console client for account, matchmaking, session, game action, and state query flows.
- Abstracts game modes through
IGameMode,GameModeFactory, andBattleRoom, allowing different room modes such as strategy battle and racing duel to share the same session layer. - Runs server-authoritative room logic with a fixed 60 Hz tick, including unit movement, attack, healing, resources, cooldowns, and win/loss detection.
- Uses a matchmaking thread to group players by requested mode and score, create battle rooms, and clean up disconnected sessions.
- Persists users, battle records, session records, scores, wins, and losses through MySQL, with transactional updates for match results.
- Broadcasts
UESTATEsnapshots through UDP so Unreal Engine can render actors, positions, teams, health bars, and base state without owning core game logic.
Server1/ C++ WinSock server, matchmaking, room runtime, MySQL persistence
Client1/ C++ console client and command protocol integration
UE_MyProject/ Unreal Engine C++ state reader and UDP-driven presentation sync
The server reads MySQL settings from environment variables:
GAME_DB_HOST
GAME_DB_USER
GAME_DB_PASSWORD
GAME_DB_NAME
GAME_DB_PORT
If not provided, the server uses local development defaults: 127.0.0.1, root, empty password, game_db, and 3306.