179 Star 1.6K Fork 498

渔民小镇 / ioGame

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
AGPL-3.0

ioGame

无锁异步化、事件驱动的架构设计;轻量级,无需依赖任何第三方中间件或数据库就能支持集群、分布式
通过 ioGame 可以很容易的搭建出一个集群无中心节点、集群自动化、多进程的分布式游戏服务器
包体小、启动快、内存占用少、更加的节约、无需配置文件、提供了优雅的路由访问权限控制
可同时支持多种连接方式:WS、UDP、TCP...等;框架已支持全链路调用日志跟踪特性
让开发者用一套业务代码,能轻松切换和扩展不同的通信协议:Protobuf、JSON
近原生的性能;业务框架在单线程中平均每秒可以执行 1152 万次业务逻辑
代码即联调文档、JSR380验证、断言 + 异常机制 = 更少的维护成本
框架具备智能的同进程亲和性;开发中,业务代码可定位与跳转
架构部署灵活性与多样性:既可相互独立,又可相互融合
可同时与同类型的多个游戏逻辑服通信并得到数据
逻辑服之间可相互跨进程、跨机器进行通信
支持玩家对游戏逻辑服进行动态绑定
能与任何其他框架做融合共存
对 webMVC 开发者友好
无 spring 强依赖
零学习成本
javaSE

http://game.iohao.com

JDK 21
AGPL3.0
gitee star github star



过去、现在、将来都不会有商业版本,所有功能全部开源!

只做真的完全式开源,拒绝虚假开源,售卖商业版,不搞短暂维护!

承诺项目的维护周期是十年起步, 2022-03-01起,至少十年维护期!

提供高质量的使用文档!


ioGame 源码完全开放、最新文档阅读完全开放;使用完全自由、免费(遵守开源协议)。


ioGame 是一个轻量级的网络编程框架,适用于网络游戏服务器、物联网、内部系统及各种需要长连接的场景。


使用 ioGame,可以显著的帮助企业减少巨额成本。在文档中,"成本"关键字提到了很多次,各个阶段均有关联,包括了学习、研发、测试、部署、扩展、投入 ...等各阶段。在同等资源的竞争下,使用 ioGame 可为公司节省更多的资源,从而提高了自身的生存率。更重要的是避免了为其他公司做嫁衣的可能性,具体可阅读成本分析案例


为什么采用授权许可申请?

授权许可申请 -- 点我展开
ioGame 使用的是 AGPL3.0 开源协议。
由于 ioGame 遵循过去、现在、将来都不会有商业版本,所有功能全部开源的原则,使得我们很难找到盈利点,现在使用授权的方式;

使用 ioGame 是免费的,前提是要认同生产资料公有制,就是把你的产品也完全的开源出来(遵守 AGPL3.0 开源协议);同时,ioGame 是允许私有的,前提是支付闭源授权费。所以,付费不是必须的,也不是强制性的,选择权在使用者手上。

ioGame 支持申请盈利后支付闭源授权费,收入不超过10万人民币/年或拥有不超过100万人民币的资产,可以申请盈利后支付授权费用。

### 闭源授权说明
1.授权费用:2799 人民币每年。
2.一个产品只对应一个授权。
3.取得授权的产品只可自己运营或使用,如果是提供给客户二次开发或销售类的产品,每份需要取得一个授权。

如果你的产品不想开源,可以向我们申请为期一年的闭源授权,企业用户需要通过企业邮箱申请闭源授权。如果是个人开发者、独立开发者的,可以使用非企业邮箱申请闭源授权。

### 授权类型
个人和独立开发者:收入不超过10万人民币/年或拥有不超过100万人民币的资产,可以申请盈利后支付授权费用。
企业:收入不超过10万人民币/年或拥有不超过100万人民币的资产,可以申请盈利后支付授权费用。

我们最终是期望你的产品盈利后,支付闭源授权费用。我们的目的也很明确,通过授权的方式获得资金,在使用这些资金来加快发展框架的功能及建立完善社区,更好的为大家服务。

以下行业或产品需要请提前沟通:基于 ioGame 的商业化视频、围绕 ioGame 的商业化售卖产品; 围绕 ioGame 的商业化产品指的是售卖相关的商业产品;

存在法律纠纷阶段是不予授权的。

### 申请授权
申请授权邮箱(发到 262610965@qq.com 或 luoyizhu@gmail.com),内容格式如下
公司全名:
统一社会信用代码:
产品描述:
软件著作权编号:(没有可以不用填写)
申请的授权类型:(个人和独立开发者、企业、专业版、定制版)


### 合法授权码
授权码是根据 【公司统一社会信用代码、软著码、发放日期、失效日期】等信息生成的,确保唯一性与合法性;

授权码会通过邮箱发放,用于留存,具备法律效力。
产品在取得授权期内,不需要对外开放产品源代码;如果不在授权期内,你的产品将转为 AGPL3.0 开源协议。


启动展示

ioGame 在内存占用、启动速度、打包等方面也是优秀的。

  • 内存方面:内存占用小。
  • 启动速度方面:应用通常会在 0.x 秒内完成启动。
  • 打包方面:打 jar 包后大约 15MB ,详细请看 快速从零编写服务器完整示例


源码、示例、效率

github gitee
源码地址 ioGame 网络游戏框架-源码 ioGame 网络游戏框架-源码
示例地址 ioGame 示例集合 ioGame 示例集合

示例

地址 描述
u3d 连接示例文档 已经与 ioGame 的综合示例联调成功
cocosCreator 连接示例文档 已经与 ioGame 的综合示例联调成功
UE5 连接示例文档 已经与 ioGame 的综合示例联调成功
websocket.js 连接示例文档 websocket.js 连接的一个示例,使用 json 协议来传输交互。
ioGame 综合示例介绍 示例中有功能特性的实践、打包部署(docker、ks8)等介绍
FXGL-ioGame-移动同步 FXGL + ioGame 网络游戏中的多人移动演示。
unity Tcp 移动同步 demo 提供了 unity 与 ioGame 的【多人】移动同步演示
28 行代码做个网页聊天室 基于 ioGame 框架,用 28 行代码做一个简单的网页聊天室。

效率

地址 描述
ioGame 快速理解篇 快速掌握 ioGame 的概念
技术栈推荐与其它参考文档 游戏开发的技术栈建议,大家可以参考一下。
更多游戏服务器框架推荐 如果 ioGame 不能很好的满足你的需要,请别担心,这里还有更多的 java 游戏服务器框架推荐给你。

最小依赖

ioGame 已经上传到中央仓库,如果无法下载最新的框架源码,建议开发者的 maven 仓库代理使用原生的或腾讯云的代理,目前不推荐阿里云的代理。腾讯云代理设置可参考这里

ioGame 是轻量级的网络编程框架,不依赖任何第三方中间件或数据库就能支持集群、分布式,只需要 java 环境就可以运行。此时,你只需一个依赖即可获得整个框架,并同时支持开头介绍的全部功能特性。

<!-- https://mvnrepository.com/artifact/com.iohao.game/run-one-netty -->
<dependency>
    <groupId>com.iohao.game</groupId>
    <artifactId>run-one-netty</artifactId>
    <version>21.5</version>
