Files
AIGame/AIServer/README.md
T
udxandCursor c94b8fefeb Add MainHUD gameplay UI, net handshake updates, and server maintenance mode.
Introduce UiManager/MainHUD prefab flow, strengthen GameNet/WsClient, and add AIServer maintenance endpoint support.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-21 17:34:42 +08:00

1.2 KiB
Raw Blame History

AIServer

C++ 登录 / WebSocket 网关(SQLite),协议兼容客户端 HotUpdate.Net。

接口

方法 路径 说明
POST /register {"username","password"} → {"token","pid"}
POST /login 同上
GET /health 健康检查(含 maintenance)
GET /maintenance 维护开关状态
WS /ws?pid={pid}&token={token} 无 token → 401;支持 hello/ping;维护中下发 maintenance 后断开

本地默认:http://127.0.0.1:8080、ws://127.0.0.1:8080/ws?...
生产由 Caddy TLS 反代到本进程(与 game.xworld.ren 部署方式一致)。

构建(Windows / VS2022)

cd D:\UD\AI\AIGame\AIServer
cmake -S . -B build -G "Visual Studio 17 2022" -A x64
cmake --build build --config Release

产物:build\Release\aiserver.exe

运行

cd D:\UD\AI\AIGame\AIServer\build\Release
.\aiserver.exe --host 0.0.0.0 --port 8080 --db ..\..\data\aiserver.db

客户端联调

Unity 菜单或 Boot 配置:

  • HttpBase: http://127.0.0.1:8080
  • WsUrlTemplate: ws://127.0.0.1:8080/ws?pid={pid}&token={token}

数据

SQLite 文件默认 AIServer/data/aiserver.db(用户表 + token 表)。