atsf4g-co Documentation
atsf4g-co (AT Service Framework for Game - Coroutine) is a coroutine-based game server framework built on top of
the atframework component family (atframe_utils, libatbus, libatapp,
libcopp). It uses C++17 (with C++20/C++23 features when available) and targets scalable, high-performance game
server architectures.
Core Features
- Coroutine-based async model: single-process, single-thread event loop (libuv) + coroutine tasks (libcopp cotask or C++20 coroutines). All business concurrency is carried by task actions — no more callback hell.
- Declarative RPC and code generation: protobuf is the single source of truth for protocols. Custom extension options + Mako templates generate RPC caller APIs, dispatch handlers, task action skeletons, database access layers, and config loading code in bulk.
- Built-in infrastructure: atgateway (client gateway with ECDH handshake / encryption / rate limiting), atproxy (cross-service proxy with etcd service discovery), router object caching, Redis data layer, and OpenTelemetry observability.
- Reusable components: distributed message queue (dtmq), distributed transactions (2PC), rank boards, Orbit, and more — ready-to-use service components plus client SDKs.
- Cloud-native deployment: three deployment forms — Helm chart / Docker / bare-metal scripts — generated by
rendering
install/**/*.tpltemplates with atdtool.
Documentation Map
| Section | Content |
|---|---|
| Getting Started | Environment setup, build, run, and deploy |
| Architecture | Component relationships, message flow, dispatcher / RPC / router / data layer / configuration / observability |
| Components | dtmq, distributed transaction, rank board, Orbit |
| Services | Business services and the stress-test robot |
| Development | Adding a service, adding RPCs, database tables, Excel config, unit tests |
Repository Layout at a Glance
atsf4g-co/
├── atframework/ # vendored framework libraries (atframe_utils / libatbus / libatapp / atproxy / atgateway)
├── src/
│ ├── server_frame/ # shared server framework: config / dispatcher / router / rpc / data / logic / utility
│ ├── *svr/ # business services: echosvr, authsvr, cachesvr, lobbysvr, rank_settlement_svr, orbitsvr
│ ├── component/ # reusable components: dtmq, distributed_transaction, rank, orbit, GameSharedComponent
│ ├── templates/ # Mako code generation templates
│ ├── tools/ # generate-for-pb code generator, etcd debug tools
│ └── robot/ # Go stress-test robot
├── install/ # deployment templates (Helm chart + Go text/template)
├── resource/ # Excel design config tables and xresloader configuration
├── project/ # CMake build options and tooling
└── third_party/ # third-party dependencies (prebuilt packages, atdtool, xresloader, etc.)