</dependency>

ioGame 使用趋势数据

关注 ioGame 的游戏服务器开发者持续增多,2022-09 ~ 至今各月的统计数据;

这里的统计信息是关于开发者关注 ioGame 框架相关的,从统计数据中可以看出,由于 ioGame 上手简单,功能强大等优点,得到了众多开发者的关注。如果你想知道 ioGame 有没有人在使用,可以先到这里看下统计数据、开发者的评价与讨论。

https://www.yuque.com/iohao/game/gpxk93#TwVa8

这里展示了每月的统计数据,统计数据来源于语雀后台,这些数据都是真实的、客观存在的、活的

因为成本的原因,某宝某多还没有出现能提供这种服务的商家,所以这样的统计数据也更具真实性。

通过统计数据,我们可以看到每天会有很多开发者在访问 ioGame 的在线文档,并且这些统计数据不是来源于口嗨的,也不是主观创造的。

所以,还在犹豫要不要使用 ioGame 的开发者们,更应该讨论的是“为什么这些开发者会选择使用 ioGame”,而不是 ioGame 有没有人在使用的问题。

点击我,到语雀后台查看 ioGame 的数据


框架的安全质量

ioGame 已经接入 OSCS 墨菲安全扫描,框架的安全质量近乎100%,游戏开发者们可放心使用。更详细的可以到 ioGame 框架的安全质量、代码质量、性能 来了解。

ioGame-OSCS


愿景

让网络游戏服务器的编程变得轻松简单!

改变行业现状,降低使用难度,让游戏开发领域的生产资料公有制。

整体预览导图

image

了解 ioGame 前的准备工作

在了解 ioGame 前,这里有几个问题需要你帮忙解决,或者说你目前使用的现有框架是否能解决下面提出的问题。

下面这些问题是 ioGame 已经解决了的,并且的将来还能解决更多的问题。

如果你现在使用的框架能解决下列问题,可以不需要在花时间来学习 ioGame 了。

问题 -- 点我展开

学习成本、风险相关的问题

Q:你的使用的框架是祖传的吗?有完整的使用文档吗?如果将你当前使用的框架给到其他团队,在没有你的帮助下,该团队能顺利完成开发吗?

Q:你使用的框架是公司内部的吗?去到了新公司是否还需要重新学一套新公司的框架?或将现有公司的框架带到下个公司去使用,会给新公司带来风险吗?

Q:打算新招一个编写业务逻辑的人员,可以做到零学习成本吗?

Q:每次通信协议的变更(如 pb 内容的变更),可以做到不需要重新编译协议就能使用吗?

Q:提供游戏文档生成的辅助功能吗,支持联调文档的生成吗,支持代码即文档吗?

Q:你使用的框架会像 ioGame 这样使用语雀的每月统计,公布真实的访问数据吗?

因为成本的原因,某宝某多还没有出现能提供这种服务的商家,所以这样的统计数据也更具真实性。

Q:路由可以控制访问权限吗?如某些方法非登录玩家也能访问,有些方法只能登录后访问,有些方法即使是登录的玩家也无法访问(用于内部调用的敏感方法)。

架构相关的提问

Q:支持集群、分布式吗?是轻量级的框架吗?可以做到无需依赖任何第三方中间件或数据库就能支持集群、分布式这种真正的轻量级吗?

Q:当现有机器不能支撑现有玩家的处理时,支持机器动态增加吗?支持机器动态减少吗?动态增减会有风险吗?

Q:当有相同类型的多个逻辑服时,支持负载均衡吗?

分布式开发体验与部署相关提问

支持多服多进程的启动方式吗?

支持多服单进程的启动方式吗?

启动方式上支持随意的切换而不需要更改代码吗?

支持多服单进程的方式部署吗?

支持多服多进程多机器的方式部署吗?

部署方式上支持随意的切换而不需要更改代码吗?

业务框架相关的问题

Q:是线程安全的吗,玩家断线后,重新登录也是同个线程吗?

Q:玩家可以动态绑定指定的游戏逻辑服吗?之后的每个请求都由该游戏逻辑服来处理吗?

Q:框架支持灵活的线程扩展与设置吗?

Q:能与 spring 融合吗?除了 spring 外,还能与任何其他的框架做融合,从而使用其他框架的相关生态吗?

Q:能解决协议碎片吗?

Q:action 支持类 MVC 的编码方式吗?

action 表示一个业务动作;是接收请求,处理请求,响应数据的统称;

是路由与方法映射的一种编程模型,这种编程模型可以避免类爆炸。它提供一种清晰、灵活的方式来组织应用程序代码,将请求、响应和业务逻辑分离开来,并实现松耦合。这使得应用程序更易于维护和测试,并支持代码重用。

// 你敢相信这样就能处理长连接通信请求吗
// 这是 ioGame 编写业务逻辑时的代码,如果是新招的业务编写人员,几乎是零学习成本的。
@ActionController(1)
public class DemoAction {
    @ActionMethod(0)
    public HelloReq here(HelloReq helloReq) {
        HelloReq newHelloReq = new HelloReq();
        newHelloReq.name = helloReq.name + ", I'm here ";
        return newHelloReq;
    }
}

Q:action 请求参数除了对象外,能够支持基础类型和 List 吗?参数支持 JSR380 验证吗?

Q:action 返回值支持基础类型、List、对象的返回值吗?还是说只能支持传统的推送方式来响应数据?

Q:action 支持断言和异常机制吗?

Q:action 支持插件扩展吗?如请求信息的打印?

Q:action 支持业务代码定位与跳转吗?推送广播数据时,支持业务代码定位与跳转吗?

Q:支持类似 FlowContext 的特性吗?FlowContext 可扩展吗、可定制吗、可扩展元附加信息吗?(FlowContext 是一种对当前请求处理的上下文)

Q:能用一套业务代码,无需任何改动,同时支持多种通信协议:WebSocket、TCP 吗?

Q:能用一套业务代码,能轻松切换和扩展不同的通信协议:Protobuf、JSON 吗?

通讯方式相关的提问

支持跨进程、跨机器的单个游戏逻辑服间的相互通讯吗?

支持跨进程、跨机器与同类型多个游戏逻辑服相互通讯吗?

支持跨进程、跨机器的【游戏逻辑服】与多个【游戏对外服】通讯吗?

支持跨进程、跨机器的脉冲通讯吗?


ioGame 简介

你是否想要开发一个高性能、稳定、易用、自带负载均衡、避免类爆炸设计、可跨进程跨机器通信、集群无中心节点、集群自动化、有状态多进程的分布式的网络编程服务器呢?如果是的话,这里向你推荐一个由 java 语言编写的网络编程框架 ioGame。下面将会从多个方面来对框架做一些简单的介绍。

ioGame 是一个轻量级的网络编程框架,适用于网络游戏服务器、物联网、内部系统及各种需要长连接的场景;

