Sign In Register

How can we help you today?

Start a new topic

How to synchronize single object state between different clients with real-time scripts?

Hi. I am developing football-based game. Basically, what I need it is to synchronize players and a ball position. I have created players, similarly to the official Tanks tutorial (position of players is just shared with all clients with interpolation). This works fine for me, and players sync OK. But I have some problems with a ball synchronization realization. What I want, is ball to be fully server authorative.

So what I expect:

 

1) Match Start - Ball is placed on default position (x0,y0).

2) Users send some forces/kicks (or other data needed to ball update) and server calculates new ball position.

3) New ball position is send to the players.


How to store ball position for every match and update it? Do I need to use DB (I do not prefer this way because it may be too slow) or there is any simpler way?

 

Anyway, if there is any other better solutions for my case, I am happy to listen.


1 person has this question

Maybe I was not clear enough. What I generally want is to store some data (ball position in my case) to update it often (so I think DB will be slow for that).

Hi Andriy,


Would the best solution here be to hold the balls position in a variable reference in the Real Time Session script. This way when the data required to move the ball gets submitted, this variable can be updated provided it passes your server authoritative checks, then have this variable position redistributed to the connected players. Would this seem like a viable solution to you?


Kind regards,

 - Steve

Hey Andriy did you manage to figure out how to do this yet?

Also how would i go about doing this in real time scripts as recommended by @customer support

Login to post a comment