Realtime Game Message Sending Strategy

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Aceex7
Posts: 4
Joined: 09 Dec 2019, 07:47

Realtime Game Message Sending Strategy

Postby Aceex7 » 10 Dec 2019, 07:13

We've started developing realtime games using unity3d and smartfox server v1.6 for mobile phones
and we've been experiencing synchronization problems between the server and the client
we want to send a command (we'll call it X) to the server every 200ms while the game is ongoing, we're testing it in our
local development system, it works well but when the game starts and there are a lot of peer to peer(P2P) messages sent to other the players (a message every 100ms) to notify that player's location, speed and force.
the server receives those X commands with a changing delay and sometimes receives two requests within 10ms difference,which leads me to a few questions,

1. If I send P2P messages to other players (movement, etc..) and also sending messages to the server (player lost, collected powerups etc..) are all these messages being pushed into a queue in the smartfox core level? if so, is there any way to separate the it in a way that the regular commands will have priority over the P2P messages or be sent right away?
2. Is there a big difference in latency between sending messages to players peer to peer vs through the server?
3. are there any more pointers that will help building a realtime game that will support low end mobile devices?

Thanks!
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Realtime Game Message Sending Strategy

Postby Lapo » 10 Dec 2019, 14:48

Hi,
I am a little confused. If you're using P2P to update clients... what is SmartFox used for?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
Aceex7
Posts: 4
Joined: 09 Dec 2019, 07:47

Re: Realtime Game Message Sending Strategy

Postby Aceex7 » 10 Dec 2019, 17:10

Hi,

I'm using Smartfox's Client sendObject() and sendObjectToGroup() methods, which to my understanding, sends data between players in a certain room, I refer to that as P2P since there's no need to go through the server side to pass the message to all the players in the room
Aceex7
Posts: 4
Joined: 09 Dec 2019, 07:47

Re: Realtime Game Message Sending Strategy

Postby Aceex7 » 26 Dec 2019, 07:05

what would be considered better for realtime games in terms of reliability, latency etc..
sending messages to players using the peer to peer SendObject() Method or Sending messages to the server which notifies all the players in the room?
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Realtime Game Message Sending Strategy

Postby Lapo » 27 Dec 2019, 07:59

Aceex7 wrote:Hi,

I'm using Smartfox's Client sendObject() and sendObjectToGroup() methods, which to my understanding, sends data between players in a certain room, I refer to that as P2P since there's no need to go through the server side to pass the message to all the players in the room

No, everything in SmartFox is server based. The two calls you are mentioning also go through the server as connecting two clients directly is a pain in the neck.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Realtime Game Message Sending Strategy

Postby Lapo » 27 Dec 2019, 08:01

Aceex7 wrote:what would be considered better for realtime games in terms of reliability, latency etc..
sending messages to players using the peer to peer SendObject() Method or Sending messages to the server which notifies all the players in the room?

It is the same from a latency stand point but it can be different from a security one.
If you're keeping part or all the game logic on the client side you're opening yourself to cheating, while if you move the logic on the server side and keep the client as "dumb" as possible you can avoid most attacks.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 41 guests