ioGame 有以下特点:

  • 无锁异步化、事件驱动的架构设计
  • 同时支持 TCP、WebSocket、UDP 多种连接方式,并且可扩展
  • 支持 protobuf、json 等不同的通信协议
  • 集群无中心节点、集群自动化、分布式的设计
  • 真轻量级,不依赖任何第三方中间件或数据库就能支持集群、分布式
  • 提供多种通讯方式,且逻辑服之间可以相互跨机器通信
  • 分布式事件总线支持
  • 框架为开发者提供了同步、异步、异步回调的方法,用于逻辑服之间的相互访问
  • ioGame 是纯 javaSE 的,使得 ioGame 能与其他框架方便的进行集成、融合;如 spring ...等
  • 学习成本低,开发体验好
  • 支持多服单进程、多服多进程的启动和部署方式
  • 提供游戏文档生成的辅助功能
  • 包体小、启动快、内存占用少
  • 提供优雅的路由访问权限控制
  • 提供了灵活的线程扩展、设置
  • 具备智能的同进程亲和性
  • 具备全链路调用日志跟踪特性
  • 业务框架提供了插件机制,插件是可插拨、可扩展的
  • JSR380验证、断言 + 异常机制 = 更少的维护成本
  • action 支持自动装箱、拆箱基础类型,用于解决协议碎片的问题

ioGame 是一个专为网络编程设计的轻量级框架,它可以帮助你快速地搭建和运行自己的网络服务器。ioGame 适用于网络游戏服务器、物联网、内部系统及各种需要长连接的场景。如各种类型和规模的网络游戏,无论是 H5、手游还是 PC 游戏,无论是简单的聊天室,还是复杂的全球同服、回合制游戏、策略游戏、放置休闲游戏、即时战斗、MMORPG 等,ioGame 都可以满足你的需求。

ioGame 在打包、内存占用、启动速度等方面也是优秀的。打 jar 包后大约 15MB,应用通常会在 0.x 秒内完成启动,内存占用小。详细请看 快速从零编写服务器完整示例

在生态融合方面,ioGame 可以很方便的与 spring 集成(5 行代码);除了 spring 外,还能与任何其他的框架做融合,如:solon ...等,从而使用其他框架的相关生态。

ioGame 在架构上解决了传统框架所产生的 N*N 问题与传统架构对比)。传统架构在扩展机器时,需要借助很多第三方中间件,如:Redis、MQ、ZooKeeper ...等,才能满足整体架构的运作。通常,只要引入了需要安装的中间件才能做到扩展的,那么你的架构或者说框架,基本上与轻量级无缘了。

在轻量级方面,ioGame 不依赖任何第三方中间件或数据库就能支持集群、分布式,只需要 java 环境就可以运行。这意味着在使用上简单了,在部署上也为企业减少了部署成本、维护难度。使用 ioGame 时,只需一个依赖即可获得整个框架,而无需安装其他服务,如: Nginx、Redis、MQ、Mysql、ZooKeeper、Protobuf 协议编译工具 ...等。

ioGame 具备全链路调用日志跟踪特性,这在分布式下非常的实用。该特性为每个请求分配一个唯一标识,并记录在日志中,通过唯一标识可以快速的在日志中过滤出指定请求的信息。ioGame 提供的全链路调用日志跟踪特性更是强大,支持跨机器、跨进程。简单的说,从玩家的请求进来到结束,无论该请求经过了多少个游戏逻辑服,都能精准记录。

在通讯方式方面,大部分框架只能支持推送(广播)这一类型的通讯方式;ioGame 则提供了多种类型的通讯方式,通过对各种通讯方式的组合使用,可以简单完成以往难以完成的工作,并且这些通讯方式都支持跨进程、跨机器通信,且具备全链路调用日志跟踪。这些通讯方式分别是

  1. 请求响应(单次请求处理)
  2. 广播(推送)
  3. 单个逻辑服间的相互通讯(可跨机器通信、可跨进程通信)
  4. 与同类型多个逻辑服相互通讯(可跨多个机器通信、可跨多个进程通信)
  5. 脉冲通讯(可跨多个机器通信、可跨多个进程通信)
  6. 分布式事件总线(类似 MQ、Redis 发布订阅机制;可跨多个机器通信、可跨多个进程通信)

在编码风格上,ioGame 为开发者提供了类 MVC 的编码风格(无入侵的 Java Bean ),这种设计方式很好的避免了类爆炸。同时,框架为开发者提供了同步、异步、异步回调的方法,用于逻辑服之间的相互访问;这使得开发者所编写的代码会非常的优雅,并且具备全链路调用日志跟踪。

从 ioGame21 开始,框架添加了虚拟线程的相关支持。各逻辑服之间通信阻塞部分使用虚拟线程,这样可以很好的避免阻塞业务线程,并大幅提高了框架的吞吐量。

在线程安全方面,框架为开发者解决了单个玩家的并发问题;即使玩家重新登录后,也会使用相同的线程来消费业务,并推荐使用领域事件来解决同一房间或业务内多个玩家的并发问题。框架在线程的扩展性上提供了友好的支持,开发者可以很容易的编写出无锁并发代码,这得益于 ioGame 独有的线程执行器设计与扩展。换句话说,你不会因为并发问题烦恼。

在无锁并发方面,ioGame 提供了优雅、独特的线程执行器设计。通过该特性,开发者能轻易的编写出无锁高并发的代码。

在连接方式方面,ioGame 允许开发者使用一套业务代码同时支持多种连接方式,无需进行任何修改。ioGame 已经支持了 TCP、WebSocket 和 UDP 连接方式,并且也支持在这几种连接方式之间进行灵活切换。连接方式是可扩展的,并且扩展操作也很简单,这意味着之后如果支持了 KCP,无论你当前项目使用的是 TCP、WebSocket 还是 UDP,都可以切换成 KCP;注意了,即使切换到 KCP 的连接方式,现有的业务代码也无需改变。

在通信协议方面,ioGame 让开发者用一套业务代码,就能轻松切换和扩展不同的通信协议,如 Protobuf、JSON 等。只需一行代码,就可以从 Protobuf 切换到 JSON,无需改变业务方法。

在增减协议方面,ioGame 可以让你在新增或减少协议时,无需重启游戏对外服与 Broker(游戏网关);这样既能避免玩家断线,又能避免因新增、减少协议而重启所有机器的痛点。

在协议碎片方面,action 支持自动装箱、拆箱基础类型特性,用于解决协议碎片的问题。同时该特性除了能使你的业务代码更加清晰以外,还能大幅提高开发者在该环节的生产力。

在集群方面,ioGame 的 Broker (游戏网关)采用无中心节点、自动化的集群设计,所有节点平等且自治,不存在单点故障。集群能够自动管理和弹性扩缩,节点加入或退出时,能够自动保证负载均衡和数据一致性,不影响服务可用性。

在分布式方面,ioGame 的逻辑服使用了分布式设计思想,将服务器分为游戏对外服游戏逻辑服等不同层次,并且每一层都有明确的职责和接口。这样可以提高代码可读性和可维护性,并且方便进行水平扩展

在学习成本方面,ioGame 的学习成本非常低,可以说是零学习成本,即使没有游戏编程经验,也能轻松上手。开发者只需掌握普通的 java 方法或 webMVC 相关知识,就能用框架开发业务。框架不要求开发者改变编码习惯,而是自身适应开发者的需求。

