Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

SW:BF Gamespy Query Script

Page: 1 of 1
 avonnied
09-22-2004, 12:34 PM
#1
Just in case anyone is interested..

here is a simple (mainly use for an example) Battlefront gamespy query script written in perl.

http://www.bfradio.com/utils/SWBF_query.tar.gz)


usagel SWBF_query.pl IP PORT

the gamespy port looks to be 3658
 LoRdNaTaS
09-22-2004, 5:56 PM
#2
Hey I took your query script and made it so it would out put to a web page so people could put up there server status if they want to. I have included you in all the documentation due to I beleive you were the one who wrote it. And if not and you know who did let me know so I can modify the docs.

The SWBF Server Status can be found at:
http://www.apocalypce.net/modules.php?name=Downloads&d_op=viewdownload&cid=3)
 [RNGD]Tyrant
09-22-2004, 10:27 PM
#3
very cool...this should be a stickie
 LoRdNaTaS
09-22-2004, 10:58 PM
#4
just an FYI for everyone.
I did some testing on it and I think I have found all the bugs but if you find any let me know.
 audax
09-23-2004, 3:38 PM
#5
Script works great on linux but hangs when run under ActiveState Perl on Windows... Any ideas?
 LoRdNaTaS
09-23-2004, 3:53 PM
#6
Not sure I have not tested it under ActiveState. I will see what I can find out in the next couple of days. And let you guys know what I find out.
 bob4432
09-24-2004, 12:40 AM
#7
i really apprecite your work. any chance to have it written in php?

thanks :)
 LoRdNaTaS
09-24-2004, 8:54 AM
#8
I will be working on that. But I am finishing up with perl version first. I still have to get the maps to display small screen shots when you view the page. I should have that done this weekend and then I will start work on a .php version.

So hopefully within the next couple of weeks I should have it.

For all updates on SWBF Server Status script please see http://www.apocalypce.net). Sorry to keep putting this out there. But I have to take most of these post and post them on my own bbs.
 [RNGD]Tyrant
09-24-2004, 9:07 AM
#9
I think this would be great...your program can become the standard.


any thoughts on a mySQL stats system like select(bf)?

or even a more simple one like those from bftracks
 avonnied
09-24-2004, 11:45 AM
#10
i'll look into it.. it really wouldn't be that tough.. the biggest hurdle is going to be getting the server list from gamespys master server....

as far as database design goes that is just a matter of not being lazy :-)
 LoRdNaTaS
09-24-2004, 10:25 PM
#11
Originally posted by avonnied
i'll look into it.. it really wouldn't be that tough.. the biggest hurdle is going to be getting the server list from gamespys master server....

as far as database design goes that is just a matter of not being lazy :-)

I think that it would be possible to generate some kind of stats for this but I am not sure how good they would be. Due to the server does not give info like in select(bf) where you have the detailed user info.

But I am sure that something can be made to meet the publics needs.

Hey avonnied drop me an email I would like to chat with you about this.
 LoRdNaTaS
09-27-2004, 10:07 PM
#12
There is a new update for the server status. It should fix the issue of not seeing all the player information.

Sorry for the bug.
 KaeseGewitter
09-28-2004, 9:45 AM
#13
HI, I also started to write an Script where you can see the server state:

