Page 1 of 1
going in depth with smartfox and openspace...
Posted: 04 Dec 2008, 10:00
by nig3d
Hi,
I have 2 questions, sorry if I'm quick.
1) is the path actually computed on the server? I ask this because I opened two clients on the same pc and the client where the moving avatar was an "host", got the onMovementStop before than the client creating the moving avatar (because of the background process, the original client was slower than the other client)
2) long ago you suggested me to use the Skin to set the avatar state, so far so good. The only problem is that for each avatar state changing, including direction change, I need to broadcast the skin again, since the state is part of the skin, I can't just set the state in the user variable without caring about the skin. Have you any suggestion about this?
Posted: 04 Dec 2008, 10:09
by nig3d
adding a third point sorry
3) We already discussed about it via email, but I'd like to know if you are already thinking about an official way to solve my problem (that by now I solved in a way I don't like much). The problem was about let the avatar analyze the tile where it spawns on. Currently, there is now way to analyze the tile (beside using some tricks, as we discussed) where the avatar spawned on and I think it's quite needed.
Re: going in depth with smartfox and openspace...
Posted: 05 Dec 2008, 03:09
by nig3d
nig3d wrote:
1) is the path actually computed on the server? I ask this because I opened two clients on the same pc and the client where the moving avatar was an "host", got the onMovementStop before than the client creating the moving avatar (because of the background process, the original client was slower than the other client)
I want to add some more words on this.
It really looks like when I open a new client, even if the previous avatar client is still executing the path, on the new client the "host" avatar spawns already on the final destination.
This, in my opionion, bring up several problems. In fact, using the "previous" client, the player can decide to change path while his avatar is still moving.
If something like this happens (and of course it happens often) the client syncrhonization is completely messed up.
do you have any comments on this?
Posted: 05 Dec 2008, 12:16
by Bax
1) Avatar paths are calculated on the client of the avatar owner when a tile is clicked, and then sent to the other clients. Of course if different clients have different speeds or, if there's a significant network lag, there same avatar on different clients can be out of synch (but in the end it will stop on the same tile).
When the avatar A, corresponding to client A, is moving and a client B joins the same map, that avatar A will be rendered on client B in its final coordinates. In fact the path is not saved anywhere, and it could be impossible to place it on the current tile and make it move to the the final one. Of course the issue you are pointing out has been avoided: if user A changes its path in the middle of the previous movement, client B will receive the new path (which contains the starting position too) and avatar A will be instantaneously moved to the starting tile and everything will work as expected.
2) Yes, you have to broadcast the full skin. The alternative is that you use your own user variable and handle its updates manually (which means that your application will receive the variable change event, and you have to retrieve from OpenSpace a reference to the avatar owning that variable and call a custom method to change its state.
3) We will change the behavior in the next release of OpenSpace.