同进程亲和性方面,在同一进程内,不同 Netty 实例之间的通信,是通过内存进行传输的,不需要经过网络传输,数据传输速度极快。同进程亲和性指的是,优先访问同进程内的游戏逻辑服,当同进程内没有能处理请求的游戏逻辑服时,才会去其他进程或机器中查找能处理请求的游戏逻辑服;简单点说,框架对于请求的处理很智能,会优先将请求给同进程内的逻辑服消费。

在开发体验方面,ioGame 非常注重开发者的开发体验;框架提供了 JSR380 验证断言 + 异常机制业务代码定位,action 支持自动装箱、拆箱基础类型,用于解决协议碎片的问题 ...等。诸多丰富的功能,使得开发者的业务代码更加的清晰、简洁;

业务框架提供了插件机制,插件是可插拨、可扩展的。框架内置提供了 DebugInOutaction 调用统计业务线程监控插件各时间段调用统计插件...等插件;不同的插件提供了不同的关注点,比如我们可以使用调用、监控等插件相互配合,可以让我们在开发阶段就知道是否存在性能问题。合理利用好各个插件,可以让我们在开发阶段就能知道问题所在,提前发现问题,提前预防问题。

在分布式开发体验方面,通常在开发分布式应用时是需要启动多个进程的。这会让调试与排查问题变得非常困难,从而降低开发者的效率、增加工作量等,这也是很多框架都解决不了的问题,但 ioGame 做到了!ioGame 支持多服单进程的启动方式,这使得开发者在开发和调试分布式系统时更加简单。

与前端对接联调方面,ioGame 提供了游戏文档生成的辅助功能,可以做到代码即对接文档。简单地说,当业务代码编写完后,框架会自动生成最新的文档。如果没有游戏文档的生成,那么你将要抽出一些时间来编写、维护对接文档的工作,而且当团队人数多了之后,文档就会很乱、不同步、不是最新的、忘记更新等情况就会出现。

在部署方面,ioGame 支持多服单进程的方式部署,也支持多服多进程多机器的方式部署;在部署方式上可以随意的切换而不需要更改代码。日常中我们可以按照单体思维开发,到了生产可以选择使用多进程的方式部署。

在安全方面,所有的游戏逻辑服不需要开放端口,天然地避免了扫描攻击。由于不需要为每个逻辑服分配独立的端口,那么我们在使用诸如云服务器之类的服务时,就不需要担心端口开放权限的问题了。别小看这一个环节,通常这些小细节最浪费开发者的时间。由于我们不需要管理这些 IP:Port,这部分的工作量就自然地消失了

在模拟客户端测试方面,ioGame 提供了压测&模拟客户端请求模块。此模块是用于模拟客户端,简化模拟工作量,只需要编写对应请求与回调。除了可以模拟简单的请求外,通常还可以做一些复杂的请求编排,并支持复杂业务的压测。与单元测试不同的是,该模块可以模拟真实的网络环境,并且在模拟测试的过程中与服务器的交互是可持续的、可互动的,同时也是支持自动化的

架构灵活性方面,ioGame 的架构由三部分组成:1.游戏对外服、2.Broker(游戏网关)、3.游戏逻辑服;三者既可相互独立,又可相互融合。这意味着使用 ioGame 可以适应任何类型的游戏,因为只需通过调整部署方式,就可以满足不同类型的游戏需求。在 ioGame 中进行这些调整工作非常简单,而且不会对现有代码产生不良影响。

架构是可以动态扩缩的,游戏对外服、游戏逻辑服、Broker(游戏网关)都支持动态增加和减少。无论未来玩家数量增加或减少,我们都能够轻松应对。同时,架构是支持玩家无感知更新的,这得益于分布式设计。举例来说,如果 A 类型的游戏逻辑服需要增加一些新功能,我们可以启动 A-3、A-4 等已经支持了新功能的服务器,然后逐步将之前的 A-1 和 A-2 下线,从而实现了无感知的更新。

开发者基于 ioGame 编写的项目模块,通常是条理清晰的,得益于框架对路由的合理设计,同时也为路由提供了优雅的访问权限控制。当我们整理好这些模块后,对于其他开发者接管项目或后续的维护中,会是一个不错的帮助(模块的整理与建议)。或许现阶段你感受不到这块的威力,随着你深入地使用实践就能体会到这么设计的诸多好处与优势。

开发者基于 ioGame 编写的项目,通常是语法简洁的、高性能的、低延迟的。框架最低要求使用 JDK21,这样即可以让项目享受到分代 ZGC 带来的改进,还能享受语法上的简洁。分代 ZGC 远低于其亚毫秒级暂停时间的目标,可以在不影响游戏速度的情况下,清理掉多余的内存;这样就不会出现卡顿或者崩溃的问题了,相当于在项目中变相的引入了一位 JVM 调优大师。

综上所述,ioGame 是一个非常适合网络游戏开发的框架。可以让你轻松地创建高性能、低延迟、易扩展的游戏服务器,并且节省时间和资源。如果你想要快速地开发出令人惊艳的网络游戏,请不要犹豫,立即选择 ioGame 吧!框架屏蔽了很多复杂且重复性的工作,并可为项目中的功能模块结构、开发流程等进行清晰的组织定义,减少了后续的项目维护成本。

框架在开发、部署、压测&模拟测试 ...等,各个阶段都提供了很好的支持。相信你已经对 ioGame 有了一个初步的了解,虽然还有很多丰富的功能与特性没有介绍到,但你可以通过后续的实践过程中来深入了解。感谢你的阅读,并期待你使用 ioGame 来打造自己的游戏服务器。


ioGame 的组成

ioGame 由 [网络通信框架] 和 [业务框架] 组成

  • 网络通信框架:职责是各服务器之间的网络通信
  • 业务框架:职责是业务逻辑的处理方式和编写方式

网络通信框架 SOFABolt 是蚂蚁金融服务集团开发的一套基于 Netty 实现的网络通信框架。

  • 为了让 Java 程序员能将更多的精力放在基于网络通信的业务逻辑实现上,而不是过多的纠结于网络底层 NIO 的实现以及处理难以调试的网络问题,Netty 应运而生。
  • 为了让中间件开发者能将更多的精力放在产品功能特性实现上,而不是重复地一遍遍制造通信框架的轮子,SOFABolt 应运而生。

Bolt 名字取自迪士尼动画-闪电狗,是一个基于 Netty 最佳实践的轻量、易用、高性能、易扩展的通信框架。

业务框架 如果说 sofa-bolt 是为了让 Java 程序员能将更多的精力放在基于网络通信的业务逻辑实现上,而业务框架正是解决业务逻辑如何方便实现这一问题上。业务框架是游戏框架的一部分,职责是简化程序员的业务逻辑实现,业务框架使程序员能够快速的开始编写游戏业务。

业务框架对于每个 action (即业务的处理方法) 都是通过 asm 与 Singleton、Flyweight 、Command 等设计模式结合,对 action 的获取上通过 array 来得到,是一种近原生的方式。

单线程中,业务框架平均每秒可以执行 1152 万次业务逻辑。

业务框架性能报告JMH--点我展开

ioGameJmeter


上面是在单线程中的测试数据,业务框架平均每秒执行 1152 万次。