here my news post (german) (http://starwars.gameswelt.net/index.php?script=news&nid=186)


and now the script (http://starwars.gameswelt.net/bonus/server-status/status.php)
 [RNGD]Tyrant
09-28-2004, 10:07 AM
#14
Originally posted by LoRdNaTaS
I think that it would be possible to generate some kind of stats for this but I am not sure how good they would be. Due to the server does not give info like in select(bf) where you have the detailed user info.

But I am sure that something can be made to meet the publics needs.

Hey avonnied drop me an email I would like to chat with you about this.


well there are two types of stats systems
1. select BF type for detailed stats of a single server (relying on FTP access to log files)
2. BF Tracks type for generals stats of all players (only relies on tracking public gamedata)

I think the 2nd type would be more possible since the current log files are pretty useless. There is a topscore file created, I guess a script could be made to post this to the web, but its not really usefull.

The current 'Leaderboard' is very lacking, the community needs a system like BFStats, BFTracks, or Gametrack.
 LoRdNaTaS
09-28-2004, 11:23 AM
#15
Well due to the lack of data that you get from the servers and logs I am in the process of creating a basic stats system based off of the SWBF Server Status. It will show players names, Kill totals (kills per map), death totals (deaths per map), number of rounds played. But it will not be in alpha till this weekend.

I know that it is not what we all want but I think it will help for the time being. Or till LA gets a useful log that we can parse through.

This system will run on the SWBF Server Status perl script and write to a mysql db and will have a front end of either perl or php. I might release both. But I think for right now I will be working on the php front end.
 avonnied
09-28-2004, 12:24 PM
#16
yea i wouldn't rely to much on getting global stats from log files..

one thing i found when they released the BF42 server with XML logging that just how hard it was to get any logs from people..


i had actually generated a stat system for parsing these logs and its amazing how much info you get out of them..

to bad no one wants to use them.. for these type of stats to be fully adopted the game itself needs to self incorporate some sort of stat transfer.. UT uses NetStat (or at least it used to be called that) that worked very well.

http://www.bfradio.com/stats/index.cgi?file=ev_14567-20040208_2100.xml&round=4&match=2&def_file=BFRadio.defs)

http://www.bfradio.com/stats/index.cgi?file=ev_14567-20040307_2023.xml&round=3&match=3&def_file=BFRadio.defs) this is a DC stat log.

this is just an example of one rounds from BF42 that you can get out of the logs..
 avonnied
09-28-2004, 12:25 PM
#17
lol forgot to make the point..

the point being.. to have good global stats it is most likely goign to have to just be the stats we get from the gamespy query and just polling the servers often..
 LoRdNaTaS
09-28-2004, 12:30 PM
#18
Thats what I was thinking... It just really sucks.. But I will see what I can come up with..
 [RNGD]Tyrant
09-28-2004, 12:40 PM
#19
I hope you two are working together, sounds like you both have a good handle on this.

I wonder if LFN/Battlefront.net would host a global stats system...it seems a natural fit you should inquire.

...also you may want to post on the TWL forums since it seems they developers are paying attention to those forums and I am sure that there are quite a few things the next patch can address to improve both server status scripts and a global stats system.
 LoRdNaTaS
09-28-2004, 2:52 PM
#20
...also you may want to post on the TWL forums since it seems they developers are paying attention to those forums

Ok maybe it is just me but shouldn't the devs pay attention to the board that they have a link to from their site?????

Anyways I will put a post up on TWL later tonight. Thanks for the heads up.
 KaeseGewitter
09-29-2004, 3:05 AM
#21
does someone know, how I can get the names of the players, who are playing on the server?
 LoRdNaTaS
09-29-2004, 6:23 AM
#22
well if you don't want the full server status you can download the SWBF_query from the first post. It will give you everything you need including the players names. You will have to modify the script so that you just display the players names though.
 KaeseGewitter
09-29-2004, 6:53 AM
#23
I want to write an script like that, but in PHP so I can't use that script.

My question is now, what must I send to the server, to get the names of the players?
 LoRdNaTaS
09-29-2004, 7:57 AM
#24
I have been working on a script for PHP but in my testing the connection just hangs. PHP finally times out but it does not retreive any info from the server. I have put that on the side for right now and am in the process of creating a stats system. I might get back to working in a week or so.
 [RNGD]Tyrant
09-29-2004, 8:09 AM
#25
Thats too bad about the PHP thing...but glad to hear there is work on a stats system

are you working on a single server stats system (like selectbf) or a universal stats system (like BF Tracks). This game can use both really
 SteVader
09-29-2004, 8:11 AM
#26
Originally posted by LoRdNaTaS
I have been working on a script for PHP but in my testing the connection just hangs. PHP finally times out but it does not retreive any info from the server. I have put that on the side for right now and am in the process of creating a stats system. I might get back to working in a week or so.

That's a shame - I have been watching this thread anticipating a PHP script... ah well I guess it will come in time.... :deathii:
 LoRdNaTaS
09-29-2004, 8:24 AM
#27
Sorry for the disappointment... I will get back to I promise. But I want stats first.. I know I am a greedy bastard... Sorry
 KaeseGewitter
10-02-2004, 9:05 AM
#28
I GOT IT.

Jeah I have finished my work at the server state script: GO THIS WAY (http://starwars.gameswelt.net/index.php?script=news&nid=194)
 LoRdNaTaS
10-02-2004, 9:09 AM
#29
I like it but it seems that your link to sever1 is having issues but the server2 link seems fine.
 KaeseGewitter
10-02-2004, 9:28 AM
#30
sometimes the link works and sometimes not. I think it is, when the server is changin his map.
 LoRdNaTaS
10-02-2004, 11:24 AM
#31
hey KaeseGewitter drop me a line I want to ask you some questions on your script..

natas@apocalypce.net
 [RNGD]Tyrant
10-02-2004, 1:02 PM
#32
Originally posted by KaeseGewitter
I GOT IT.

Jeah I have finished my work at the server state script: GO THIS WAY (http://starwars.gameswelt.net/index.php?script=news&nid=194)

nice work.

is this a modified version of the other script or your own?

are you offering a download for people?
 KaeseGewitter
10-02-2004, 1:40 PM
#33
thx, its my own work. So far I know are no other PHP Scripts for Battlefront Server avaible.

Soon, there will be a download able version.
 KaeseGewitter
10-03-2004, 2:25 AM
#34
Now there is a download able Version avaible: press here (http://starwars.gameswelt.net/index.php?script=news&nid=197)
 vwjoker
10-04-2004, 11:45 AM
#35
Many thanks for the php script KaeseGewitter! :)

Works a treat, had to do a little bit of fiddling, but seems to work fine... as my webserver (abyss) sits on the game server, I just use 127.0.0.1 (stops the darn thing timing out).

I'm also using a cut down version of PHP, so I cant throttle PHP Notice messages so I changed this line :-

if ($bytes_left['unread_bytes'] > 0)
{
$buf = fread($fp, $bytes_left['unread_bytes']);
}

Just to define the 'unread_bytes', for anyone else who may have problems with it.


Danke Schone!
 KaeseGewitter
10-04-2004, 12:07 PM
#36
Hi, great to see, that the script is working. But I wouldn't definde 'unread_bytes' because you don't know, how long the message ist, which the server sends to you, so if the message is longer then the defined value, you may have a problem.
 vwjoker
10-04-2004, 12:09 PM
#37
ah, I wasnt too sure what putting the ' ' marks around it did.

I figured it was a generic sort of define (like cast) method, and wouldnt affect its length. So um... outta my depth already, it defines the type, and not the length?

Hey, its been a few years since I have bothered to code... I vowed never to code again, and star wars has forced me back into it.

.... mumbles something about dark side and succumbing ...

My Effort (http://home.vampire-wars.com:81/swbf/status.php)
 KaeseGewitter
10-04-2004, 12:51 PM
#38
sorry, I didn't understood you right, I thought you wrote something like this:

define unread_bytes = 1024;

So it was my fault, sry. Perhaps you should build a small design around my Script. just make a index.php (or any other name). Put into this index.php your HTML Code and then write this: <? include("status.php"); ?> at the point, where my script should be shown.
 [SYN]~slinky~
10-04-2004, 12:57 PM
#39
Hi Guys - I've been lurking here watching the great work you guys are doing.

But I do have a question: is there a reason you guys don't have the Heros On/Off data, and number of bots info displayed?
 KaeseGewitter
10-04-2004, 1:02 PM
#40
the server doesn't send every information back. So you doesn't get the information, if Hereos are on/off, or if there are Bots, etc.
 [SYN]~slinky~
10-04-2004, 1:10 PM
#41
Then how does my client know how to display this info? Sorry if this is a noob question, if it is, I'll shut up... ;)
 vwjoker
10-04-2004, 1:19 PM
#42
In terms of the part of the script that sorts out which side is which, I've had a look and they dont always seem to tally.

ie the game may be rebels vs imperials, but Confederation / Republic would be showing.

So I just changed the code to this.

echo("<table width='600'><tr><td colspan=4><b>");
# Display "goodies"
echo($array[$ber2+4]);
echo (" - ".$array[$ber2+5]);

echo("</b></td><td colspan=4><b>");
# Display "badies"
echo($array[$ber2+6]);
echo (" - ".$array[$ber2+7]);

echo("</b></td></tr>");
 avonnied
10-04-2004, 1:47 PM
#43
yea i still haven't figured out what the end team info is.

team_t and score_t are always the same..

REBEL or EMPIRE and the score_t is always 10 and 15..

i believe this may have been the Galactic Conquest feature they where going to put in (where score carried over from round to round)..

right now it is only good for determining the player set, GCW vs Republic..
 LoRdNaTaS
10-04-2004, 2:48 PM
#44
the only thing I have found the team_t is good for is determining the game type.

If Rebels & Empire then you are playing episode 4 - 6
If Rebulic and CIS then you are playing episode 1 - 3

But the score_t seems to have no use as of yet due to it never changes. I though it might be the ticket count but it seems that it is not.
 vwjoker
10-05-2004, 1:59 AM
#45
Just a quick question, how did anyone figure out what HEX codes to send to the server to query it?

$send = pack("H*", "FE");
$send .= pack("H*", "FD");
$send .= pack("H*", "00");
$send .= pack("H*", "04");
$send .= pack("H*", "05");
$send .= pack("H*", "06");
$send .= pack("H*", "07");
$send .= pack("H*", "FF");
$send .= pack("H*", "FF");
$send .= pack("H*", "FF");

... am just wondering if it responds to other HEX queries or not, y'see.


_edit_
Having engaged brain, I realised this must be the UDP query format. heh
 avonnied
10-05-2004, 8:40 AM
#46
it is the new standard gamespy query package..

before you sent simple text like

$socket->send("/status/");


instead they changed it to this hex string...
Page: 1 of 1