{"id":13412933,"url":"https://github.com/xiaonanln/goworld","last_synced_at":"2025-04-13T18:37:11.048Z","repository":{"id":37396846,"uuid":"93255352","full_name":"xiaonanln/goworld","owner":"xiaonanln","description":"Scalable Distributed Game Server Engine with Hot Swapping in Golang","archived":false,"fork":false,"pushed_at":"2023-11-27T09:58:03.000Z","size":1962,"stargazers_count":2619,"open_issues_count":27,"forks_count":460,"subscribers_count":128,"default_branch":"master","last_synced_at":"2025-04-06T15:09:00.419Z","etag":null,"topics":["entities","entity-framework","game-server","golang","packets","rpc"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xiaonanln.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-06-03T15:02:46.000Z","updated_at":"2025-04-03T04:51:40.000Z","dependencies_parsed_at":"2024-01-08T15:02:57.214Z","dependency_job_id":"0a256cd7-aab5-481c-bd37-40a282454981","html_url":"https://github.com/xiaonanln/goworld","commit_stats":{"total_commits":1325,"total_committers":18,"mean_commits":73.61111111111111,"dds":"0.13433962264150945","last_synced_commit":"71ff877f1b92ea1df9d2e1b10d19b2da242a1df2"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaonanln%2Fgoworld","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaonanln%2Fgoworld/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaonanln%2Fgoworld/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaonanln%2Fgoworld/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xiaonanln","download_url":"https://codeload.github.com/xiaonanln/goworld/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248761997,"owners_count":21157656,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["entities","entity-framework","game-server","golang","packets","rpc"],"created_at":"2024-07-30T20:01:31.306Z","updated_at":"2025-04-13T18:37:11.028Z","avatar_url":"https://github.com/xiaonanln.png","language":"Go","funding_links":[],"categories":["Game Development","游戏开发","Go","Relational Databases","\u003cspan id=\"游戏开发-game-development\"\u003e游戏开发 Game Development\u003c/span\u003e","Libraries"],"sub_categories":["Search and Analytic Databases","Advanced Console UIs","检索及分析资料库","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","SQL 查询语句构建库"],"readme":"# GoWorld\n_**Scalable Distributed Game Server Engine with Hot Reload in Golang**_\n\n\n[![GoDoc](https://godoc.org/github.com/xiaonanln/goworld?status.png)](https://godoc.org/github.com/xiaonanln/goworld) \n[![Build Status](https://api.travis-ci.org/xiaonanln/goworld.svg?branch=master)](https://travis-ci.org/xiaonanln/goworld) [![Go Report Card](https://goreportcard.com/badge/github.com/xiaonanln/goworld)](https://goreportcard.com/report/github.com/xiaonanln/goworld) [![codecov](https://codecov.io/gh/xiaonanln/goworld/branch/master/graph/badge.svg)](https://codecov.io/gh/xiaonanln/goworld) \n[![ApacheLicense](https://img.shields.io/badge/license-APACHE%20License-blue.svg)](https://raw.githubusercontent.com/xiaonanln/goworld/master/LICENSE)\n\n  * [Features](#features)\n  * [Architecture](#architecture)\n  * [Introduction](#introduction)\n  * [Get GoWorld](#get-goworld)\n  * [Manage GoWorld Servers](#manage-goworld-servers)\n  * [Demos](#demos)\n    * [Chatroom Demo](#chatroom-demo)\n    * [Unity Demo](#unity-demo): [GoWorldUnityDemo.zip](https://drive.google.com/file/d/1A1CJCVWFQWa-iMuAoAdHZ4JoXTtU5Q7z/view?usp=sharing) \n---------------------------------------\n#### 中文资料 \n\u003e [中文文档](https://godoc.org/github.com/xiaonanln/goworld/cn)  \n\u003e [游戏服务器介绍](http://www.cnblogs.com/isaiah/p/7259036.html)  \n\u003e [目录结构说明](https://github.com/xiaonanln/goworld/wiki/GoWorld%E6%B8%B8%E6%88%8F%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%BC%95%E6%93%8E%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84)   \n\u003e [使用GoWorld轻松实现分布式聊天服务器](https://github.com/xiaonanln/goworld/wiki/%E4%BD%BF%E7%94%A8GoWorld%E6%B8%B8%E6%88%8F%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%BC%95%E6%93%8E%E8%BD%BB%E6%9D%BE%E5%AE%9E%E7%8E%B0%E5%88%86%E5%B8%83%E5%BC%8F%E8%81%8A%E5%A4%A9%E6%9C%8D%E5%8A%A1%E5%99%A8)  \n\n\n#### 游戏服务端开源引擎GoWorld教程  \n1.[安装和运行](https://zhuanlan.zhihu.com/p/66304813 \"安装和运行\")  \n2.[Unity示例双端联调](https://zhuanlan.zhihu.com/p/67065981 \"Unity示例双端联调\")  \n3.[手把手写一个聊天室](https://zhuanlan.zhihu.com/p/67951379 \"手把手写一个聊天室\")  \n4.[多个频道的聊天室](https://zhuanlan.zhihu.com/p/68901701 \"多个频道的聊天室\")  \n5.[登录注册和存储](https://zhuanlan.zhihu.com/p/70039615 \"登录注册和存储\")  \n6.[移动同步和AOI](https://zhuanlan.zhihu.com/p/70778081 \"移动同步和AOI\")  \n7.[源码解析之启动流程和热更新](https://zhuanlan.zhihu.com/p/72093172 \"源码解析之启动流程和热更新\")  \n8.[码解析之gate](https://zhuanlan.zhihu.com/p/73727839 \"码解析之gate\")  \n9.[源码解析之dispatcher](https://zhuanlan.zhihu.com/p/73906406 \"源码解析之dispatcher\")  \n10.[源码解析之entity](https://zhuanlan.zhihu.com/p/74736032 \"源码解析之entity\")  \n\n\n---------------------------------------\n\u003e **欢迎加入Go服务端开发交流群：[662182346](http://shang.qq.com/wpa/qunwpa?idkey=f2a99bd9bd9e6df3528174180aad753d05b372a8828e1b8e5c1ec5df42b301db)**\n---------------------------------------  \n## Features\n* **Spaces \u0026 Entities**: manage multiple spaces and entities with AOI support\n* **Distributed**: increase server capacity by using more machines\n* **Hot-Swappable**: update game logic by restarting server process\n* **Multiple Communication Protocols**: supports TCP, [KCP](https://github.com/skywind3000/kcp) and WebSocket\n* **Traffic Compression \u0026 Encryption**: traffic between clients and servers can be compressed and encrypted\n\n## Architecture\n![GoWorld Architecture](https://docs.google.com/drawings/d/e/2PACX-1vS20sn1rD-x23P6PpBV-C4Uy5BI6vry4TjKV9pBPtmoghlkH_aP24Ip4usyUciPRC6tpvsJX4Gufgvj/pub?w=960\u0026h=720 \"GoWorld Architecture\")\n\n## Introduction\nGoWorld server adopts an entity framework, in which entities represent all players, monsters, NPCs.\nEntities in the same space can visit each other directly by calling methods or access attributes. \nEntities in different spaces can call each over using RPC.\n\nA GoWorld server consists of one dispatcher, one or more games and one or more gates. \nThe gates are responsible for handling client connections and receive/send packets from/to clients. \nThe games manages all entities and runs all game logic. \nThe dispatcher is responsible for redirecting packets among games and between games and gates.  \n\nThe game processes are **hot-swappable**. \nWe can swap a game by sending `SIGHUP` to the process and restart the process with **-restore** parameter to bring game \nback to work but with the latest executable image. This feature enables updating server-side logic or fixing server bugs\n transparently without significant interference of online players. \n\n## Installing GoWorld\nGoWorld requries Go 1.11+ to install.\n```bash\ngo install github.com/xiaonanln/goworld/cmd/...\n``` \n\n## Manage GoWorld Servers\nUse command `goworld` to build, start, stop and reload game servers. \n\n**Build Example Chatroom Server:**\n```bash\n$ goworld build examples/chatroom_demo\n```\n\n**Start Example Chatroom Server: (dispatcher -\u003e game -\u003e gate)**\n```bash\n$ goworld start examples/chatroom_demo\n``` \n\n**Stop Game Server (gate -\u003e game -\u003e dispatcher):**\n```bash\n$ goworld stop examples/chatroom_demo\n```\n\n**Reload Game Servers:**\n```bash\n$ goworld reload examples/chatroom_demo\n```\nReload will reboot game processes with the current executable while preserving all game server states. \n**However, it does not work on Windows.**\n\n**List Server Processes:**\n```bash\n$ goworld status examples/chatroom_demo\n\u003e 1 dispatcher running, 1/1 gates running, 1/1 games (examples/chatroom_demo) running\n\u003e \t2763      dispatcher      /home/ubuntu/go/src/github.com/xiaonanln/goworld/components/dispatcher/dispatcher -dispid 1\n\u003e \t2770      chatroom_demo   /home/ubuntu/go/src/github.com/xiaonanln/goworld/examples/chatroom_demo/chatroom_demo -gid 1\n\u003e \t2779      gate            /home/ubuntu/go/src/github.com/xiaonanln/goworld/components/gate/gate -gid 1\n```  \n\n## Demos\n\n### Chatroom Demo\nThe chatroom demo is a simple implementation of chatroom server and client. It illustrates how\nGoWorld can also be used for games which don't divide players by spaces. \n\nThe chatroom demo provides following features:\n* register \u0026 login\n* send chat message\n* switch chatrooms\n\n**Build Server:**\n```bash\ngoworld build examples/chatroom_demo\n```\n**Run Server:**\n```bash\ngoworld start examples/chatroom_demo\n```\n\n**Chatroom Demo Client:**\n\nChatroom demo client implements the client-server protocol in Javascript.  \nThe client for chatroom demo is hosted at [github.com/xiaonanln/goworld-chatroom-demo-client](https://github.com/xiaonanln/goworld-chatroom-demo-client).\nThe project was created and built in [Cocos Creater 1.5](http://www.cocos2d-x.org/). \n\n### Unity Demo\nUnity Demo is a simple multiple player monster shooting game to show how spaces and entities of GoWorld\ncan be used to create multiple player online games.  \n\n* register \u0026 login\n* move players in space\n* summon monsters\n* player shoot monsters\n* monsters attack players\n\nDeveloping features:\n* Hit effects\n* Players migrate among multiple spaces\n* Server side map navigation\n\n**Build Server:**\n```bash\ngoworld build examples/unity_demo\n```\n**Run Server:**\n```bash\ngoworld start examples/unity_demo\n```\n\n**Unity Demo Client:**\n\nUnity demo client implements the client-server protocol in C#. \nThe client for unity demo is hosted at [https://github.com/xiaonanln/goworld-unity-demo](https://github.com/xiaonanln/goworld-unity-demo).\nThe project was created and built in [Unity 2017.1](https://unity3d.com/). \n\nYou can try the demo by downloading [GoWorldUnityDemo.zip](https://drive.google.com/file/d/1A1CJCVWFQWa-iMuAoAdHZ4JoXTtU5Q7z/view?usp=sharing). \nThe demo connects to a goworld server on Huawei Cloud instance.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaonanln%2Fgoworld","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiaonanln%2Fgoworld","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaonanln%2Fgoworld/lists"}