Beamable Documentation

Welcome! Here is everything you need to get setup and become a Beamable expert.

Begin with the Getting Started section, learn more about Beamable features in the Manual, and check out the Script Reference APIs for advanced workflows.

Choose from the following...













.








.

Microservices

Create and deploy server-authoritative C#

Overview

This page includes everything needed to use this feature in the "Beamable SDK for Unity".

The purpose of this feature is to allow game makers to create and deploy server-authoritative C# functionality within their games.

📘

Related Guides & Video

A common use case for the feature is covered in the guides. See Adding Microservices for more info.

Example

Here a new c# server-side MicroserviceMicroservice - A Microservice architecture, or microservice, is a solution of developing software systems that focuses on building single-function modules with well-defined interfaces and operations. is created and exposes a method to be called by any c# client-side scope.

The source-code for both server-side and client-side sits local in your Unity project for efficiency and ease-of-use.

Creating a Microservice Calling a Microservice
            
namespace Beamable.Examples.Features.Microservices
{

  [Microservice("MyMicroservice")]
  public class MyMicroservice  : CustomMicroservice
  {
  
    [ClientCallable]
    public int GetLootboxReward()
    {
      Console.WriteLine("GetLootboxReward()");
      
      //if (IsAllowed), then reward 100 gold
      return 100;
    }
  }
}




            
        
namespace Beamable.Examples.Features.Microservices
{
   public class MyMicroserviceExample : MonoBehaviour
   {
      private MyMicroserviceClient  _myMicroservice;

      protected void Awake ()
      {
        _myMicroservice = new MyMicroserviceClient();

        _myMicroservice.GetLootboxReward()
            .Then(OnServerCallCompleted);
      }

      private void OnServerCallCompleted(int result)
      {
         //Result:100
         Debug.Log ($"Result:{result}");
      }
   }
}
            

Why Beamables Microservices?

Beamable's Microservice FeatureFeature - An individual aspect of the Beamable product used to create a great user experience is custom-built to provide the best workflow and performance for game makers.

A microservice architecture, or "microservice", is a solution of developing software systems that focuses on building single-function modules with well-defined interfaces and operations. See Wikipedia for more info.

Benefits

  • Highly maintainable & testable
  • Loosely coupled
  • Independently deployable

Like never before, programming a server-authoritative feature feels like a natural extension of your favorite client-side tools and workflows — powered by Beamable Microservices.

Now all your code lives in one place — shared between client and server.

The Microservice code is checked in alongside your client code to version control. With Beamable, there is less code since the system shares and serializes all client/server data structures.

Comparison

Beamable
C# Microservices

Amazon AWS Lambda

GameSparks
Cloud Code

Microsoft PlayFab
Cloud Script

C# Client Code

✔️

✔️

✔️

✔️

C# Server Code

✔️

Full Debugging Support
(Breakpoints, etc...)

✔️

Source Control Integration

✔️

Runs Locally During Development

✔️

Unity Workflow
(ScriptableObjects, etc...)

✔️

There are trade-offs as well. Games using server technology like Microservices must be connected to the internet, each server-side operation call is slower than a client-side operation due to network latency, and there are fees incurred to host or use servers.

Server-Authoritative Benefits

Typically in game development, game code is on the game client. This is a client-authoritative approach. Moving functionality to the back-end is a server-authoritative approach. There are pros and cons.

Invariably — today's games grow to need server-authoriative code.

Comparison: Client vs Server Benefits

Client-Authoritative

Server-Authoritative

Speed Of Development

✔️

Speed At Runtime

✔️

Speed To Release Updates

✔️

High Security (Anti-Cheat)

✔️

Examples

Example: Client-Authoritative

Imagine an in-game treasure chest ("loot box") containing a random prize for the player. The player is offered the loot box as a reward for progress in the game, opens the box, and receives the prize.

In a simple game with little or no back-end technology, the prize is offered, validated, and rewarded on the client-side. This is straight-forward to code, but is relatively insecure to any malicious hackers in the gaming community.

Example: Server-Authoritative

Now imagine some portion of the loot box code is moved to the server.

Now the the prize is offered, validated, and rewarded on the server-side. This is less straight-forward to code, but is relatively secure against any malicious hackers in the gaming community.

The benefits of a server-authoritative architecture are great. There are a few major ways to set it up.

A development team could write a custom back-end server setup. This is considerable time and effort, even for experienced teams. The team could choose an off-the-shelf solution. Beamable's Microservice feature provides power and ease of use.

Example: Beamable Microservice

Let's see how Beamable can help.

Imagine some portion of loot box code is moved to the server as a Beamable Microservice.

The prize is offered, validated, and rewarded on the server-side as a Microservice. The Microservice code sits in your Unity project along-side your client side code and is written in the familiar and powerful C# language. It is straight-forward to code and it is secure against any malicious hackers in the gaming community.

Updated 4 days ago


Microservices


Create and deploy server-authoritative C#

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.