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.

Data Migration

In the Environment section, you can migrate your data

  1. From Development to Stage
  2. From Stage to Production

When you start a migration process, many things are happening. For example, when you transfer the data from Dev to Stage, under the hood is happening:

  1. Deploy is called for Development. Meaning that we validate data and generate JSONs into CDN.
  2. All the data is transferred from Dev to Stage, overriding all the changes made in Stage before.
  3. Deploy is called for Stage. Meaning that we validate data and generate JSONs into CDN.

If you want to send all the data from the Dev to Prod, you must transfer the data from Dev to Stage and then to Prod. You don't need to Deploy anything afterward. That was already made during the migration.

Migration Type

Usually you make full migration, but sometimes you need to move between environments only products or data structures.

Partial migration

If you move only structures or products, the deployment process will not be run.

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.