no OnUserVariableUpdate event

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Mrm83
Posts: 22
Joined: 17 Dec 2017, 04:02

no OnUserVariableUpdate event

Postby Mrm83 » 08 Jun 2018, 15:30

So with performance in mind, I started experimenting UDP calls.

Originally, when a client moves, I send a request to the server like so:
userVariables.Add(new SFSUserVariable("x", (double)pos.x));
userVariables.Add(new SFSUserVariable("y", (double)pos.y));
userVariables.Add(new SFSUserVariable("z", (double)floor));
sfs.Send(new SetUserVariablesRequest(userVariables))

Server handles it from UserVariableHandler request and updates the user position
mmoApi.setUserPosition(user, pos, getParentRoom());

Works fine, no problem, all clients are in synced.


Now with UDP, I updated the client to be like this so it uses UDP:
playerMoveObj.PutDouble("x", (double)pos.x);
playerMoveObj.PutDouble("y", (double)pos.y);
playerMoveObj.PutShort("z", (short)floor);
sfs.Send(new ExtensionRequest ("player.m", playerMoveObj, sfs.LastJoinedRoom, true));

created a new request handler on the server to handle this new extension and from server, i update the user's user variables.
sender.setVariables(vars);

the position on the server for the player is updated, however, clients no longer receive user variable updates! proximity is still updating, but no user variables event so i am unable to update user positions client side..

ive been playing around for an hour and is about to give up UDP position updates as i am stumped why updating user variable from the server doesn't notify clients...

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 25 guests