架构简图

ioGame

通过 ioGame 你可以很容易的搭建出一个集群无中心节点、集群自动化、分布式的网络游戏服务器!

从图中可以看出,游戏网关支持以集群方式启动多个实例。这个设计选择了集群的方式,因为游戏网关通常是无状态的,主要用于调度和转发任务

而游戏对外服、游戏逻辑服使用分布式设计,支持启动多个相同类型的服务。这意味着,当玩家数量增加时,我们可以轻松增加相应类型的游戏逻辑服以处理更多请求。

以游戏逻辑服为例,假设我们启动了两个 A 类型的游戏逻辑服,分别为 A-1 和 A-2。当玩家向 A 类型的游戏逻辑服发起多次请求时,游戏网关会使用默认的随机负载策略将请求分配给 A-1 和 A-2 来处理。

现在我们明白,游戏对外服和游戏逻辑服都支持动态增加和减少。无论未来玩家数量增加或减少,我们都能够轻松应对。架构是支持玩家无感知更新的,这得益于分布式设计。举例来说,如果 A 类型的游戏逻辑服需要增加一些新功能,我们可以启动 A-3、A-4 等已经支持了新功能的服务器,然后逐步将之前的 A-1 和 A-2 下线,从而实现了无感知的更新。

此外,框架还支持玩家动态绑定游戏逻辑服;玩家与游戏逻辑服绑定后,之后的请求都由该游戏逻辑服来处理。

除了游戏之外,ioGame 也适用于物联网相关项目。只需将图中的玩家视为具体的设备,即使存在数亿个设备,ioGame 的架构也可以轻松支持。从 2022 年开始,已经有一些物联网公司开始采用这一解决方案,并得到了很好的体验。

ioGame 适用于网络游戏服务器、物联网、内部系统及各种需要长连接的场景;

名称 扩展方式 职责
游戏对外服 分布式 与玩家连接、交互
游戏逻辑服 分布式 处理具体业务逻辑
Broker(游戏网关) 集群 调度和转发任务;

无锁异步化与事件驱动的架构设计、集群无中心节点、自带负载均衡、分布式支持、可动态增减机器、避免类爆炸的设计;

图中的每个游戏对外服、每个游戏逻辑服、每个 broker (游戏网关)都可以在单独的进程中部署,逻辑服之间可以跨进程通信(游戏对外服也是逻辑服的一种)。

游戏网关集群

broker (游戏网关)支持集群的方式部署,集群的使用是简单的,集群无中心节点、集群自动化、自带负载均衡。ioGame 本身就包含服务注册,你不需要外接一个服务注册中心,如 Eureka,ZooKeeper 等(变相的节约服务器成本)。

通过 broker (游戏网关) 的介入,之前非常复杂的负载均衡设计,如服务注册、健康度检查(后续版本提供)、到服务端的连接维护等这些问题,在 ioGame 中都不需要了,结构也简单了很多。实际上单台 broker (游戏网关) 性能已经能够满足了,因为游戏网关只做了转发。

逻辑服

逻辑服通常说的是游戏对外服和游戏逻辑服。逻辑服可以有很多个,逻辑服扩展数量的理论上限是 netty 的连接上限。

游戏对外服

对外服保持与用户(玩家)的长连接。先来个假设,假如我们的一台硬件支持我们建立用户连接的上限是 5000 人,当用户量达到 7000 人时,我们可以多加一个对外服务器来进行分流减压。由于游戏对外服扩展的简单性,意味着支持同时在线玩家可以轻松的达到百万、千万甚至更多。

即使我们启动了多个游戏对外服,开发者也不需要关心这些玩家连接到了哪个游戏对外服的问题,这些玩家总是能接收到广播(推送)消息的,因为框架已经把这些事情给做了;在玩家的角度我们只有“一个”服务器,同样的,在开发者的角度我们只有“一个”游戏对外服;

通常,有些开发者想知道游戏对外服最大支持多少玩家连接。关于这个问题,只需要搜索 Netty 相关知识即可,因为游戏对外服本质上是 Netty。

同样的,如果开发者已经熟悉了 Netty 相关知识,那么在游戏对外服的扩展上也会变得非常的容易。

在结构组合上(部署多样性)

在部署上,支持多服单进程的方式部署(类似单体应用、在分布式开发时,调试更加方便)、也支持多服多进程多机器的方式部署。

架构由三部分组成:1.游戏对外服、2.Broker(游戏网关)、3.游戏逻辑服;三者既可相互独立,又可相互融合,如:

  • 游戏对外服、Broker(游戏网关)、游戏逻辑服这三部分,在一个进程中;【单体应用;在开发分布式时,调试更加方便】
  • 游戏对外服、Broker(游戏网关)、游戏逻辑服这三部分,在多个进程中;【分布式】
  • 游戏对外服、Broker(游戏网关)这两部分在一个进程中;而游戏逻辑服在多个进程中;【类似之前游戏的传统架构】
  • 甚至可以不需要游戏对外服,只使用Broker(游戏网关)和游戏逻辑服这两部分,用于其他系统业务;

因为 ioGame 遵循面向对象的设计原则(单一职责原则、开闭原则、里式替换原则、依赖倒置原则、接口隔离原则、迪米特法则)等,所以使得架构的职责分明,可以灵活的进行组合;

游戏对外服是架构的三部分之一,默认的游戏对外服是基于 netty 实现的。如果有需要,将来我们还可以使用基于 mina、smart-socket 等通信框架编写,额外提供一个游戏对外服的实现;即使是使用 mina、smart-socket 提供的游戏对外服,也并不会影响现有的游戏逻辑服业务逻辑,因为游戏对外服满足单一职责原则,只维护用户(玩家)长连接相关的。

开发人员几乎都遇见过这么一种情况;在项目初期阶段,通常是以单体项目的方式进行开发,随着需求不断的增加与迭代,会演变成一个臃肿的项目;此时在对一个整体进行拆分是困难的,成本是极高的。甚至是不可完成的,最后导致完全的重新重构;

ioGame 提供了在结构组合上的部署多样性,通过组合的方式,在项目初期就可以避免这些拆分问题。在开发阶段中,我们可以使用单体应用开发思维,降低了开发成本。通过单体应用的开发方式,在开发分布式项目时,调试更加的方便;这既能兼顾分布式开发、项目模块的拆分,又能降低团队的开发成本;

架构其他疑问

问题一:如果一个请求经过 ioGame 再返回到客户端,对比直接用 Netty 搭个简单服务器,延迟会增加很多吗?纳秒级别还是毫秒级别?

答:是内存级。将三者部署在一起后,三者是通过内存进行传输的,不需要经过网络传输,数据传输速度极快。

原因分析,为了更好理解,现在把三者用字母代替,A.游戏对外服、B.Broker(游戏网关)、C.游戏逻辑服

  • ABC :三者在一个进程中,他们之间使用内存通信;
  • AB + C :【游戏对外服和游戏网关】在一个进程中,他们之间使用内存通信;
  • A + BC :【游戏网关和游戏逻辑服】在一个进程中,他们之间使用内存通信;

