Giter Site home page Giter Site logo

jangocheng / gos Goto Github PK

View Code? Open in Web Editor NEW

This project forked from feihuroger/gos

0.0 1.0 0.0 100.84 MB

基于Go语言的分布式游戏服务器框架

Home Page: https://www.jianshu.com/nb/24879749

Makefile 0.93% Go 80.31% Shell 0.71% Ruby 14.13% Erlang 3.92%

gos's Introduction

简介

《GOS》是一款基于Go语言的分布式游戏服务器框架,高可用、动态伸缩、在线扩容,可应用于市面上绝大多数游戏类型:SLG、RPG、ARPG、MMO、MOBA。

结构图

Architecture

单点消除

SinglePoints

结构详解

  • AuthService

    验证服务,提供账户注册、玩家登陆,以及为玩家获取连接服务(AgentCell)信息的功能。

  • AgentMgr

    连接服务管理器,连接服务负载均衡管理,根据当前负载情况为玩家分配的连接服务。向集群管理器申请开辟和释放连接服务。

  • GameMgr

    游戏服务管理器,游戏服务负载均衡管理,根据当前负载情况为玩家分配游戏服务。向集群管理器申请开辟和释放游戏服务。

  • Agent

    连接服务,转发玩家信息至游戏服务,转发游戏服务信息至玩家,处理游戏内广播消息。

  • Game

    游戏服务,游戏场景管理,处理玩家请求,游戏逻辑的主要发生地;加载、持久化场景、玩家信息至MySQL集群。

  • Scene

    游戏场景,每个游戏服务内包含一个或多个游戏场景,场景可以是MMO的每个场景地图,也可以是SLG的世界地图,还可以是MMO的大厅服务,甚至可以是一个游戏服。场景的大小粒度,可以根据游戏的实际情况而定,游戏场景概念是《GOS》进行负载分布的核心设计。

  • Hot Data

    热数据管理,由于游戏内玩家数据会频繁变更,所以游戏场景和玩家启动后会将其相关的数据加载到内存中,并由Hot Data进行管理,并定时的回写到MySQL集群。

  • MySQL Cluster

    数据库集群,主要用于保存玩家数据和游戏场景数据;由于当下云服务已经非常成熟和完善,这里建议直接使用云服务的RDS服务,在后台点点点就能创建一个MySQL集群,读写性能和数据安全性都有保证。

  • Redis Cluster

    Redis集群,主要用于集群配置信息保存,玩家Session缓存;Redis集群可以自己根据Redis官网搭建,同时也推荐大家使用云服务,简单快捷稳定,费用不高。

基础工具集

  • 分布式服务健康监测
  • GenServer:类似于Erlang的gen_server,封装了Groutine的基本启动、查找、消息同步/异步发送
  • 协议生成器:根据YAML生成客户端与服务器的通信协议
  • 路由管理:根据YAML文件生成路由协议,玩家请求自动分发至相应Controller进行处理
  • 热数据管理:按需加载玩家数据,并定时持久化至MySQL
  • MySQL管理:基于Rails的ActiveRecord进行migration管理,并生成Go的ORM文件
  • 定时任务:定时触发器,由redis持久化
  • 配置数据生成工具:解析excel表格生成对应的配置表
  • 排行榜服务:自定义各种排行榜,根据积分排名,可设置每个玩家自定义信息
  • 推送消息:苹果、谷歌(FCM)
  • 支付验证:苹果、谷歌

Quick Start

git checkout https://github.com/mafei198/gos.git
make dep_install
make setup
make build
make start_all

TODO

  • 聊天服务
  • 邮件服务
  • 玩家日志
  • 世界数据
  • 云服务器管理
  • 运行时REPL交互环境

License

GOS is under The MIT License (MIT)

Copyright (c) 2018-2028 Savin Max [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

gos's People

Contributors

mafei198 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.