Implementation

Game Development with GS2

GS2-SDK is a game engine-specific SDK. Developers using Unity and Unreal Engine 5 can take advantage of the various features provided by this SDK.

Unity

“GS2-SDK for Unity” is available as an SDK for Unity. It is fully integrated with the Unity Package Manager (UPM) and SDK updates can be done through UPM.

Dependent libraries are LitJSON(Public Domain) / websocket-sharp(MIT) / Protocol Buffers(BSD). The GS2-SDK for Unity is available under Apache License 2.0 and all source code is available in the following GitHub repository

The GS2-SDK for Unity provides state management capabilities for data retrieved from the server. Data retrieved through the API is cached in a layer of the SDK, and when server values are updated, the cache is automatically updated as well.

Therefore, developers can call the GS2-SDK API from the Update function to access the latest values without having to think about reading data.

Example Implementation

    var result = await gs2.Account.Namespace(
        namespaceName: "namespace-0001"
    ).CreateAsync();

    var item = await result.ModelAsync();
    var userId = item.UserId;
    var password = item.Password;

GS2-UIKit for Unity

uikit.png

This is a more Unity-specific SDK.

By simply adding a component to a GameObject in the Unity editor, you can add a component to the text of the GameObject to reflect the number of items it has. You can enable or disable GameObjects depending on whether or not the limit has been reached.

If the implementation is as simple as retrieving data from the server and displaying it in the UI, the UI Kit can be used to accomplish this without any code.

Unreal Engine 5

GS2-SDK for Unreal Engine is available as an SDK for Unreal Engine 5. It is provided as a plugin for Unreal Engine and can be integrated into your project by simply placing code.

There are no external libraries to depend on and everything is implemented using standard Unreal Engine 5 functionality. GS2-SDK for Unreal Engine is licensed under Apache License 2.0 and all source code is available in the following GitHub repository

Example Implementation

    const auto Domain = Gs2->Account->Namespace(
        "namespace-0001" // namespaceName
    );
    const auto Future = Domain->Create(
    );
    Future->StartSynchronousTask();
    if (!TestFalse(WHAT, Future->GetTask().IsError())) return false;

    // obtain changed values / result values
    const auto Future2 = Future->GetTask().Result()->Model();
    Future2->StartSynchronousTask();
    if (!TestFalse(WHAT, Future2->GetTask().IsError()))) return false;
    const auto Result = Future2->GetTask().Result();

Blueprint SDK

blueprint.png

This SDK is more specific to Unreal Engine 5.

This SDK supports Blueprint, a node-based programming environment that can be developed in the Unreal Editor. The Blueprint SDK allows you to access GS2 functionality without having to use C++.


Extend

How to extend GS2’s microservices functionality.