
I play Battlefield 2 a lot these days and have joined a BF2 clan called Canadian Armed Forces (CAF). One of the things we'd like to do is have a quick way to see who's on our BF2 server just by hitting your clan sites main page. This helps so that you don't have to fire up BF2 to see if there are people on a server worth playing against.
There didn't seem to be any free tools out there that would allow you to easily add such a listing to your own site. There are plenty of sites that specialize in player and server stats reporting like BF2S.com, and BF2Player.com, which are absolutely great for tracking how close you are to your next rank, and server searches. However these sites don't allow you to easily get a listing of players on your server and display that on your own site.
This is where I can help out!
Using resources available on the Internet I found that you don't have to query EA directly to get the stats of your server. BF2 supports what has become a rather common query/response format for multiplayer Internet servers. I believe this format is referred to as the GameSpy query format. So if you make a direct query to the server, usually on port 29900 using UDP, you should get a response containing all of the server information.
That's the easy part. The hard part is parsing the goofy response that gets sent back to you! After several hours of testing on numerous servers I found several cases where the packets sent back could have an unexpected layout. This is what took the longest to set up the parser to handle.
I now have a .Net component that you can use to make a query to a BF2 server and port and you'll be able to read the properties for the server configuration (map, players, rules, logo, etc...) and the teams and a bunch of information about the players on those teams.
I've set up a simple test page that uses this component (see image to the right). The look of the page isn't what the component does. The component merely provides you with all of the information. It's up to whomever uses the component to use whatever information comes back as you wish. The query/response takes about 1/10th of a second to process. Check out the link below to see who's currently playing on the Canadian Armed Forces BF2 server.
Link to Geeqs.Net.BF2Query Test Page
If you're interested in this component, please let me know.
Posted
May 12 2007, 08:03 PM
by
Keith Reid