User Tracker

Post: #1
Surely some of you know Ambrosia Software's game pop-pop. If you ever played it online, you know that there is a pretty cool user tracker which allows you to see who's online.

I wonder how such a tracker was made. It's kind of like a chat, but restricted to see who's online.

At first thought I would guess the app connects to a database and submits and receives the info that way. But that's probably too slow.

Any suggestions?
Quote this message in a reply
Post: #2
It probably works like this: They've got a tracker/server app running on a computer in their office. Whenever you connect to the tracker, you send a message telling it you've joined, and it sends the userlist and gamelist, resending when changed occur. When you host a game, you send a message to the server giving it your IP and telling it that you are hosting a game named xyz at skill level Q. When the game begins you send a message to the server telling it you're now in a game and that your game is now in play.
Quote this message in a reply
Post: #3
Well, this tracker app seems to be intelligent. Any idea how to create or find such a tracker app?

You know, all I would be able to do at the moment would be a script that refreshs the userlist any x seconds. But that wouldn't be "realtime" Grin ...
So - any idea how to create such a tracker app that is able to "know" when a user has joined or leaves? Maybe a PHP script? I don't really think so, but that's the only option I could think of...or maybe a Java applet?

Quote this message in a reply
Post: #4
Actually, it would be better to queue up user join/leave and game create/destroy events and send them to each client en masse at regular intervals. You would also need to send the game list to newly arrived/requesting clients only at these intervals, to avoid keeping track of who knows what. You could do this with Java, C, or even perl, using sockets.
Quote this message in a reply
Posts: 145
Joined: 2002.06
Post: #5
Pop-Pop works like this:

They have a server program (written in C) that functions as a simple single-table database. This database has one record for every player currently in the network lounge. In each record are fields such as product ID, product name, product version, player name, player address, player registered, game description, etc. The tracker allows for two types of sessions: "insert" and "query". insert sessions create a single updatable record in this table that persists only for the life of the session. query sessions return selected records from the table to the application. When records on the server are updated, clients with query sessions that matched the updated record before or after the update get sent events. There is also a continuous stream of ping events sent back and forth between the tracker and the client every few seconds. If a client does not respond to pings for a certain amount of time, all sessions to that client are closed.

In the case of pop-pop, three sessions are opened: one insert and two queries.
The insert session creates a record for your player in the table. When you host a game, this record is updated to contain a game description and type. The first query session requests all players with a matching version of pop-pop, sorted by user name. The results from this query are used to create the player listing. The second query session requests players with a matching version of pop-pop and a non-empty game description. This query produces the server listing.

If you're really interested in the exact mechanics of how it works: get out your packet sniffer and get to work, it's all ascii.

(I know all this because I implemented a client in PHP. That client only uses a single query session to get the job done.)

[edit: additional info re: overhead]

If you're worndering about this system's overhead - yes, it is high. When there were hundredsof continuously updating games up on the tracker during stress testing it could take quite a while for the full listing to show up. Once you're connected to the tracker the overhead goes down because updates are pushed.

"He who breaks a thing to find out what it is, has left the path of wisdom."
- Gandalf the Gray-Hat

Bring Alistair Cooke's America to DVD!
Quote this message in a reply
Post: #6
So I guess the "intelligent" server software Ambrosia has written is the "heart" of the whole thing...because it is able to inform connected players about what goes on.... you have a good link or maybe even a tutorial which deals with that?

Or is - in this case - a cronjob/crontab/scheduler/daemon a solution, too?

If so, could someone tell me something about it?

Thanks in advance for sharing your knowledge!
I appreciate that very much. This all sounds very interesting to me, that's why I want to know as much as possible about it.

Quote this message in a reply
Post Reply