Releases: iohao/ioGame
ioGame 21.23 Netty Java Game Server
Documentation and Logs
Releases: 1 to 2 versions are released every month, and upgrades within a major version are always compatible, such as 21.1 is upgraded to any higher version 21.x
Version update summary
perf(room): OperationHandler adds the processVerify method to control whether the process method is executed, and deprecates the verify method, which is replaced by processVerify.
perf(core): Optimize BoolValue and reduce the creation of objects
perf(net-core): Enhance the invokeModuleMessage and invokeModuleCollectMessage methods of the BrokerClientItem. The return value must not be null, and error information is added.
fix(generate-code): action_method_void.txt
perf(doc): GameCode Support single parameter construction method
perf(kit): #412
perf(room): Player adds isRobot method. Room adds methods to distinguish between real players and robot players.
refactor(proto): #414 Enumeration supports custom value
perf(room): room add hasSeat、isRealPlayer method
refactor(kit): RandomKit add randomLong method
refactor(core): Because the FlowContext method name setUserId is ambiguous, the method name is deprecated.
- Deprecated FlowContext setUserId method; see bindingUserId.
- Deprecated FlowContext setUserIdAndGetResult method; see bindingUserIdAndGetResult.
refactor(core): broadcastMe Added Tip: Please bind UserId before using this method, see FlowContext.bindingUserId.
perf(proto): Generate .proto files in parallel
refactor(proto): ProtoGenerateFile supports adding multiple proto packages
refactor(kit): TaskKit supports setting Timer
refactor(room): Deprecated OperationHandler verify, see processVerify
refactor(room): Add OperationCode and enhance Operation
About [core]
The name of the FlowContext setUserId method is ambiguous. This method is deprecated and replaced by the bindingUserId method.
flowContext.setUserId(userId); // Deprecated
flowContext.bindingUserId(userId); // now
About [kit]
TaskKit supports setting Timer
TaskKit.setTimer(new HashedWheelTimer(17, TimeUnit.MILLISECONDS));
About [room]
- Add hasSeat method to room to check whether there are any empty seats in the room.
- Room add isRealPlayer method.
- Add isRobot method to Player, and add method to distinguish real players from robot players to Room.
- Add OperationCode and enhance Operation
- Add processVerify method to OperationHandler to control whether to execute process method, and deprecate verify method, replaced by processVerify.
When processVerify returns false, process method will not be executed. There is an assertion mechanism in processVerify, and when there is no seat, an error code will be sent to the client to prompt the player.
public final class EnterRoomOperationHandler implements OperationHandler {
@Override
public boolean processVerify(PlayerOperationContext context) {
// assert room spaceSize
Room room = context.getRoom();
GameCode.roomSpaceSizeNotEnough.assertTrue(room.hasSeat());
long userId = context.getUserId();
long score = AccountKit.getScore(userId);
return score > 500;
}
@Override
public void process(PlayerOperationContext context) {
Room room = context.getRoom();
... enterRoom
}
}
Example of combining OperationCode with enumeration
@ProtobufClass
@ProtoFileMerge(fileName = FileMerge.fileName, filePackage = FileMerge.filePackage)
public enum MyOperation implements OperationCode {
/** quitRoom */
quitRoom,
/** inRoom */
inRoom
;
final int operationCode;
FairOperation() {
this.operationCode = OperationCode.getAndIncrementCode();
}
@Override
public int getOperationCode() {
return operationCode;
}
}
// config
public void configOperation() {
RoomService roomService = ...
OperationFactory factory = roomService.getOperationFactory();
// mappingUser operation
factory.mappingUser(MyOperation.inRoom, new InRoomOperationHandler());
factory.mappingUser(MyOperation.quitRoom, new QuitRoomOperationHandler());
}
About [proto]
-
Optimize .proto generation and process file generation in parallel.
-
ProtoGenerateFile supports adding multiple proto packages
Supports adding multiple proto packages to better support modularization
private static void generateProtoFile() {
String generateFolder = "/Users/join/gitme/game/MyGames/proto";
List<String> protoPackageList = List.of("com.iohao.happy.robot"
,"com.iohao.happy.email");
var protoGenerateFile = new ProtoGenerateFile()
// Generate the directory where the .proto file is stored
.setGenerateFolder(generateFolder)
// The package name to be scanned
.addProtoPackage(protoPackageList)
.addProtoPackage("com.iohao.happy.common.provide.proto");
// generate .proto
protoGenerateFile.generate();
}
- Enumeration supports custom values, java code and generated .proto
@ProtobufClass
@ProtoFileMerge(fileName = TempProtoFile.fileName, filePackage = TempProtoFile.filePackage)
public enum AnimalTypeEnum implements EnumReadable {
/** the cat */
cat(0),
/** the tiger */
tiger(10),
;
final int value;
AnimalTypeEnum(int value) {
this.value = value;
}
@Override
public int value() {
return this.value;
}
}
.proto
// TestAnimalTypeEnum
enum AnimalTypeEnum {
// the cat
cat = 0;
// the tiger
tiger = 10;
}
[other updates]
<netty.version>4.1.116.Final</netty.version>
ioGame 21.22 Netty Java Game Server
Documentation and Logs
Releases: 1 to 2 versions are released every month, and upgrades within a major version are always compatible, such as 21.1 is upgraded to any higher version 21.x
Version update summary
feat(GenerateCode): #329 Added TypeScript code generation TypeScriptDocumentGenerate, which can generate interactive code for CocosCreator、Vue、Angular.
About examples
- ioGameServerExample: https://github.com/iohao/ioGameExamples/tree/main/SdkExample
- CocosCreatorExample: https://github.com/iohao/ioGameSdkTsExampleCocos
- VueExample: https://github.com/iohao/ioGameSdkTsExampleVue
- HtmlExample: https://github.com/iohao/ioGameSdkTsExampleHtml
- AngularExample: https://github.com/iohao/ioGameSdkTsExampleAngular
public final class GenerateTest {
// setting root path
static String rootPath = "/Users/join/gitme/ioGame-sdk/";
public static void main(String[] args) {
// CHINA or US
Locale.setDefault(Locale.CHINA);
// Load the business framework of each gameLogicServer
// 加载游戏逻辑服的业务框架
yourListLogic().forEach(BrokerClientStartup::createBarSkeleton);
/*
* Generate actions, broadcasts, and error codes.
* cn: 生成 action、广播、错误码
*/
// About generating TypeScript code
// generateCodeVue();
// generateCodeAngular();
// generateCodeHtml();
generateCocosCreator();
// Added an enumeration error code class to generate error code related information
IoGameDocumentHelper.addErrorCodeClass(YourGameCodeEnum.class);
// Generate document
IoGameDocumentHelper.generateDocument();
}
private static void generateCodeVue() {
var documentGenerate = new TypeScriptDocumentGenerate();
// 设置代码生成所存放的路径,如果不做任何设置,将会生成在 target/code 目录中
// By default, it will be generated in the target/code directory
String path = rootPath + "ioGameSdkTsExampleVue/src/assets/gen/code";
documentGenerate.setPath(path);
// Your .proto path: Set the import path of common_pb in Vue.
documentGenerate.setProtoImportPath("../common_pb");
IoGameDocumentHelper.addDocumentGenerate(documentGenerate);
}
private static void generateCodeHtml() {
var documentGenerate = new TypeScriptDocumentGenerate();
// 设置代码生成所存放的路径,如果不做任何设置,将会生成在 target/code 目录中
// By default, it will be generated in the target/code directory
String path = rootPath + "ioGameSdkTsExampleHtml/src/assets/gen/code";
documentGenerate.setPath(path);
// Your .proto path: Set the import path of common_pb in Vue.
documentGenerate.setProtoImportPath("../common_pb");
IoGameDocumentHelper.addDocumentGenerate(documentGenerate);
}
private static void generateCocosCreator() {
var documentGenerate = new TypeScriptDocumentGenerate();
// 设置代码生成所存放的路径,如果不做任何设置,将会生成在 target/code 目录中
// By default, it will be generated in the target/code directory
String path = rootPath + "ioGameSdkTsExampleCocos/assets/scripts/gen/code";
documentGenerate.setPath(path);
// Your .proto path: Set the import path of common_pb in CocosCreator
documentGenerate.setProtoImportPath("db://assets/scripts/gen/common_pb");
IoGameDocumentHelper.addDocumentGenerate(documentGenerate);
}
private static void generateCodeAngular() {
var documentGenerate = new TypeScriptDocumentGenerate();
// 设置代码生成所存放的路径,如果不做任何设置,将会生成在 target/code 目录中
// By default, it will be generated in the target/code directory
String path = rootPath + "ioGameSdkTsExampleAngular/src/assets/gen/code";
documentGenerate.setPath(path);
// Your .proto path: Set the import path of common_pb in Vue.
documentGenerate.setProtoImportPath("../common_pb");
IoGameDocumentHelper.addDocumentGenerate(documentGenerate);
}
}
Advantages of SDK Code Generation
- Helps client-side developers reduce significant workload by eliminating the need to write a large amount of template code.
- Clear and semantically precise. The generated interaction code clearly defines parameter types and return types.
- Ensures parameter type safety and clarity in interface methods, effectively avoiding security risks and reducing basic errors during integration.
- Reduces communication costs between the server and client during integration; the code serves as documentation. The generated integration code includes documentation and usage examples, and the examples on the methods will guide you on how to use them, making it zero-learning-cost even for beginners.
- Helps client-side developers abstract away the interaction with the server, allowing them to focus more on the core business logic.
- Reduces the cognitive load during integration. The code is simple to use, similar to local method calls.
- Abandons the traditional protocol-based approach in favor of an interface-method-based integration approach.
ioGame 21.20 netty 分布式网络游戏服务器框架,真轻量级网络编程框架
Documentation and Logs
Releases: 1 to 2 versions are released every month, and upgrades within a major version are always compatible, such as 21.1 is upgraded to any higher version 21.x
Version update summary
- feat(GenerateDoc): Add DocumentMethod annotation : Action supports generating documentation method names through annotations.
- BroadcastDebug enhancements.
- feat(GenerateCode): #328 Added C# code generation CsharpDocumentGenerate, which can generate interactive code for Unity and Godot.
feat(GenerateDoc): Add DocumentMethod annotation : Action supports generating documentation method names through annotations.
By default, the method names in the generated action interaction code use the method names from the Java action. The action can add the DocumentMethod
annotation to fix the method name, and when generating the integration code, ioGame will prioritize using the value of the DocumentMethod
annotation.
@ActionController(SdkCmd.cmd)
public final class SdkAction {
@ActionMethod(SdkCmd.noReturn)
@DocumentMethod("noReturnMethod")
public void noReturn(String name) {
... ...
}
}
feat(GenerateCode): #328 Added C# code generation CsharpDocumentGenerate, which can generate interactive code for Unity and Godot.
About examples
- see https://github.com/iohao/ioGameExamples/tree/main/SdkExample
- UnityExample: https://github.com/iohao/ioGameSdkCsharpExampleUnity
- GodotExample: https://github.com/iohao/ioGameSdkCsharpExampleGodot
public final class GenerateTest {
// setting root path
static String rootPath = "/Users/join/gitme/ioGame-sdk/";
public static void main(String[] args) {
// CHINA or US
Locale.setDefault(Locale.CHINA);
// Load the business framework of each gameLogicServer
// 加载游戏逻辑服的业务框架
yourListLogic().forEach(BrokerClientStartup::createBarSkeleton);
/*
* Generate actions, broadcasts, and error codes.
* cn: 生成 action、广播、错误码
*/
// About generating C# code
generateCodeCsharpGodot();
generateCodeCsharpUnity();
// Added an enumeration error code class to generate error code related information
IoGameDocumentHelper.addErrorCodeClass(YourGameCodeEnum.class);
// Generate document
IoGameDocumentHelper.generateDocument();
}
private static void generateCodeCsharpUnity() {
var documentGenerate = new CsharpDocumentGenerate();
// 设置代码生成所存放的路径,如果不做任何设置,将会生成在 target/code 目录中
// By default, it will be generated in the target/code directory
String path = rootPath + "ioGameSdkCsharpExampleUnity/Assets/Scripts/Gen/Code";
documentGenerate.setPath(path);
IoGameDocumentHelper.addDocumentGenerate(documentGenerate);
}
private static void generateCodeCsharpGodot() {
var documentGenerate = new CsharpDocumentGenerate();
// 设置代码生成所存放的路径,如果不做任何设置,将会生成在 target/code 目录中
// By default, it will be generated in the target/code directory
String path = rootPath + "ioGameSdkCsharpExampleGodot/script/gen/code";
documentGenerate.setPath(path);
IoGameDocumentHelper.addDocumentGenerate(documentGenerate);
}
}
Advantages of SDK Code Generation
- Helps client-side developers reduce significant workload by eliminating the need to write a large amount of template code.
- Clear and semantically precise. The generated interaction code clearly defines parameter types and return types.
- Ensures parameter type safety and clarity in interface methods, effectively avoiding security risks and reducing basic errors during integration.
- Reduces communication costs between the server and client during integration; the code serves as documentation. The generated integration code includes documentation and usage examples, and the examples on the methods will guide you on how to use them, making it zero-learning-cost even for beginners.
- Helps client-side developers abstract away the interaction with the server, allowing them to focus more on the core business logic.
- Reduces the cognitive load during integration. The code is simple to use, similar to local method calls.
- Abandons the traditional protocol-based approach in favor of an interface-method-based integration approach.
[other updates]
<protobuf-java.version>3.25.5</protobuf-java.version>
ioGame 21.19 netty 分布式网络游戏服务器框架,真轻量级网络编程框架
Documentation and Logs
Releases: 1 to 2 versions are released every month, and upgrades within a major version are always compatible, such as 21.1 is upgraded to any higher version 21.x
Version update summary
- [core] FlowContext provides the setUserId method to simplify the login operation.
- [broker] Added RingElementSelector load balancing implementation and set it as default to replace RandomElementSelector
- [core] #386 Action supports constructor injection with parameters in Spring
- Simplify the implementation class of ActionParserListener related to ProtoDataCodec. and #386
- perf(i18n): 🐳 #376 cmd check tips
- refactor(external): simplify and improve externalCache
[core] FlowContext provides the setUserId method to simplify the login operation.
@ActionController(LoginCmd.cmd)
public class TheLoginAction {
... ...
@ActionMethod(LoginCmd.login)
public UserInfo loginVerify(LoginVerify loginVerify, FlowContext flowContext) {
long userId = ...;
// Deprecated
boolean success = UserIdSettingKit.settingUserId(flowContext, userId);
// now
boolean success = flowContext.setUserId(userId);
return ...;
}
}
[core] #386 Action supports constructor injection with parameters in Spring
// Action supports constructor injection in Spring.
@Component
@AllArgsConstructor
@ActionController(PersonCmd.cmd)
public class PersonAction {
final PersonService personService;
...
}
refactor(external): simplify and improve externalCache
// create externalCache
private static void extractedExternalCache() {
// Deprecated
DefaultExternalCmdCache externalCmdCache = new DefaultExternalCmdCache();
// now
var externalCmdCache = ExternalCmdCache.of();
}
[other updates]
<netty.version>4.1.114.Final</netty.version>
ioGame 21.18 netty 分布式网络游戏服务器框架,真轻量级网络编程框架
文档与日志
- ioGame javadoc api
- 框架版本更新日志 (yuque.com) - ioGame update logs
- ioGame 真.轻量级网络编程框架 - 在线使用文档 - User Manual
ioGame 每月会发 1 ~ 2 个版本,通常在大版本内升级总是兼容的,如 21.1 升级到任意 21.x 的高版本。
Releases: 1 to 2 versions are released every month, and upgrades within a major version are always compatible, such as 21.1 is upgraded to any higher version 21.x
版本更新汇总
[core]
#376 Support i18n, such as logs and internal messages. 框架内的日志、内部消息支持 i18n。
public class DemoApplication {
public static void main(String[] args) {
// setting defaultLocale, such as US or CHINA
Locale.setDefault(Locale.US);
Locale.setDefault(Locale.CHINA);
... start ioGame
}
}
[其他更新]
<scalecube.version>2.6.17</scalecube.version>
ioGame 21.17 netty 分布式网络游戏服务器框架,真轻量级网络编程框架
文档与日志
ioGame 每月会发 1 ~ 2 个版本,通常在大版本内升级总是兼容的,如 21.1 升级到任意 21.x 的高版本。
版本更新汇总
- [core] 简化 TraceIdSupplier 默认实现(全链路调用日志跟踪)
- [core] FlowContext 提供用户(玩家)所关联的用户线程执行器信息及虚拟线程执行器信息方法
[core]
FlowContext 提供用户(玩家)所关联的用户线程执行器信息及虚拟线程执行器信息方法
void testThreadExecutor(FlowContext flowContext) {
// 获取 - 用户(玩家)所关联的用户线程执行器信息及虚拟线程执行器信息
// 用户虚拟线程执行器信息
ThreadExecutor virtualThreadExecutor = flowContext.getVirtualThreadExecutor();
// 用户线程执行器信息
ThreadExecutor threadExecutor = flowContext.getThreadExecutor();
threadExecutor.execute(() -> {
log.info("execute");
});
threadExecutor.executeTry(() -> {
log.info("executeTry");
});
// get Executor
Executor executor = threadExecutor.executor();
}
netty 分布式网络游戏服务器框架,真轻量级网络编程框架 ioGame 21.16
文档与日志
ioGame 每月会发 1 ~ 2 个版本,通常在大版本内升级总是兼容的,如 21.1 升级到任意 21.x 的高版本。
版本更新汇总
- [kit] #291 增加轻量可控的延时任务
- [kit] 细分时间日期相关工具。
- [Archive] #363 light-redis-lock 相关模块
- [Archive] #364 light-timer-task 相关模块
- [core] 增加同一个 ActionController 相同的 action 方法名只允许存在一个的检测。
- [core] Banner 增加启动时的错误数量提示。
- [core] #365 支持对接文档生成时,可以根据路由访问权限来控制文档的生成
[kit]
#291 增加轻量可控的延时任务
for example
@Test
public void example() {
long timeMillis = System.currentTimeMillis();
DelayTask delayTask = DelayTaskKit.of(() -> {
long value = System.currentTimeMillis() - timeMillis;
log.info("1 - 最终 {} ms 后,执行延时任务", value);
})
.plusTime(Duration.ofSeconds(1)) // 增加 1 秒的延时
.task(); // 启动任务
delayTask.plusTimeMillis(500); // 增加 0.5 秒的延时
delayTask.minusTimeMillis(500);// 减少 0.5 秒的延时时间
// 因为 taskId 相同,所以会覆盖之前的延时任务
String taskId = delayTask.getTaskId();
delayTask = DelayTaskKit.of(taskId, () -> {
long value = System.currentTimeMillis() - timeMillis;
log.info("2 - 最终 {} ms 后,执行延时任务", value);
})
.plusTime(Duration.ofSeconds(1)) // 增加 1 秒的延时
.task(); // 启动任务
// 取消延时任务,下面两个方法是等价的
delayTask.cancel();
DelayTaskKit.cancel(taskId);
// 可以通过 taskId 查找该延时任务
Optional<DelayTask> optionalDelayTask = DelayTaskKit.optional(taskId);
if (optionalDelayTask.isPresent()) {
var delayTask = optionalDelayTask.get();
}
// 通过 taskId 查找延时任务,存在则执行给定逻辑
DelayTaskKit.ifPresent(taskId, delayTask -> {
delayTask.plusTimeMillis(500); // 增加 0.5 秒的延时时间
});
}
细分时间日期相关工具。
see com.iohao.game.common.kit.time
[Archive]
#363 light-redis-lock 相关模块
将 light-redis-lock、light-redis-lock-spring-boot-starter 模块做归档。
在过去的时间里,由于一直没有改动这些模块的相关内容,现决定将不再上传到 maven 库中,以节约公共资源。如果你使用了该模块的相关内容,请指定最后一个版本即可。如
<!-- https://mvnrepository.com/artifact/com.iohao.game/light-redis-lock -->
<dependency>
<groupId>com.iohao.game</groupId>
<artifactId>light-redis-lock</artifactId>
<version>21.15</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.iohao.game/light-redis-lock-spring-boot-starter -->
<dependency>
<groupId>com.iohao.game</groupId>
<artifactId>light-redis-lock-spring-boot-starter</artifactId>
<version>21.15</version>
</dependency>
模块相关文档 - redis-lock 分布式锁 (yuque.com)
#364 light-timer-task 相关模块
将 light-timer-task 模块做归档。
在过去的时间里,由于一直没有改动这些模块的相关内容;同时,也因为框架内置了类似的功能 #291 。现决定将不再上传到 maven 库中,以节约公共资源。如果你使用了该模块的相关内容,请指定最后一个版本即可。如
<!-- https://mvnrepository.com/artifact/com.iohao.game/light-timer-task -->
<dependency>
<groupId>com.iohao.game</groupId>
<artifactId>light-timer-task</artifactId>
<version>21.15</version>
</dependency>
模块相关文档 - timer-task 任务延时器 (yuque.com)
类似的代替 轻量可控的延时任务 (yuque.com)
[core]
#365 支持对接文档生成时,可以根据路由访问权限来控制文档的生成
生成相关代码的使用及相关文档
ExternalGlobalConfig.accessAuthenticationHook
,相关文档 - 路由访问权限控制 (yuque.com)- IoGameDocumentHelper,相关文档 - 游戏对接文档生成 (yuque.com)
for example
public class MyExternalServer {
public static void extractedAccess() {
// https://www.yuque.com/iohao/game/nap5y8p5fevhv99y
var accessAuthenticationHook = ExternalGlobalConfig.accessAuthenticationHook;
... 省略部分代码
// 添加 - 拒绝玩家访问权限的控制
accessAuthenticationHook.addRejectionCmd(RankCmd.cmd, RankCmd.internalUpdate);
}
}
public class TestGenerate {
... 省略部分代码
public static void main(String[] args) {
// 对外服访问权限控制
MyExternalServer.extractedAccess();
// (复用)设置文档路由访问权限控制
IoGameDocumentHelper.setDocumentAccessAuthentication(ExternalGlobalConfig.accessAuthenticationHook::reject);
// ====== 生成对接文档、生成 proto ======
// generateCsharp();
// generateTypeScript();
// 生成文档
IoGameDocumentHelper.generateDocument();
// .proto 文件生成
// generateProtoFile();
}
}
预览 - 没有做控制前的生成
==================== RankAction ====================
路由: 4 - 1 --- 【listRank】 --- 【RankAction:48】【listRank】
方法参数: StringValue 排行类型
方法返回值: ByteValueList<RankUpdate> 玩家排行名次更新
路由: 4 - 10 --- 【玩家排行名次更新】 --- 【RankAction:60】【internalUpdate】
方法参数: RankUpdate 玩家排行名次更新
方法返回值: void
预览 - 加入了访问控制后的生成
我们可以看见,路由为 4-10 的 action 方法没有生成到对接文档中。
==================== RankAction ====================
路由: 4 - 1 --- 【listRank】 --- 【RankAction:48】【listRank】
方法参数: StringValue 排行类型
方法返回值: ByteValueList<RankUpdate> 玩家排行名次更新
提示:除了文档文档的访问权限控制外,还支持 SDK TypeScript、SDK C# ...等客户端代码生成的访问权限控制。
SDK 相关请阅读:SDK&对接文档 (yuque.com)
[其他更新]
<netty.version>4.1.113.Final</netty.version>
netty 分布式网络游戏服务器框架 & 真轻量级网络编程框架 ioGame 21.15
文档与日志
通常在大版本内升级总是兼容的,如 21.1 升级到任意 21.x 的高版本。
ioGame 发版本的频率:每月会发 1 ~ 2 个版本。
版本更新汇总
- [core] #351 增加 UserProcessor 线程执行器的选择策略扩展
- [core] #350 修复请求消息在 Broker 环节乱序的问题
- [core] #353 对接文档支持框架内置错误码的生成
- [core] #354 日志打印调整
- [core] #359 [逻辑服-监听] 增加打印其他进程逻辑服的上线与下线信息
- [core] 优化 ThreadExecutorRegion 相关实现类。
- [external] UserSession 接口新增 ofRequestMessage 方法,简化玩家在游戏对外服中创建请求对象。
[external]
UserSession 接口新增 ofRequestMessage 方法,简化玩家在游戏对外服中创建请求对象。
for example
var cmdInfo = CmdInfo.of(1, 1);
RequestMessage request = userSession.ofRequestMessage(cmdInfo);
[core]
#359 [逻辑服-监听] 增加打印其他进程逻辑服的上线与下线信息
public class MyLogicServer extends AbstractBrokerClientStartup {
...
@Override
public BrokerClientBuilder createBrokerClientBuilder() {
BrokerClientBuilder builder = BrokerClient.newBuilder();
...
// 添加监听 - 打印其他进程逻辑服的上线与下线信息
builder.addListener(SimplePrintBrokerClientListener.me());
return builder;
}
}
#351 增加 UserProcessor 线程执行器的选择策略扩展
for example
// 为请求消息开启有序的、多线程处理的优化
IoGameGlobalConfig.enableUserProcessorExecutorSelector();
注意事项:当你的 UserProcessor 做了线程执行器的选择策略扩展,需要重写 CustomSerializer 接口的相关方法。
ioGame 21.14,netty 分布式游戏服务器框架;java 分步式游戏服务器框架;
ioGame 发版本的频率:每月会发 1 ~ 2 个版本。通常在大版本内升级总是兼容的,如 21.1 升级到任意 21.x 的高版本。
文档与日志
版本更新汇总
- [code quality] 提升代码质量
- [javadoc] 增强相关模块的 javadoc :业务框架、压测与模拟客户端请求、领域事件、Room
- [core] #346 业务框架 InOutManager 提供扩展点
- [core] #344 登录时,如果 FlowContext 存在 userId 就不请求游戏对外服
- [broker] fixed #342 非集群环境下,Broker 断开重启后,逻辑服没有将其重新加入到 BrokerClientManager 中所引发的 NPE。
[core]
#346 业务框架 InOutManager 提供扩展点
在构建器中配置 InOutManager 策略,框架内置了两个实现类,分别是
- ofAbcAbc :in ABC,out ABC 的顺序,即编排时的顺序。
- ofPipeline:in ABC,out CBA 的顺序,类似的 netty Pipeline 。(默认策略,如果不做任何设置,将使用该策略)
for example
在构建器中配置 InOutManager 策略
public void config() {
BarSkeletonBuilder builder = ...;
builder.setInOutManager(InOutManager.ofAbcAbc());
builder.setInOutManager(InOutManager.ofPipeline());
}
ioGame 21.13,netty 分布式游戏服务器框架;java 分步式游戏服务器框架;
文档与日志
版本更新汇总
- [external] #334 顶号操作 bug,有概率触发并发问题
- [core] FlowContext 新增 createRequestCollectExternalMessage 方法
- [javadoc] 源码 javadoc 增强
[core]
FlowContext 新增 createRequestCollectExternalMessage 方法,request 与游戏对外服交互。相关使用文档请阅读 获取游戏对外服的数据与扩展 (yuque.com)
... ... 省略部分代码
@ActionMethod(ExternalBizRegionCmd.listOnlineUserAll)
public List<Long> listOnlineUserAll(FlowContext flowContext) {
// 创建 RequestCollectExternalMessage
var request = flowContext
.createRequestCollectExternalMessage(MyExternalBizCode.onlineUser);
// 访问多个【游戏对外服】
var collectExternalMessage = flowContext
.invokeExternalModuleCollectMessage(request);
return listUserId(collectExternalMessage);
}
[其他更新]
<netty.version>4.1.112.Final</netty.version>
<lombok.version>1.18.34</lombok.version>