Server Side Variables VS Room.sendMessage

All Union Platform questions, comments, feature requests, and bug reports.

Server Side Variables VS Room.sendMessage

Postby findon » Thu 02 May 2013 07:19

Hypothetically if we had a game with N objects which for sake of argument had an X a Y and a Health value, my question is are there any pros/cons to the following two setups with regard to notifying clients of changes to the objects.

1. Room Attributes
Each objects data is stored in a server side global shared room attribute, with the clients simply listening for changes to each of the attributes

2. Message System
Rather than exposing each objects attributes permanently, the data is stored in the room module script and we just use 'sendMessage' to notify users of changes to the attributes.

I am just in the middle of re-coding a fairly large part of a multiplayer game and wanted to choose the best method upfront. I am guessing that there may be implications in terms of memory used and perhaps bandwidth etc.?

Thanks

Greg
findon
 
Posts: 5
Joined: Sat 19 Jan 2013 10:07

Re: Server Side Variables VS Room.sendMessage

Postby paala » Thu 02 May 2013 13:10

I've seen tutorials in player io using method 1 (send message) and in Smart fox server using method 2 (attribute change).
I tried both methods and I use now method 1.
When using method 2 if your players.x and .y update 30 times per second and there are 6 players on room, each client receives 30x6x2 attribute change per second which makes the fps of client to drop at 10 fps. Inacceptable.
You can set Attribute updates at 200ms(5 times per second ) to make the game playable but this makes a lag of 200+200+ ping 1 + ping 2 ~600 700 ms which can be very high if positioning in real time is really important.
When using method 1 your send only 30 message events per second. The problem here is that Union only can send a string, (Player io and Smart fox can send multiple integers.) So if you want to use this , you will send String(id of player),String(player1.x), String(player2.y) and so on for every player. So for every player you send 11 char string instead of 3 ints...With my calculation the bandwith is triple.
But today i found unlimited bandwith @ 1gbps at 20$ ..
paala
 
Posts: 13
Joined: Mon 01 Apr 2013 03:40


Return to Union Platform

Online

Users browsing this forum: No registered users and 7 guests