Is standard communication with Server always XML based?

Post here all your questions related with SmartFoxServer .Net/Unity3D API

Moderators: Lapo, Bax

dlong
Posts: 26
Joined: 05 May 2009, 02:46
Location: Los Angeles, CA

Is standard communication with Server always XML based?

Postby dlong » 07 Jul 2009, 21:14

Hi,

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?

Thanks!

DL
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 08 Jul 2009, 07:23

Hi

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?

Best
Thomas
dlong
Posts: 26
Joined: 05 May 2009, 02:46
Location: Los Angeles, CA

Postby dlong » 08 Jul 2009, 16:17

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"


becomes:

Code: Select all

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



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!

DL
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 08 Jul 2009, 19:04

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.

/Thomas

Return to “.Net / Unity3D API”

Who is online

Users browsing this forum: No registered users and 1 guest