此外,ioGame 还支持同进程亲和性特性;如果我们启动了同类型的多个游戏逻辑服。【游戏网关】会优先选择与同进程的那个游戏逻辑服进行通信,使用内存通信;在同进程中没有找到时,会在同类型的多个游戏逻辑服中随机选出一个通信。

简单的一句话概括就是:同进程亲和性是指,优先访问同进程内的游戏逻辑服,当同进程内没有能处理请求的游戏逻辑服时,才会去其他进程或机器中查找能处理请求的游戏逻辑服;

所以,想要什么样的通信效果,取决于你所选择的启动方式(部署方式)。

问题二:如何更好的理解 ioGame 架构由三部分组成:1.游戏对外服、2.Broker(游戏网关)、3.游戏逻辑服;三者既可相互独立,又可相互融合?

这就好比编码时常用的三层 controller、service、dao

  • 将这三部分写在一个类也是可以的,【controller、service、dao】
  • 或者 【controller、service】+ dao
  • 又或者 controller +【service、dao】

不要将三者看成一台台生硬的机器,而是三份独立的代码。三者是可以随意组合的,这样可以满足开发者当前项目的不同需求。

ioGame 架构多样性

多服单进程、多服多进程的启动方式

架构优点

架构有很高程度的抽象,让设计者更加关注于业务,而无需考虑底层的实现、通信参数等问题。

逻辑服的位置透明性;同时,由于模块化、抽象化,使得整个架构各服务器之间耦合度很低,逻辑服注册即可用,大大增加了可伸缩性、可维护性,动态扩展变得简单而高效。由于逻辑服是注册到 Broker(游戏网关) 上的,所以逻辑服可以动态的增加、删除、改变;由于逻辑服之间耦合度较小,调试和测试的工作也是可控的;

架构比较清晰的就是,游戏对外服负责维护客户端的接入(用户、玩家的连接),游戏逻辑服专心负责业务逻辑,他们之间的调度由 Broker(游戏网关)来负责;因为架构拆分的合理,所以特别方便用 k8s 来自由伸缩部署这三种服,哪个服水位高就扩容哪个,水位过去了又可以缩容。

参考:构架简图中:对外服、游戏网关、游戏逻辑服各自的职责

通讯方式

ioGame 提供了多种类型的通讯方式,通过对各种通讯方式的组合使用,可以简单完成以往难以完成的工作,并且这些通讯方式都支持跨进程、跨机器通信的。

传统框架想要实现类似的通讯功能,只能借助大量的第三方中间件,而 ioGame 则无需任何中间件就能实现这些通讯功能。这意味着在使用上简单了,在部署上也为企业减少了部署成本、维护难度。

这些通讯方式都是通过扩展实现的,重点是支持可扩展。

一般传统的框架只提供了接收请求,当请求处理完后使用推送的方式将数据响应给请求端。但在使用 ioGame 时,不要被过去的传统框架束缚住,可以做任何大胆的设计,因为通讯方式足够丰富;

img

总的来说,ioGame 支持的通讯方式分为两大类,分别是路由类和主题类;下面分别对这些通讯方式做一些应用场景举例介绍。

框架对这些通讯方式提供了代码调用点的日志,简单点说就是框架可以让开发者知道,是在哪一行代码中触发的业务逻辑。

我们可以想象一下,假如框架没有提供代码调用点的日志会是什么样的;比如,游戏前端发送一个业务请求到游戏服务器中,但是处理这个请求的业务方法,会触发多个响应(通常是推送、广播)给游戏前端。一但时间久了,开发者是很难知道分别响应了哪些业务数据给游戏前端,特别是一些二手项目;所以这将是一个灾难性的问题,因为这会耗费大量的时间来寻找这些相关的业务代码。

多类型的通讯方式的详细内容--点我展开

1.单次请求处理

1.1 请求、无响应

action 处理逻辑时,使用是就是这种通讯方式。将方法声明为 void,无需给请求端任何响应;本质上是不给请求端推送任何数据;

当请求端发起请求后,游戏逻辑服不会发送任何响应给请求端。可以用在在网络通讯中,存在着不需要接收方回执确认的调用模型,如数据采集的场景: 打点采集、日志传输、metrics上报等。

在写 action 时,将方法返回值声名为 void 就表示处理 请求、无响应的。

1.2 请求、响应

action 处理逻辑时,使用是就是这种通讯方式。将数据 return 给请求端;本质上是将数据推送到请求端;

请求、响应是在游戏开发中常见的通讯模式,也就是通讯的一方发出请求,而远程通讯的对方做出响应,也就是常说的请求/响应模式。

比如:装备的升级、人物的升级、玩家的移动、抽奖、游戏前端到某一个场景时需要从游戏服务端获取一些对应的场景配置等;

在写 action 时,方法有返回值的就表示处理 请求、响应的,框架会将这个返回值给到请求端。

2.推送

2.1 指定单个或多个用户广播

服务器主动的将数据给【单个或多个玩家】

向一个或多个指定的用户(玩家)主动发送一些数据。比如:

  • 给指定的在线玩家发送一些奖励。
  • 给在同一个房间内的玩家广播一些数据,如某一个玩家射击子弹,把这子弹的数据广播给房间内的其他玩家。如几个玩家在同一个房间内打牌,某个玩家出牌后,把这张牌的数据广播给房间内的其他玩家。

2.2 全服广播

服务器主动的将数据给【全服在线的玩家】

给全服的所有在线玩家广播消息,如广播公告、即将停服维护等。

详细示例可参考:广播示例

3.单个逻辑服间的相互通讯

3.1【游戏逻辑服】与单个【游戏逻辑服】通信;- 有返回值(可跨进程)

1 : 1 的请求,也就是【单次请求处理】的通讯方式;支持进程内、跨进程、跨机器;开发者无需关心,一切都是自动的。

比如:我们有两个游戏逻辑服,分别是:a.天气预报逻辑服、b.战斗逻辑服。

现在我们设想一个回合制游戏的战斗场景,需要配合天气,根据天气来增强或者减弱某个英雄的能力。

那么在战斗开始前,战斗逻辑服只需要向游戏网关发起一个获取当前天气的请求,就可以得到当前的天气信息了,在根据当前的天气数据来增强或减弱该英雄的能力。

又比如:a.大厅逻辑服、b.奖励发放逻辑服。大厅记录着一些数据(房间总数),奖励发放逻辑服根据当前的房间数量,来生成不同奖品,随机发放给在线用户。

详细示例可参考:逻辑服与逻辑服之间的交互示例

3.2【游戏逻辑服】与单个【游戏逻辑服】通讯; - 无返回值(可跨进程)

1 : 1 的请求,也就是【单次请求处理】的通讯方式;支持进程内、跨进程、跨机器;开发者无需关心,一切都是自动的。

比如:我们有两个游戏逻辑服,分别是:a.匹配逻辑服、b.房间逻辑服。

业务场景如下,多个玩家在开始游戏前需要匹配。这里假设有两个玩家,当匹配完成后,给这两个玩家返回所匹配到的房间信息。

具体实现如下,两个玩家分别向匹配逻辑服发送匹配请求,匹配逻辑服收到玩家的请求后进行逻辑处理,并成功的把这两个玩家匹配到一起,此时我们把两个匹配到一起的玩家先称为匹配结果。

