Scenes are meeting points for players, equivalent to rooms, A scene is distributed between peers connected to a Stormancer grid. All scenes have an host, which is authoritative on the scene logic itself and can accept or refuse connections, and authorize direct P2P connections between players connected to it. Most scenes are server hosted. Scenes exposes API and services through a set of routes, and can send messages on routes declared on clients which are connected to them. Server hosted scenes are automatically load balanced on the server grid which performs message routing transparently.

Creating a scene

Scenes are created using the grid REST management API. Scenes can be private or public, and persistent or not.

  • Any client can connect to a public scene. To connect to a private scene, trusted code must create first a connection token using the grid web API, and provide this token to the client. This token can contain additional private data that will be associated on the server with the client using the token.

  • Metadata about a persistent scene are stored in the grid database, so that the scene can be restarted automatically if shut down (because of inactivity or server shutdown). Furthermore, a persistent scene is started lazily the first time the scene is accessed. A non persistent scene is started at creation, but will definitely disappear after being shut down.

Most applications have a single public scene for bootstrapping and authentication. Once authenticated, the client may use the public scene to get tokens for connecting to other private scenes. This pattern is used by the authentication and service locator plugins provided with Stormancer.

Persistent scenes are used for persistent services (ie authentication, profile management, game finders, leaderboard, etc…) and non persistent scenes are perfect for temporary scenes like game sessions or parties (player groups). Non persistent scene being automatically cleaned up when not used anymore, sharing the lifecycle of a game session with a non persistent scene simplifies development.


Scene ids must only contain alphanumeric characters or ‘-’. They are matched against the following regex: ^[a-z0-9-]+$ .


Players don’t connect to the server itself, but to one or several scenes which host services.