Improbable Icon

What is the consistency level for SpatialOS Entity Database?


#1

What kind of consistency SpatialOS gives us? Is that eventual consistency? i.e., if the writer updates the state of a component at T_1 and believes that its write operation has successfully fulfilled, may it possible that readers of this component get notified after several seconds (or several hundreds milliseconds)? I did not find a precise answer here https://improbable.io/features/engineering-real-time-streaming-database I’d appreciate the answer here.

If this is eventual consistency, how are we going to write the game logic that may cause state conflicts? For example, the writer worker believes an enemy has been killed, but the reader workers have not got notified during that short window, be it a couple of seconds or be it a couple of hundreds milliseconds?


#3

Hey @sean1,

Really sorry for the delay! We want to make sure we’ve got an accurate and correct answer for you on this, so bear with us and our engineers will respond back to you. Thanks for your patience in the meantime :slight_smile:

best,
Nee


#4

I had the same question – and was looking for the answer. Any updates?


#5

Hello @sean1,

Apologies for the wait but here is somewhat of an answer to your question. Depending on your interpretation of the concept of “consistency” things might get a little bit jumbled. Hence I’ll be as detailed as possible about assumptions and consequences.

You could say that an entire SpatialOS deployment, meaning the entity database and any connected workers, is “eventually consistent”. This is simply due to the nature of a distributed system as you have to account for the possibilities of network latency or even failure. However this is just a mere theoretical statement as it does not differ in any way from a non-SpatialOS multiplayer game.

Above all you mention state conflicts. The example of “an enemy has been killed” is quite instructive. In any multiplayer game (at least the ones that care about not letting people cheat) the decision of whether a player is killed or not is “server authoritative” instead of “client authoritative”. This does not change with SpatialOS as it is just a question of which worker is authoritative over the player’s health component.

As such the “state conflicts” are also troublesome for non-SpatialOS games. To illustrate this I’ll allow myself to rewrite the last paragraph of your message just by changing the terms “writer worker” and “reader workers” to something different.

For example, a player believes an enemy has been killed, but the other players have not got notified during that short window, be it a couple of seconds or be it a couple of hundreds milliseconds?

This shows the exact same “problem” but without SpatialOS. The root cause of the issue is not SpatialOS but rather the fact that network connections are unreliable. If you have played any fast-paced multiplayer shooter than you should know that when your internet connection experiences some lag it may happen that the headshot that you thought you had achieved actually missed, or other similar unfortunate results.

Please do tell if there are still things that are not clear enough to you.

Kind regards,
Duco