mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2025-12-19 16:32:23 +08:00
main
hk4e
What's this
A Genshin Impact game server written in Golang.
This project aims to build a high performance ARPG game server, instead of supporting all in-game features
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
Download version 3.2.0 from miHoYo
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
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
- Protoc Gen Go >= 1.28
- Docker >= 20.10
- Docker Compose >= 1.29
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
make dev_tool
- Generate protocol
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
make build # Compile server to binary file
make docker_config # Copy files like config templates, etc.
make docker_build # Build a Docker image
- Launch
cd docker
# 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
nodeNode server (Single node, with status)dispatchLogin server (Multi nodes, without status)gateGateway server (Multi nodes, with status)anticheatAnti-cheat server (Multi nodes, with status STILL UNDER CONSTRUCTION)pathfindingPath-finding server (Multi nodes, without status STILL UNDER CONSTRUCTION)gsGame server (Multi nodes, with status)gmGame menagement server (Single node, without status)
Misc
- You need to add the following environment variable to run as standalone server
GOLANG_PROTOBUF_REGISTRATION_CONFLICT=ignore
Code submission specifications
- You MUST run
go fmtbefore commit - Please ignore directory
gdconfwhen running global formatting. These are config tables, including lots ofjson,loa,txtfiles - Add a
spacebetween//and your comments when writing inline comments - Split standard packages, local packages and third-party packages with linebreaks
Description
Languages
Go
98.7%
HTML
0.8%
Makefile
0.3%
Shell
0.1%