Skip to content

Environment

We provide each game with 3 Environments: Development, Stage, and Production. It's a standard and commonly used approach.

  1. Development used during the development process. All new features and bug fixes are created here.
  2. Stage can be skipped by Indie developers. Big companies usually use it with their own QA department. This environment is used for testing all the features which were created before. A separate environment for testing is helpful because it doesn't require the development team to stop.
  3. Production is where all your live clients play.

Workflow

  1. New features are being developed and balanced in the Development environment.
  2. Open the Environment section and migrate your Development data to the Stage environment once ready.
  3. It'll erase all the changes you made in the Stage environment and copy everything from the Development.
  4. Give the build connected to the Stage environment to your QA.
  5. Once QA approves the build, transfer the data from Stage to Production and publish your game build (connected to the Production) in the stores.

Changing The Environment

You should try to avoid changing the environment in Balancy. In the best-case scenario, you must work in the Development and transfer the data to other environments.

However, there are situations when you need to change something in the Production environment.

Let's say you have published your game, and your users are playing in the Production environment. Then you find some bug in the balance, which you want to fix asap. Your team has already prepared many changes in the Development, so you can only migrate everything to the Production by updating the build. So the solution here is to switch to the Production environment in Balancy, fix your balance, and Deploy the changes. That's it! Remember to make the same changes in the Development.

How To Connect To The Proper Environment

We usually use Define Symbols to deal with different environments:

Balancy.Main.Init(new AppConfig
{
    ApiGameId = <API_GAME_ID>,
    PublicKey = <PUBLIC_KEY>,
    OnReadyCallback = response =>
    {
        if (!response.Success)
            Debug.LogError("Couldn't initialize Balancy");
    },
    Environment = GetEnvironment()
});

public static Balancy.Constants.Environment GetEnvironment()
{
#if SERVER_PROD
    return Balancy.Constants.Environment.Production;
#elif SERVER_STAGE
    return Balancy.Constants.Environment.Stage;
#else
    return Balancy.Constants.Environment.Development;
#endif
}

Then you need to switch the defined symbols between SERVER_DEV, SERVER_STAGE, and SERVER_PROD before you launch your game in Unity or make a build to connect to a different environment. Of course, you should be able to change the environment at runtime for testing purposes. Just be careful and don't let your end users be able to connect to an environment different from the Production.