How remote config can help game developers to be more flexible than others games?

YusufAltun
Huawei Developers
Published in
6 min readApr 30, 2021

Hello everyone,

In this article, we will talk about HMS remote configuration and how it can help game developers to be more flexible than others games.

This article will be have two part. Firstly, i want to show you some ideas for Remote Config and how we can make our game better and more flexible. Secondly, i will show you details of development.

I will introduce you to how to implement Remote Config both Unity side and AppGallery Connect side. I have chosen Unity but Remote Config is supported other platforms also such as Cocos2d, Solar2d

Why HMS Remote Config?

We have two scenerio for the understand this better.

  • Scenerio 1: We need to build a dynamic game ball, this ball needed to be update as many times fo special time and events such as trend topic subjects(corona virus shape, politics icons, human rights), national dates, christmas, eids or somethis like that. You want to change your main game object dynamicly depends on futures events.
  • Scenerio 2: We needed to build a dynamic exam with branching on the questions, this exam needed to be updated as many times as your customers needs, besides that, another requirement was that we needed to change some style and colors on some of the screens and as a final requirement, some buttons needed to display an Images we didn’t have yet.

So, Whats should we do?

Update your for every event? Write your REST API and make your team much more busy? The are not the option, all you need HMS Remote Config for perfect solution.

And All Free of charge.

All you need internet

A little explanation of Remote Config?

Remote Config is part of Huawei Mobile Services SDK and its provides cloud-based services. By integrating the client SDK, your app can periodically fetch parameters and their values from the cloud. Remote Configuration checks whether a reported parameter has an on-cloud value update and returns the new value if so. Based on the parameter values fetched, you can implement the service processing logic to add behavior or appearance to your app.

Integrate the client SDK and access the console to change the appearance and behavior of your app, just by adjusting certain parameters on the cloud, rather than releasing a whole new version from scratch. Pretty cool, right? All we need HMS Remote Config.

For details , you can read below article.

Remote Config Diagram(https://developer.huawei.com/)

About Our Game

Let me quickly introduce my game to you, we have ball and game path we need to jump for next step. When we dont have any special event our game will start simple ball icon.

Default Game Screen

Development Process

We are using plugin for calling HMS services on Unity. This plugin is open source you can add or change some abilities.

To start using the plugin you must go here, the readme of the official GitHub page of the plugin and complete the phases.

You can look below example HMS-Unity Game integration also for details:

Enabling Remote Configuration

  1. Sign in to AppGallery Connect and click My projects.
  2. Click your project card and select the app for which you want to enable Remote Configuration from the app drop-down list on the top.
  3. Go to Grow > Remote Configuration. If it is the first time that you use Remote Configuration, click Enable now in the upper right corner.

Integrating SDKs

This part is easy, after you download HMS plugin you just need to enable services.

Huawei -> Kit Settings -> Kits

After we enable, this prefabs will come to scene and they have manager scripts for invoke HMS functions.

HMS Remote Configs Manager Script:

Setting Game Object Default Parameter Values

You can set game objectdefault parameter values in a Remote Configuration instance so that your app can run properly before being connected to Remote Configuration, and game object default parameter values are used if they are not set on the console.

  • We will use an XML resource file.

Update “…\UnityProjectPath\Assets\Resources\xml\remoteConfig.xml” file.

remoteConfig.xml
  • Call HMSRemoteConfigManager.ApplyDefault to pass the default values that will take effect immediately. (HMSRemoteConfigManager.cs script doing this by default)
  • Using a Dictionary object
  • Call RemoteConfigDemo.ApplyDefault() to pass the values.

Setting Parameter Values in Remote Configuration

You can create parameter values to override game object parameter values based on defined conditions in AppGallery Connect.

Define the parameters using the same names used in your app. For each parameter, you can set the default value (that will override the corresponding game object default value) and conditional values.

Parameter Management

  1. Sign in to AppGallery Connect and click My projects.
  2. Click your project card and select the app for which you want to set parameters from the app drop-down list on the top.
  3. Go to Grow > Remote Configuration.
  4. Click Add parameter to add a parameter.
  5. You can set multiple conditional values for a parameter. That is, the parameter value will vary depending on the condition. For details, please refer to Condition Management.

Add parameter:

Condition:

We use Fetch() method to pull the values from cloud.

And if the fetch method is successful, Apply(ConfigValues) method is used to save the values you get from the cloud.

The default interval for calling the fetch() method is 12 hours. You can call the Fetch(long intervalSeconds) method to customize the fetch interval.

To get the value of a key, you should call the following methods.

To get all values obtained in remote config, you should call GetMergedAll() method.

To get ConfigValues object returned by the last fetch method, you should call LoadLastFetched() method. And you can you can get the value of a key.

To find the source of a value, you should call getSource(String Key) method. And you must give a key value as string. And this method returns a string value.

Changing ball shape:

Thank you for reading this article.

I hope this gives you a starting point for Huawei Mobile Services and Unity integration.

References

https://github.com/EvilMindDevs/hms-unity-plugin/tree/2.0

https://developer.huawei.com/consumer/en/agconnect/remote-configuration/

--

--