匹配逻辑服只负责匹配相关的算法逻辑,所以在匹配逻辑服中,我们可以把匹配结果给到房间逻辑服,因为与匹配相关的工作已经完成了。

在匹配逻辑服中,我们可以向房间逻辑服发起一个(单个逻辑服与单个逻辑服通信请求 - 无返回值)的请求,当房间逻辑服拿到匹配结果,根据匹配结果来创建房间。房间创建完成后把结果用推送(广播)给这两名玩家。

为什么要用无返回值的通信请求呢,因为匹配逻辑服并不关心房间的创建。

详细说明可参考:逻辑服与逻辑服之间的交互-无返回值

4.与同类型多个逻辑服相互通讯

4.1【游戏逻辑服】与同类型多个【游戏逻辑服】通信;- 可跨进程

1 : N 的请求,本质上是【单次请求处理】;支持进程内、跨进程、跨机器;开发者无需关心,一切都是自动的。

从多个游戏逻辑服中得到结果;

如: 【象棋逻辑服】有 3 台,分别是:《象棋逻辑服-1》、《象棋逻辑服-2》、《象棋逻辑服-3》,这些逻辑服可以在不同的进程中

我们可以在大厅逻辑服中向【同类型】的多个游戏逻辑服请求,意思是大厅发起一个向这 3 台象棋逻辑服的请求,框架会收集这 3 个结果集(假设结果是:当前服务器房间数)。

当大厅得到这个结果集,可以统计房间的总数,又或者说根据这些信息做一些其他的业务逻辑;这里只是举个例子。实际当中可以发挥大伙的想象力。

详细示例可参考:请求同类型多个逻辑服通信结果

其中配合动态绑定逻辑服节点;可以实现LOL、王者荣耀匹配后动态分配房间

4.2【游戏逻辑服】与多个【游戏对外服】通信;- 可跨进程

从多个游戏对外服中得到结果;

可以向游戏对外服拿一些玩家数据,或者是其他的一些操作。框架在游戏对外服中提供了 ExternalBizRegion 接口,可以使得开发者在游戏对外服中的扩展变得很简单。

框架利用这一通讯特性与 ExternalBizRegion 扩展,在不到 15 行的有效代码中,就实现了,如:查询用户(玩家)是否在线、强制用户(玩家)下线....等功能,从而实现了登录功能的增强:重复登录、顶号这些业务。

具体扩展与使用可以参考 获取游戏对外服的数据与扩展 文档

5.脉冲通讯

5.1 脉冲通讯

脉冲通讯与发布订阅类似,但是它除了具备发布订阅的无需反馈的方式,还增加了接收消息响应的动作,这是它与发布订阅的重要区别。

需要注意的是,脉冲通讯只是一种通讯方式,不能完全取代发布订阅,而是适用于一些特殊的业务场景。虽然在理论上,这些特殊的业务场景可以使用发布订阅来完成,但这会让代码变得复杂。

脉冲通讯方式 - 文档


6.分布式事件总线

6.1 分布式事件总线

分布式事件总线是 ioGame 提供的通讯方式之一。该通讯方式与 Guava EventBus、Redis 发布订阅、MQ ... 等产品类似。

如果使用 Redis、MQ ...等中间件,需要开发者额外的安装这些中间件,并支付所占用机器的费用;使用 Guava EventBus 则只能在当前进程中通信,无法实现跨进程。

而 ioGame 提供的分布式事件总线,拥有上述两者的优点。此外,还可以有效的帮助企业节省云上 Redis、 MQ 这部分的支出。

事件发布后,除了当前进程所有的订阅者能接收到,远程的订阅者也能接收到(支持跨机器、跨进程、跨不同类型的多个逻辑服)。可以代替 redis pub sub 、 MQ ,并且具备全链路调用日志跟踪,这点是中间件产品做不到的。

ioGame 分布式事件总线,特点

  • 使用方式与 Guava EventBus 类似
  • 具备全链路调用日志跟踪。(这点是中间件产品做不到的)
  • 支持跨多个机器、多个进程通信
  • 支持与多种不同类型的多个逻辑服通信
  • 纯 javaSE,不依赖其他服务,耦合性低。(不需要安装任何中间件)
  • 事件源和事件监听器之间通过事件进行通信,从而实现了模块之间的解耦
  • 当没有任何远程订阅者时,将不会触发网络请求。(这点是中间件产品做不到的)

分布式事件总线 - 文档


最后,发挥你的想象力,把这些类通讯方式用活,可以满足很多业务。

快速入门

业务交互

img

抽象的说,游戏前端与游戏服务器的的交互由上图组成。游戏前端与游戏服务器可以自由地双向交互,即发送和接收业务数据。业务数据由.proto文件作为载体,在前端和后端之间进行编码和解码。.proto文件是对业务数据的描述载体,定义了数据类型和消息类型,以及它们的属性和规则。

通过这种方式,游戏前端和游戏服务端可以建立连接,并开始相互传递业务数据,处理各自的业务。以上是对游戏前端与游戏服务器之间交互方式的介绍。接下来,我们将编写一个简单的游戏业务处理示例,并定制一个适合我们需求的业务数据协议。

协议文件

协议文件是对业务数据的描述载体,用于游戏前端与游戏服务器的数据交互。Protocol Buffers 是 Google 公司开发的一种数据描述语言,也简称 PB。协议文件描述还可以是 json、xml或者任意自定义的,因为最后传输时会转换为二进制,但游戏开发中 PB 是目前的最佳。

游戏前端

游戏前端的展现可以是 UnityUE(虚幻)CocosFXGL 或者其他的游戏引擎。这些游戏引擎只是展现游戏画面的一种形式,数据交互则由通信来完成(TCP、UDP 等)。游戏前端可以是 UnityUE(虚幻)CocosFXGL 或者其他的游戏引擎。

快速入门代码示例

这里主要介绍游戏服务器相关的,下面这个示例介绍了服务器编程可以变得如此简单。

协议文件定义

首先我们自定义一个协议文件,这个协议文件作为我们的业务载体描述。这个协议是纯 java 代码编写的,使用的是 jprotobuf,jprotobuf 是对 google protobuf 的简化使用,性能同等。

可以把这理解成 DTO、POJO 业务数据载体等,其主要目的是用于业务数据的传输;

/** 请求 */
@ProtobufClass
@FieldDefaults(level = AccessLevel.PUBLIC)
public class HelloReq {
    String name;
}

Action

游戏服务器的编程,游戏服务器接收业务数据后,对业务数据进行处理;下面这段代码可以同时支持 TCP、WebSocket、UDP 通信方式。

示例代码中展示了玩家的请求与响应处理,还展示了跨服(跨进程、跨机器)的请求处理的示例。

@ActionController(1)
public class DemoAction {
    @ActionMethod(0)
    public HelloReq here(HelloReq helloReq) {
        // 业务数据
        var newHelloReq = new HelloReq();
        newHelloReq.name = helloReq.name + ", I'm here ";
        return newHelloReq;
    }

