Skip to main content

Gameplay overview

How it works?

With Elympics SDK you’ll be able to create a game that runs simultaneously on a server and a client device. Using the server authoritative architecture, we ensure the safety of the game and by simulating the game on the client’s machine (prediction) we eliminate input lag and reduce the influence of a bad Internet connection.

Important!

It is crucial to understand server authoritative principles and apply them to your game. The main concept is that the game logic MUST be processed on the server, with the client influencing it only by sending inputs.

If you also want to learn why this particular approach, read article describing alternatives.

You also don’t have to write separate code for the server part. You can simply mark things that you want to be server/client exclusive and make one game that will run on both instances. The client instance will send its inputs to the server, which will then send back confirmed state. The client can simulate its own state with prediction mechanism, but note that correction called reconciliation may occur if there is a difference in state compared to the server.

Functionalities:

  • Built-in game state synchronization
  • Common code on server and client (forced by SDK architecture)
  • Prediction
  • Reconciliation
  • Testing in the Editor both using clones and half remote mode and using online server
  • One click cloud deployment (that will let us host your server)
  • Server hosting with parallel gameplay simulation

Initial setup

  1. Make sure that your game follows both design and technical development principles.
  2. Create an account and your game in the developers console.
  3. Configure a Solo queue if your game is meant to be asynchronous multiplayer (played solo, competing in leaderboards).
  4. You must set up and install Elympics Package as per the instructions in this guide.
  5. Add Elympics object to your gameplay scene (right mouse button at the hierarchy -> Elympics -> ElympicsSystem).

Running in the Editor

In order to make your development easier, Elympics offers Half Remote mode, using the included ParallelSync package. This allows you to open two (or more) different Unity Editor instances and test the Server - Client behaviours.

important

Half Remote only works for the Gameplay scene but that is enough for the first phase of the development, since the lobby (menu) scene can be delayed until it is completed. We heavily recommend starting with gameplay scene Server authoritative approach & input syncing.

Gameplay integration

tip

Don't fall into the trap of creating a single player game and then changing it to a multiplayer one, as it is easier to build your game with the correct architecutre in mind. Jump straight into multiplayer development, beginning with networking code and Half Remote development mode.

Input syncing

Player's actions (input) should not affect the game world immediately after registering them but go through gathering input phase, sending it to the server and only then applying its effects. Please check out this page for more information

Elympics also supports RPC calls for single time inputs.
Please check out this page for more information

note

It's recommend to run the server Half Remote instance at 640 x 480 resolution as this is the resolution it will run online. It is important to know when mapping and sending the mouse position as an input.

Game logic synchronization

To ensure both Server & Client are always the same, it is important to synchronize the state of gameplay and run its logic in the ElympicsUpdate.

Randomization

The provide randomization, synchronizing the random seed between your Server & Client is crucial for ensuring both scenes are always the same. You can find more information on this page and in the youtube video

Player handling

In your server you will should handle player connections / disconnections. For example for starting game when player client is connected.
Elympics provides an interface to track this easily, please inherit from IServerHandlerGuid (works only for the server instance). There is also a default implementation for it which handles closing the game if any player disconnects.

Finishing a match

Additionally, the server must handle ending the game as it's the only instance that is allowed to submit score to our leaderboards.
To do this you can copy this code snippet:

private void EndGame()
{
// retrieve the final score of your user, this value should be the same in Client & Server
var score = ScoreManager.score;

if (Elympics.IsServer)
{
Elympics.EndGame(new ResultMatchPlayerDatas(new List<ResultMatchPlayerData> { new ResultMatchPlayerData { MatchmakerData = new float[1] { score } } }));
}

// logic to display end game visually here
. . .
}
note

Elympics.EndGame() do not work in Half Remote.

Using it with a deployed server automatically closes it and submits the score to our backend. The scores will NOT be saved to our backend if the server is not deployed.

Testing with the online server

For that, you need to upload the server build.
Then, run the game from the lobby scene or with Debug Online Player mode (using the gameplay scene) instead of Half Remote.

tip

Remember to update and test your cloud builds relatively often since Half Remote cannot imitate production environment perfectly and networking behaviors can differ slightly.

More learning resources

Whole gameplay creation process

You can also learn from a more general video tutorial, participate in the online course, or check out a template project

Useful development tips

If you want more insight into the topic of integrating gameplay with Elympics SDK visit general development tips article .

I have working gameplay loop - what's next?

Once you are finished with the gameplay, it's time to implement the lobby scene.