User Tracker - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Design (/forum-5.html)
+--- Thread: User Tracker (/thread-7474.html)
User Tracker - Pepe - Nov 29, 2002 06:00 AM
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.
User Tracker - Patrick - Nov 29, 2002 09:15 AM
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.
User Tracker - Pepe - Nov 29, 2002 11:26 AM
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" ...
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?
User Tracker - anarchie - Nov 29, 2002 08:43 PM
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.
User Tracker - inio - Nov 30, 2002 03:53 AM
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.
User Tracker - Pepe - Dec 10, 2002 10:27 AM
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....
Hum...do 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.