Update README.md

This commit is contained in:
ArthurZhou
2023-07-06 20:41:02 +08:00
committed by GitHub
parent fc77fc609a
commit f6eb19c3a0

View File

@@ -1,5 +1,8 @@
# hk4e
[中文](README-CN.md)
***
## What's this
#### A Genshin Impact game server written in Golang.
@@ -16,13 +19,14 @@
## Features
* Native high-availability cluster architecture. Crashes on any node servers won't affect the whole system. So it is highly extendable.
* Player-level non-statued game server. Non-lock single thread structure. Easy to develope. And fully-featured player data exchanger(`Memory<->Cache<->Database`), say goodbye to Deny synchronization-blocked database access
* 新颖的玩家在线跨服无缝迁移功能
* 独创的网关服务器侧客户端协议代理转换功能,拒绝因协议号消息号混淆而带来代码改动的烦恼
* 完整的密钥交换机制实现,安全性++拒绝一个写死的随机数种子和XOR密钥文件用到天荒地老
* Native high-availability cluster architecture. Crashes on any node servers won't affect the whole system. So it is highly extendable
* Player-level non-status game server. Non-lock single thread structure. Easy to develope. And fully-featured player data exchanger(`Memory<->Cache<->Database`), say goodbye to
* synchronization-blocked database access
* Grand new cross-server player migration
* Gateway server side client protocol proxy conversion. Never worry about code changes caused by confusions of message number and protocol number
* Fully-featured key exchanging strategy with enhanced security, instead of using an existing random seed with an XOR key file all day long
## 编译和运行环境
## Compile and working environment
* Go >= 1.18
* Protoc >= 3.21
@@ -30,67 +34,67 @@
* Docker >= 20.10
* Docker Compose >= 1.29
#### 本项目未使用CGO构建理论上Windows、Linux系统都可以编译运行macOS下没有`unix.Gettid`的实现需要使用CGO构建
#### This project is built without CGO. Both Windows and Linux systems can compile and run it. While you need to use CGO on MacOS since it hasn't impleted `unix.Gettid`
## 快速启动
## Get start
* 首次需要安装工具
* Install on first launch
```shell
make dev_tool
```
* 生成协议
* Generate protocol
```shell
make gen_natsrpc # 生成natsrpc协议
make gen_proto # 生成客户端协议
make gen_client_proto # 生成客户端协议代理(非必要 详见gate/client_proto/README.md)
make gen_natsrpc # Generate natsrpc protocol
make gen_proto # Generate client protocol
make gen_client_proto # Generate client proxy protocol(not very necessary, for further informations: gate/client_proto/README.md)
```
* 构建
* Compile
```shell
make build # 构建服务器二进制文件
make docker_config # 复制配置模板等文件
make docker_build # 构建镜像
make build # Compile server to binary file
make docker_config # Copy files like config templates, etc.
make docker_build # Build a Docker image
```
* 启动
* Launch
```shell
cd docker
# 启动前请先确保各服务器的配置文件正确(如docker/node/bin/application.toml)
docker-compose up -d # 启动服务器
# Checkout all configurations before launch(e.g. docker/node/bin/application.toml)
docker-compose up -d # Launch server
```
#### 第三方组件
#### Third-party dependencies
* mongodb
* nats-server
* redis
#### 服务器组件
#### Server components
* node 节点服务器 (仅单节点 有状态)
* dispatch 登录服务器 (可多节点 无状态)
* gate 网关服务器 (可多节点 有状态)
* anticheat 反作弊服务器 (可多节点 有状态 尚不完善非必要启动)
* pathfinding 寻路服务器 (可多节点 无状态 尚不完善非必要启动)
* gs 游戏服务器 (可多节点 有状态)
* gm 游戏管理服务器 (仅单节点 无状态)
* `node` Node server (Single node, with status)
* `dispatch` Login server (Multi nodes, without status)
* `gate` Gateway server (Multi nodes, with status)
* `anticheat` Anti-cheat server (Multi nodes, with status **STILL UNDER CONSTRUCTION**)
* `pathfinding` Path-finding server (Multi nodes, without status **STILL UNDER CONSTRUCTION**)
* `gs` Game server (Multi nodes, with status)
* `gm` Game menagement server (Single node, without status)
#### 其它
#### Misc
* 独立运行需要配置环境变量
* You need to add the following environment variable to run as standalone server
```shell
GOLANG_PROTOBUF_REGISTRATION_CONFLICT=ignore
```
## 代码提交规范
## Code submission specifications
* 提交前**必须**进行go fmt(GoLand可在commit窗口的设置里勾选默认是启用的)
* 进行全局格式化时请跳过gdconf目录这是配置表数据包含大量的json、lua、txt等文件
* 单行注释的注释符与注释内容之间需要加一个空格(GoLand可在设置Editor/CodeStyle/Go/Other里打开)
* 导入包时需要将标准库、本地包、第三方包用空行分开(GoLand可在设置Editor/CodeStyle/Go/Imports里打开)
* You **MUST** run `go fmt` before commit
* Please ignore directory `gdconf` when running global formatting. These are config tables, including lots of `json`, `loa`, `txt` files
* Add a `space` between `//` and your comments when writing inline comments
* Split standard packages, local packages and third-party packages with linebreaks