mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2025-12-19 18:32:23 +08:00
96
README-CN.md
Normal file
96
README-CN.md
Normal file
@@ -0,0 +1,96 @@
|
||||
# hk4e
|
||||
|
||||
## 简介
|
||||
|
||||
#### 使用Golang编写的『原神』游戏服务器.
|
||||
|
||||
#### 本项目的目标为构建一个高性能高可用的ARPG游戏服务端,并非以完整还原游戏内原本功能点为目的
|
||||
|
||||
#### 项目的客户端协议、配置表主要基于3.2版本修改而来,因此请尽量使用3.2版本的客户端,但不是必须的
|
||||
|
||||
[3.2.0国际服客户端下载链接](https://autopatchhk.yuanshen.com/client_app/download/pc_zip/20221024103618_h2e3o3zijYKEqHnQ/GenshinImpact_3.2.0.zip)
|
||||
|
||||
#### 客户端需要本地https代理和打破解补丁才能正常使用,详情请参考目前主流私服连接方法
|
||||
|
||||
#### 可以使用新版补丁避免https代理,支持自定义密钥和连接任意地址的服务器,感谢[Jx2f/mhypbase](https://github.com/Jx2f/mhypbase)
|
||||
|
||||
## 特性
|
||||
|
||||
* 原生的高可用集群架构,任意节点宕机不会影响到整个系统,可大量水平扩展
|
||||
* 玩家级无状态游戏服务器,无锁单线程模型,开发省时省力,完善的玩家数据交换机制(内存-缓存-数据库),拒绝同步阻塞的数据库访问
|
||||
* 新颖的玩家在线跨服无缝迁移功能
|
||||
* 独创的网关服务器侧客户端协议代理转换功能,拒绝因协议号消息号混淆而带来代码改动的烦恼
|
||||
* 完整的密钥交换机制实现,安全性++,拒绝一个写死的随机数种子和XOR密钥文件用到天荒地老
|
||||
|
||||
## 编译和运行环境
|
||||
|
||||
* Go >= 1.18
|
||||
* Protoc >= 3.21
|
||||
* Protoc Gen Go >= 1.28
|
||||
* Docker >= 20.10
|
||||
* Docker Compose >= 1.29
|
||||
|
||||
#### 本项目未使用CGO构建,理论上Windows、Linux系统都可以编译运行,macOS下没有`unix.Gettid`的实现,需要使用CGO构建
|
||||
|
||||
## 快速启动
|
||||
|
||||
* 首次需要安装工具
|
||||
|
||||
```shell
|
||||
make dev_tool
|
||||
```
|
||||
|
||||
* 生成协议
|
||||
|
||||
```shell
|
||||
make gen_natsrpc # 生成natsrpc协议
|
||||
make gen_proto # 生成客户端协议
|
||||
make gen_client_proto # 生成客户端协议代理(非必要 详见gate/client_proto/README.md)
|
||||
```
|
||||
|
||||
* 构建
|
||||
|
||||
```shell
|
||||
make build # 构建服务器二进制文件
|
||||
make docker_config # 复制配置模板等文件
|
||||
make docker_build # 构建镜像
|
||||
```
|
||||
|
||||
* 启动
|
||||
|
||||
```shell
|
||||
cd docker
|
||||
# 启动前请先确保各服务器的配置文件正确(如docker/node/bin/application.toml)
|
||||
docker-compose up -d # 启动服务器
|
||||
```
|
||||
|
||||
#### 第三方组件
|
||||
|
||||
* mongodb
|
||||
* nats-server
|
||||
* redis
|
||||
|
||||
#### 服务器组件
|
||||
|
||||
* node 节点服务器 (仅单节点 有状态)
|
||||
* dispatch 登录服务器 (可多节点 无状态)
|
||||
* gate 网关服务器 (可多节点 有状态)
|
||||
* anticheat 反作弊服务器 (可多节点 有状态 尚不完善非必要启动)
|
||||
* pathfinding 寻路服务器 (可多节点 无状态 尚不完善非必要启动)
|
||||
* gs 游戏服务器 (可多节点 有状态)
|
||||
* gm 游戏管理服务器 (仅单节点 无状态)
|
||||
|
||||
#### 其它
|
||||
|
||||
* 独立运行需要配置环境变量
|
||||
|
||||
```shell
|
||||
GOLANG_PROTOBUF_REGISTRATION_CONFLICT=ignore
|
||||
```
|
||||
|
||||
## 代码提交规范
|
||||
|
||||
* 提交前**必须**进行go fmt(GoLand可在commit窗口的设置里勾选,默认是启用的)
|
||||
* 进行全局格式化时,请跳过gdconf目录,这是配置表数据,包含大量的json、lua、txt等文件
|
||||
* 单行注释的注释符与注释内容之间需要加一个空格(GoLand可在设置Editor/CodeStyle/Go/Other里打开)
|
||||
* 导入包时需要将标准库、本地包、第三方包用空行分开(GoLand可在设置Editor/CodeStyle/Go/Imports里打开)
|
||||
92
README.md
92
README.md
@@ -1,28 +1,32 @@
|
||||
# hk4e
|
||||
|
||||
## 简介
|
||||
[中文](README-CN.md)
|
||||
***
|
||||
|
||||
#### 『原神』 Game Server But Golang Ver.
|
||||
## What's this
|
||||
|
||||
#### 本项目的目标为构建一个高性能高可用的ARPG游戏服务端,并非以完整还原游戏内原本功能点为目的
|
||||
#### A Genshin Impact game server written in Golang.
|
||||
|
||||
#### 项目的客户端协议、配置表主要基于3.2版本修改而来,因此请尽量使用3.2版本的客户端,但不是必须的
|
||||
#### This project aims to build a high performance ARPG game server, instead of supporting all in-game features
|
||||
|
||||
[3.2.0国际服客户端下载链接](https://autopatchhk.yuanshen.com/client_app/download/pc_zip/20221024103618_h2e3o3zijYKEqHnQ/GenshinImpact_3.2.0.zip)
|
||||
#### The network protocols and configuration tables are mainly from version 3.2, so we suggest you to use a v3.2 client, although it is not necessary
|
||||
|
||||
#### 客户端需要本地https代理和打破解补丁才能正常使用,详情请参考目前主流私服连接方法
|
||||
[Download version 3.2.0 from miHoYo](https://autopatchhk.yuanshen.com/client_app/download/pc_zip/20221024103618_h2e3o3zijYKEqHnQ/GenshinImpact_3.2.0.zip)
|
||||
|
||||
#### 可以使用新版补丁避免https代理,支持自定义密钥和连接任意地址的服务器,感谢[Jx2f/mhypbase](https://github.com/Jx2f/mhypbase)
|
||||
#### You need to use an https proxy and a patch to use it. Grasscutter is a good example.
|
||||
|
||||
## 特性
|
||||
#### You can use a newer patch to avoid using https proxies. It supports custom keys and multiple servers. Special thanks to [Jx2f/mhypbase](https://github.com/Jx2f/mhypbase)
|
||||
|
||||
* 原生的高可用集群架构,任意节点宕机不会影响到整个系统,可大量水平扩展
|
||||
* 玩家级无状态游戏服务器,无锁单线程模型,开发省时省力,完善的玩家数据交换机制(内存-缓存-数据库),拒绝同步阻塞的数据库访问
|
||||
* 新颖的玩家在线跨服无缝迁移功能
|
||||
* 独创的网关服务器侧客户端协议代理转换功能,拒绝因协议号消息号混淆而带来代码改动的烦恼
|
||||
* 完整的密钥交换机制实现,安全性++,拒绝一个写死的随机数种子和XOR密钥文件用到天荒地老
|
||||
## 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-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
|
||||
|
||||
Reference in New Issue
Block a user