For many game scenarios, it can be fine to simply send data back and forth as soon as possible, letting the server and connected clients deal with it as they find time to do so.
But sometimes, we want may some actions to be synchronous. Let’s say that there is a larger group of objects that we want to move, all at the same time, retaining their relative distance to each other. In the simple described above, the server would just iterate over the object’s updating their position and notifying clients and it went. This creates a problem; when the number of objects grow, the server might no longer be able to send all the data to the clients during the same client-side frame. This means that on the client, it would look like we first moved half the objects and then the other half on the next frame. Not exactly the synchronous movement we intended.
To solve problems such as this, we need to be able to guarantee that events which occur on the same frame on the server to also be updated for the same client-side frame and for this, Ophelia has a queue system. The queue system works by storing all changes made to game state during a game update, called a ‘tick’. When the server begins to update the game anew, the previous tick is sent to the network module, where it will be distributed to the server. This means that clients will only receive complete ticks of updates, never stray updates to single objects.

Be Sociable, Share!

Published by

Albert Öhrling

Studies computer science in Skellefteå, at Lulea University of Technology.

Leave a Reply

Your email address will not be published. Required fields are marked *