category: Getting Started

Scenes are the main components of Stormancer applications. They are a virtual place where players are connected when they interact with the online multiplayer game.

They can impersonate concepts as different as:

  • A lobby
  • A chat room
  • A game session
  • A matchmaking queue
  • A zone in a persistent multiplayer game

Scenes provide events to react to player connections and disconnections, scene startup and shutdown and your code can use the scene object to query for player connections (to send them messages or remote procedure call) or to broadcast a message to all connected players.

Unused scenes (no player connected) are automatically garbage collected by the runtime after 5 minutes of inactivity.

Creating a scene

You can create a scene in the management website of your application (in the scenes tab), using the REST web API or the web API wrapper Library

Using the website, go into your management dashboard and clic on "Scenes"

enter image description here

You should access your scene management board. When you're in, clic on "Create a Scene".

enter image description here

It will pop a window up requesting you to fill several infos.

enter image description here

SceneId is the name you are going do give to your scene. This is the name you are goind to use in your client to access the scene.

The second field, here indicating "interpolator_scene" is the template your scene will be based on

Most scenes are created from a scene template declared in the server app code. See writing server code for more information.

The scene template is represented by a string and can be used when creating a scene to choose the functionalities of the new scene, a little like a prefab in Unity3D.

Scenes can accept Anonymous connections, in which case they are public, or require a signed, short duration authentication token created by the developer using the application key. In this case they are considered "private"

User data

When connecting to a scene, a player can be associated with custom data, provided either by the game client if the scene is public, or in a secure way by the game server if the scene is private.

Scene persistence

Scene can be made persistent or non persistent. Persistent scenes are saved in the database and can be awaken after garbage collection or server restart. They are ideal to create lobbies, matchmaking queues and authenticators

Non persistent scenes are started on creation and are lost on garbage collection. This option is often prefered to create one shot scenes like game sessions or non persistent chat channels.

Order: 2