Page 1 of 1

Is standard communication with Server always XML based?

Posted: 07 Jul 2009, 21:14
by dlong

I'm not talking about server extension communications but more the basic plumbing such as connecting, logging in, setting user/room variables, etc. It appears to be all in XML format. I'm looking to switch it to a raw mode and was hoping for a configuration switch I could flip but have not found one.

Any suggestions?



Posted: 08 Jul 2009, 07:23
by ThomasLund

Yes - all standard communication is purely XML based as this is the only thing the server supports.

If its very very important for you, you could write wrapper XtMessage extensions on the server that override the internal commands.

But most of the basic commands are only used (usually) in the menus and such - so what is the motivation behind you wanting to optimize those?


Posted: 08 Jul 2009, 16:17
by dlong
Hey Thomas,

Maybe we're doing this completely wrong but we're using the user variables for each user in a room to communicate that users current position. This gets updated about 10 times per second. We're concerned that we'll be consuming too much bandwidth, mostly because of the extra overhead for xml serialization.

Something like:

Code: Select all

pos = "70.53, 11.35, -131.86"


Code: Select all

<msg t='sys'>
 <body action='uVarsUpdate' r='1'>
 <user id ='921' />
  <var n='pos' t='s'>
   <![CDATA[70.53, 11.35, -131.86]]>

Again, maybe this is not the most optimal way to communicate this data to other users in the room. We're still trying to evaluate what we've done and determine what our capacity could be. If you have any insight, please feel free to make suggestions. :)

Obviously two other options would be to a) write wrappers in an extension as you suggested that can handle raw input or b) rather than communicate this via SetUserVariables, write some sort of custom method instead.

Thanks again for all your help!


Posted: 08 Jul 2009, 19:04
by ThomasLund
Ahhhh - right!

I would definitely write up a extension to handle this instead (if you have the pro version of SFS).

Depending on the type of game you are doing it might even be required to have the server being the authority running the simulation and cheat checks.

E.g. you code up a "SendUserPos" extension method. Each client sends those to the server using raw or even additionally compressed by you in the client/server code.

Server can then run checks if that position is truly valid (e.g. did the player suddenly exceed the maximum movement speed = most likely cheating) etc.etc.

Server can then update its internal position array of all players, and even selectively send out position updates.

For example, if 2 players are far away from each other they might not need to know where they are. So you dont have to send out positions of each of those to each other. Another player might be right next to the first player, and thus needs constant updates. Players "almost out of sight" can get every 5th update or so.

A lot of similar mechanisms can be implemented server side.

And if you are truly concerned about cheating and making e.g. a FPS, then you have to send from each client what they pressed (e.g. move forward), and have the server tell the client if its OK to move forward and at what speed and position you have. Requiring you to implement prediction and interpolation on each client

Its a minefield with tons of opportunities :-D

But for many games where you are not concerned about cheating as much, you can simply use the server extension to throttle bandwidth usage by e.g. zoning and similar.