한국어 | English
A sample framework for building and experimenting with game server architecture. This repository combines C# service servers, native C++ game logic and engine libraries, Python data-generation tools, a Unity client, and FlatBuffers/Protobuf protocol definitions in one Visual Studio solution.
The current codebase is organized around Windows and Visual Studio 2022. Most production-style services target .NET Core 3.1, while the native game stack uses MSBuild C++ projects with the v143 toolset.
| Area | Projects |
|---|---|
| Service servers | Battle, Lobby, Login, Chat, Cache, IAP, RESTful |
| Operations tools | GmTool, Laboratory, ReadOnlyAnalyzerLib |
| Native game stack | Game, Engine, BehaviorTree, FiniteStateMachine, GameDataProtobuf, recastnavigation |
| Data tooling | GameData, GameDataFlow, SqlCodeGenerator, Models, Schemas |
| Protocols | flatbuffer, protos |
| Client | Client Unity project |
| Path | Purpose | Runtime |
|---|---|---|
| Battle/ | In-game movement, skill, and state synchronization server | .NET Core 3.1 |
| Lobby/ | Lobby, matching, sessions, OAuth, and game result handling | .NET Core 3.1 |
| Login/ | ASP.NET Core login web/API server | .NET Core 3.1 |
| Chat/ | Chat service server | .NET 5 |
| Cache/ | Redis-backed cache and subscription modules | .NET Core 3.1 |
| IAP/ | Google Play and App Store receipt validation modules | .NET Core 3.1 |
| GmTool/ | GM and operations tool | .NET Core 3.1 |
| RESTful/ | External REST API client/integration code | .NET Core 3.1 |
| Path | Purpose | Type |
|---|---|---|
| Game/ | Actor, player, monster, skill, map, world, DB, Lua, and behavior-tree integration | C++ Application |
| Engine/ | ECS, GridManager, RingBuffer, timestamp, and random utilities | C++ Static Library |
| BehaviorTree/ | Custom behavior tree implementation and optimized/event variants | C++ Static Library |
| FiniteStateMachine/ | Finite state machine examples and base structure | C++ Static Library |
| GameDataProtobuf/ | Generated game-data Protobuf loader and native bindings | C++ Static Library |
| recastnavigation/ | Recast/Detour navigation mesh and pathfinding code | C++ Static Library |
| UnitTest/ | Native tests for engine/data-structure code | C++ Application |
| Path | Purpose |
|---|---|
| GameData/ | Source game data such as item.json, skill.json, quest.json, Map.json, and GameMode.json |
| GameDataFlow/ | Python pipeline that generates Protobuf data and C++/C# factory code |
| SqlCodeGenerator/ | XML-schema-based DAO and SQL generator |
| Models/ | Shared database models and extension models |
| flatbuffer/ | syncnet.fbs, bundled flatc.exe, and FlatBuffers 1.12 libraries |
| protos/ | gRPC/Protobuf definitions including chat.proto, lobby.proto, and dummycontrol.proto |
| Client/ | Unity client project using Unity 2020.3.32f1 |
- Windows
- Visual Studio 2022 Community
- MSBuild v143 C++ toolset
- C++20 for the main native projects
- .NET Core 3.1, .NET 5, and a small .NET 9 laboratory project
- Unity 2020.3.32f1
- Python 3.x
- Redis and MySQL/MariaDB for server-side runtime configuration
Additional build notes are in BUILD_ENVIRONMENT.md.
Use the Visual Studio MSBuild executable instead of dotnet msbuild, because the solution contains C++ projects.
& "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\MSBuild.exe" GameServerFramework.sln /t:Game /p:Configuration=Debug /p:Platform=x64 /v:minimalExpected output:
x64\Debug\Game.exe
Run C# services with dotnet run from the repository root:
dotnet run --project Battle\Battle.csproj
dotnet run --project Lobby\Lobby.csproj
dotnet run --project Login\Login.csproj
dotnet run --project Chat\Chat.csprojService configuration lives in files such as appsettings.json, appsettings.Release.json, *.service, and Credentials/.
Login provides the web/API entry point for authentication. Lobby handles sessions, OAuth providers, matching, and game result processing. It references core, GameData, GameService, and Models, and uses Redis and database-backed models for state.
Battle links shared network code from the Unity client and focuses on in-game input, movement, skill, and state synchronization.
The native runtime logic is in Game: Actor, Player, Monster, Skill, World, Map, NavMap, SqlClient, and BTDebugManager. It references Engine, BehaviorTree, GameDataProtobuf, and recastnavigation.
Source data is stored as JSON under GameData/. GameDataFlow/ generates Python, C++, and C# Protobuf outputs from gamedata.proto.
cd GameDataFlow
.\build.batGenerated outputs include:
GameDataFlow/gamedata_pb2.pyGameDataProtobuf/Client/Assets/Scripts/GameData/
Runtime sync messages are defined in flatbuffer/syncnet.fbs.
cd flatbuffer
.\flatc.batIf direct generation into target folders fails, generate inside flatbuffer first and then copy the generated files as described in BUILD_ENVIRONMENT.md.
- gRPC / Protocol Buffers
- FlatBuffers 1.12
- Recast/Detour
- Redis / StackExchange.Redis
- Entity Framework Core
- MySQL/MariaDB Connector
- Boost 1.87
- LuaJIT
- nlohmann.json
- spdlog
- Unity Ads, Analytics, Purchasing
- The root solution is GameServerFramework.sln.
- Native projects primarily use
Debug|x64andRelease|x64. - When adding generated C# files to Unity, add matching
.metafiles with unique GUIDs. - Database schema and initialization SQL live under Schemas/.
- If Git reports dubious ownership in a sandboxed shell, use:
git -c safe.directory=D:/projects/GameServerFramework status --short