Scalable Distributed Game Server Engine with Hot Reload in Golang
- Get GoWorld
- Manage GoWorld using goworld.py
- Run Example Chatroom Client
- Spaces & Entities: manage multiple spaces and entities with AOI support
- Distributed: increase server capacity by using more machines
- Hot-Swappable: update game logic by restarting server process
GoWorld server adopts an entity framework, in which entities represent all players, monsters, NPCs. Entities in the same space can visit each other directly by calling methods or access attributes. Entities in different spaces can call each over using RPC.
A GoWorld server consists of one dispatcher, one or more games and one or more gates. The gates are responsable for handling client connections and receive/send packets from/to clients. The games manages all entities and runs all game logic. The dispatcher is responsable for redirecting packets among games and between games and gates.
The game processes are hot-swappable. We can swap a game by sending SIGUSR1 to the process and restart the process with -restore parameter to bring game back to work but with the latest executive image. This feature enables updating server-side logic or fixing server bugs transparently without significant interference of online players.
$ go get github.com/xiaonanln/goworld
glide.exefrom https://github.com/Masterminds/glide/releases and put it to
GoWorld uses Glide to manage packages.
Manage GoWorld using goworld.py
goworld.py is a script for managing goworld server easily. Running goworld.py requires python 2.7.x and psutil module. We can use goworld.py to build, start, stop and reload game servers.
$ pip install psutil
Build Dispatcher & Gate:
$ python goworld.py build dispatcher gate
Build Example Chatroom Server:
$ python goworld.py build examples/chatroom_demo
Start Example Chatroom Server: (dispatcher -> game -> gate)
$ python goworld.py start examples/chatroom_demo
Stop Game Server (gate -> game -> dispatcher):
$ python goworld.py stop
Reload Game Servers:
$ python goworld.py reload
Reload will reboot game processes with the current executive while presearving all game server states.
Run Example Chatroom Client
The client for chatroom demo is hosted at github.com/xiaonanln/goworld-chatroom-demo-client. The project was created and built in Cocos Creater 1.5. A running server & client demo can also be found at http://goworldgs.com/chatclient/.