Forum Multiplayer Fastest/lightest way to check ping to multiple rooms?

Discussion and help relating to the Player.IO Multiplayer API

Fastest/lightest way to check ping to multiple rooms?

Postby fex » January 17th, 2012, 12:29 am

I'm currently working on my server/room browser lobby, where users will be able to select a room to join based on the game's settings, player limit, and ping.

Game settings and player limits are super easy to filter and search, since they're just static properties of the room. However, I definitely want my users to be able to sort rooms by ping, so they can be sure they're joining a low-ping room.

I don't see any sort of built in methods for pinging a room without joining it, so what I'm planning on doing is the following:

1) After fetching the room list, stuff all of the room IDs into an array.
2) Go through the array, one at a time, and attempt to join that room (store getTimer() in a var as soon as the join request is sent)
3) While joining each room, include a flag in the joinData object that indicates to the server that I'm just checking ping.
4) When the server receives the join request and sees the "just checking ping" flag, it sends a response message back to the client, then denies the join request.
5) When the client receives the response message, it compares getTimer() to determine the round trip ping, displays it next to that room in the server browser interface, then moves on to the next room in the array.

Before I start programming this (I've got a handful of freelance things to deal with tonight, planning on trying this tomorrow afternoon), I have a couple questions.

1) Is there anything obviously wrong with this method?

2) Will the round trip time for a join request be significantly longer than the round trip time of a normal message for a user who has already connected to the server? In other words, should I just connect to the server the normal way, then do a normal ping check (I've already got that functionality in place for users who are connected to the server) and disconnect, instead of trying to handle it all as part of a join request?

3) Does PlayerIO have any plans to allow us to ping a room without joining it? Is this functionality that already exists somewhere, and I just missed it?

Thanks!
fex
 
Posts: 2
Joined: January 10th, 2012, 1:21 am

Re: Fastest/lightest way to check ping to multiple rooms?

Postby Benjaminsen » January 17th, 2012, 3:28 pm

Simply don't.

1: All the servers in the public cluster are all in the same US data center. IE your users will have exactly the same ping on all of them.

When that is said, yes the time it takes to join a room initially is substantially longer than the roundtrip time on a message.
Have more questions? Join us at #player.io on the freenode irc network. Making something cool with Player.IO? I would love to talk! My Skype handle is q-rious
User avatar
Benjaminsen
.IO
 
Posts: 808
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Fastest/lightest way to check ping to multiple rooms?

Postby fex » January 17th, 2012, 3:34 pm

Right on, thanks for the response.
fex
 
Posts: 2
Joined: January 10th, 2012, 1:21 am


Return to Multiplayer



cron