- Home /
Networking Physics / Object Ownership / State Sync
I'm trying to find a good way to update an object's state. I'm not using SmartFox, Photon, or Unity's built-in networking because i couldn't get the results i wanted trough those. i decided to make my own server software using Java.
i already made connecting to servers, talking to players, and updating the players state. but updating an objects state isn't as easy as a players state.
what i have now: if a player picks up or moves an object, it sends it new location to the server, and the server sends the new location to the other players, resulting in everybody seeing the player picking up the object. but i don't think this is the right thing to do, because when another player picks it up, it either has to change its owner, or every player in the server constantly sends new object locations to the server which results in a mess of data being send to the server.
idk if someone already came across this problem because most people just use SmartFox or Unity's Build-in networking.
i hope someone can put me on the right path
thank you!
Answer by Fattie · Aug 19, 2012 at 03:14 PM
No problem at all, keep your current scheme.
Just add a quality "who's the boss"
You say: "when another player picks it up, it either has to change its owner"
Yes, that's exactly how it is done. Your rock should have a quality in the DB "operator". If someone touches it, change the owner to that new person.
Now, mark the time it changed operator. If someone else touches it, just DON'T change operators if it was less than say 3 seconds ago -- otherwise you will have it flip back and fore.
And/or .. if someone touches it, if someone else is ALREADY touching it, don't change operator.
Chances are the first system will work perfectly fine. Hope it helps !
thank you! i really thought i was going in a wrong direction, i can continue without questioning if I'm doing the right thing all the time :D!
great! thank goodness for the occasional advanced questions like this!
use Invoke! :)
Your answer
Follow this Question
Related Questions
Multiplayer objects isn't equals. 1 Answer
Networking sync enabled state? 1 Answer
[PUN] Syncing Rigidbodies across network. 1 Answer
Multiplayer Raycasting 0 Answers
A node in a childnode? 1 Answer