    // 注意,这个方法只是为了演示而写的;(ioGame21 开始支持)
    // 效果与上面的方法一样,只不过是用广播(推送)的方式将数据返回给请求方
    @ActionMethod(0)
    public void here(HelloReq helloReq, FlowContext flowContext) {
        // 业务数据
        var newHelloReq = new HelloReq();
        newHelloReq.name = helloReq.name + ", I'm here ";

        flowContext.broadcastMe(newHelloReq);
    }

    // 跨服调用示例,下面分别展示了同步与异步回调的写法
    void testShowInvokeModule(FlowContext flowContext) {
        /*
         * 框架为跨服请求提供了同步、异步、异步回调的编码风格 api。(ioGame21 开始支持)
         */
        var cmdInfo = CmdInfo.of(1,0);
        var yourData = ... 你的请求参数
        
        // 跨服请求(异步回调 - 无阻塞)-- 路由、请求参数、回调。
        flowContext.invokeModuleMessageAsync(cmdInfo, yourData, responseMessage -> {
            var helloReq = responseMessage.getData(HelloReq.class);
             // --- 此异步回调,具备全链路调用日志跟踪 ---
            log.info("异步回调 : {}", helloReq);
        });


        // 跨服请求(同步 - 阻塞)-- 路由、请求参数。
        ResponseMessage responseMessage = flowContext.invokeModuleMessage(cmdInfo, yourData);
        var helloReq = responseMessage.getData(HelloReq.class);
        log.info("同步调用 : {}", helloReq);
    }
}

一个方法(here)在业务框架中表示一个 Action(一个业务动作)。

方法声明的参数是用于接收前端传入的业务数据,在方法 return 时,数据就可以被游戏前端接收到。程序员可以不需要关心业务框架的内部细节。

从上面的示例可以看出,这和普通的 java 类并无区别,同时这种设计方式避免了类爆炸。如果只负责编写游戏业务,那么对于业务框架的学习可以到此为止了。

游戏编程就是如此简单!

问:我可以开始游戏服务器的编程了吗?

是的,你已经可以开始游戏服务器的编程了。

访问示例(控制台)

当我们访问 here 方法时(通常由游戏前端来请求),控制台将会打印

┏━━━━━ Debug. [(DemoAction.java:4).hello] ━━━━━ [cmd:1-0 65536] ━━━━━ [逻辑服 [xxx逻辑服] - id:[76526c134cc88232379167be83e4ddfc]]
┣ userId: 1
┣ 参数: active : HelloReq(id=101, name=塔姆)
┣ 响应: HelloReq(name=塔姆, I'm here )
┣ 时间: 1 ms (业务方法总耗时)
┗━━━━━ [ioGameVersion] ━ [线程:User-8-2] ━ [连接方式:WebSocket] ━ [traceId:956230991452569600] ━

控制台打印说明

Debug. [(DemoAction.java:4).here]:
       表示执行业务的是 DemoAction 类下的 here 方法,4 表示业务方法所在的代码行数。
       在工具中点击控制台的 DemoAction.java:4 这条信息,就可以跳转到对应的代码中(快速导航到对应的代码)。

userId : 当前发起请求的 用户 id。

参数 : 通常是游戏前端传入的值。

响应 : 通常是业务方法返回的值 ,业务框架会把这个返回值推送到游戏前端。

时间 : 执行业务方法总耗时,我们可根据业务方法总耗时的时长来优化业务。

路由信息 : 路由 是唯一的访问地址。

ioGameVersion:表示当前所使用的 ioGame 版本。

线程:当前执行 action 所使用的线程。

traceId:全链路调用日志跟踪 id,每个请求唯一。

逻辑服:当前游戏逻辑服与其 id

连接方式:当前玩家所使用的连接方式,TCP、WebSocket、UDP

有了以上信息,游戏开发者可以很快的定位问题。如果没有可视化的信息,开发中会浪费很多时间在前后端的沟通上。问题包括:

  • 是否传参问题 (游戏前端说传了)
  • 是否响应问题(游戏后端说返回了)
  • 业务执行时长问题 (游戏前端说没收到响应, 游戏后端说早就响应了)

其中代码导航可以让开发者快速的跳转到业务类对应代码中,在多人合作的项目中,可以快速的知道业务经过了哪些方法的执行,使得我们可以快速的进行阅读或修改;


适合人群?

  1. 长期从事 web 内部系统开发人员, 想了解游戏的
  2. 刚从事游戏开发的
  3. 未从事过游戏开发,但却对其感兴趣的
  4. 对设计模式在实践中的应用和 sofa-bolt 有兴趣的学习者
  5. 可以接受新鲜事物的
  6. 想放弃祖传代码的

推荐实际编程经验一年以上的人员


框架内置功能

内置多种可选模块,可按需选择,以方便应用开发:

游戏服务器框架内置功能详细--点我展开
  • 领域事件 (轻量级单机最快MQ -- disruptor;可为你的系统实现类似 Guava-EventBus、Spring 事件驱动模型 ApplicationEvent、业务解耦、规避并发、不阻塞主线程... 等,各种浪操作。)
  • 任务延时器 (将来某个时间可对任务进行执行、暂停、取消等操作,并不是类似 Quartz 的任务调度)
  • 多环境切换 (不同运行环境下的配置支持)
  • light-jprotobuf (补足 jprotobuf 不能让多个对象在单个 .proto 源文件中生成的需求,并简化jprotobuf对源文件的注释)
  • 分布式锁 (基于Redisson的简单实现)
  • 压测&模拟客户端请求

内置的其他功能:


快速从零编写服务器完整示例

如果觉得 ioGame 适合你,可以看一下 快速从零编写服务器完整示例 。在这个示例中,你可以用很少的代码实现一个完整的、可运行的、高性能的、稳定的服务器。


坦克游戏示例

ioGame 源码内提供了一个基于 FXGL 游戏引擎的游戏示例 (坦克射击 启动文档),FXGL 是纯 java 开发的一个游戏引擎,可以在项目中直接运行。通过示例,可以快速的掌握网络游戏编程!

运行 TankApp.java 文件就可以启动游戏了。原计划用 U3D 来做游戏示例的,但想到大伙还得安装 u3d 的环境,就用 FXGL 来做游戏示例了。


参考

什么是 Action

快速从零编写服务器完整示例

坦克示例 (游戏前端)

广播(推送)相关示例与文档

逻辑服与逻辑服之间的交互示例

构架简图中:对外服、游戏网关、游戏逻辑服各自的职责

u3d 连接示例

cocosCreator 连接示例

安装与使用ioGame

参考 https://www.yuque.com/iohao/game/wsgmba

GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <https://www.gnu.org/licenses/>.

简介

无锁异步化、事件驱动架构设计的 java netty 网络编程框架; 轻量级,无需依赖任何第三方中间件或数据库就能支持集群、分布式; 适用于网络游戏服务器、物联网、内部系统及各种需要长连接的场景; 通过 ioGame 你可以很容易的搭建出一个集群无中心节点、集群自动化、分布式的网络服务器; 展开 收起
Java
AGPL-3.0
取消

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/iohao/ioGame.git
git@gitee.com:iohao/ioGame.git
iohao
ioGame
ioGame
dev

搜索帮助