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>