Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > HalfLife/Cstrike monitorring

Reply
Thread Tools

HalfLife/Cstrike monitorring

 
 
Guyon Morée
Guest
Posts: n/a
 
      12-11-2003
Hi all,

I want to write a HalfLife/CStrike monitor, to make some nice statistics for
an upcoming LAN-party. I've found some pointers on how to use the protocol,
but now I have to do the following:

1. make an UDP connection
2. send a string(?) like '\xFF\xFF\xFF\xFFdetails\x00'
3. translate the response into bytes and strings :-s

for more details on this protocol see:
http://dev.kquery.com/index.php?article=31

I hope someone can help me with at least the first 2 steps.

Thanx,

Guyon


 
Reply With Quote
 
 
 
 
Terry Reedy
Guest
Posts: n/a
 
      12-11-2003

"Guyon Morée" <(E-Mail Removed)> wrote in message
news:3fd84154$0$251$(E-Mail Removed)...
> Hi all,
>
> I want to write a HalfLife/CStrike monitor, to make some nice statistics

for
> an upcoming LAN-party. I've found some pointers on how to use the

protocol,
> but now I have to do the following:
>
> 1. make an UDP connection
> 2. send a string(?) like '\xFF\xFF\xFF\xFFdetails\x00'
> 3. translate the response into bytes and strings :-s
>
> for more details on this protocol see:
> http://dev.kquery.com/index.php?article=31
>
> I hope someone can help me with at least the first 2 steps.


Try Googling 'Python HalfLife monitor' (200+ hits). 'Python UDP monitor'
gets you to more general info (first is UDP support in Twisted).

TJR


 
Reply With Quote
 
 
 
 
Erik Max Francis
Guest
Posts: n/a
 
      12-11-2003
"Guyon Morée" wrote:

> I want to write a HalfLife/CStrike monitor, to make some nice
> statistics for
> an upcoming LAN-party. I've found some pointers on how to use the
> protocol,
> but now I have to do the following:
>
> 1. make an UDP connection
> 2. send a string(?) like '\xFF\xFF\xFF\xFFdetails\x00'
> 3. translate the response into bytes and strings :-s
>
> for more details on this protocol see:
> http://dev.kquery.com/index.php?article=31
>
> I hope someone can help me with at least the first 2 steps.


It sounds like you just want a server statistics package, of which there
are many available. See Google; a good one is PsychoStats. There's
really no need for you to reinvent the wheel here.

--
__ Erik Max Francis && http://www.velocityreviews.com/forums/(E-Mail Removed) && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ Dead men have no victory.
-- Euripides
 
Reply With Quote
 
Guyon Morée
Guest
Posts: n/a
 
      12-11-2003
Thanx for the tip, but actually I wanted to make something, which shows the
stats of a match a bit 'flashy arcade style'. perhaps i'll use pygame for
that part.

In other words: it should look cool on a beamer

anyway, the decoding stuff I've managed, but I'm still stuck with the UDP (i
think) because somehow no response is given. maybe someone can show me the
light.

thanx,

Guyon


"Erik Max Francis" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> "Guyon Morée" wrote:
>
> > I want to write a HalfLife/CStrike monitor, to make some nice
> > statistics for
> > an upcoming LAN-party. I've found some pointers on how to use the
> > protocol,
> > but now I have to do the following:
> >
> > 1. make an UDP connection
> > 2. send a string(?) like '\xFF\xFF\xFF\xFFdetails\x00'
> > 3. translate the response into bytes and strings :-s
> >
> > for more details on this protocol see:
> > http://dev.kquery.com/index.php?article=31
> >
> > I hope someone can help me with at least the first 2 steps.

>
> It sounds like you just want a server statistics package, of which there
> are many available. See Google; a good one is PsychoStats. There's
> really no need for you to reinvent the wheel here.
>
> --
> __ Erik Max Francis && (E-Mail Removed) && http://www.alcyone.com/max/
> / \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
> \__/ Dead men have no victory.
> -- Euripides



 
Reply With Quote
 
Paul Clinch
Guest
Posts: n/a
 
      12-12-2003
"Guyon Morée" <gumuz*NOSP@M*looze.net> wrote in message news:<3fd8fa1c$0$154$(E-Mail Removed)>...
> Thanx for the tip, but actually I wanted to make something, which shows the
> stats of a match a bit 'flashy arcade style'. perhaps i'll use pygame for
> that part.
>
> In other words: it should look cool on a beamer
>
> anyway, the decoding stuff I've managed, but I'm still stuck with the UDP (i
> think) because somehow no response is given. maybe someone can show me the
> light.
>
> thanx,
>
> Guyon
>
>
> "Erik Max Francis" <(E-Mail Removed)> schreef in bericht
> news:(E-Mail Removed)...
> > "Guyon Morée" wrote:
> >
> > > I want to write a HalfLife/CStrike monitor, to make some nice
> > > statistics for
> > > an upcoming LAN-party. I've found some pointers on how to use the
> > > protocol,
> > > but now I have to do the following:
> > >
> > > 1. make an UDP connection
> > > 2. send a string(?) like '\xFF\xFF\xFF\xFFdetails\x00'
> > > 3. translate the response into bytes and strings :-s
> > >


UDP is connectionless, make a socket, send and recv.

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.sendto('\xFF\xFF\xFF\xFFdetails\x00', ('127.0.0.1', portnumber ))
ret, addr = s.recvfrom(1024)

Note that the server is not guaranteed to receive your request, or you
receive the reply.
Look up select and poll in the doc.s. Python version 2.3 has socket
timeouts.

> > > for more details on this protocol see:
> > > http://dev.kquery.com/index.php?article=31
> > >
> > > I hope someone can help me with at least the first 2 steps.

> >
> > It sounds like you just want a server statistics package, of which there
> > are many available. See Google; a good one is PsychoStats. There's
> > really no need for you to reinvent the wheel here.
> >
> > --
> > __ Erik Max Francis && (E-Mail Removed) && http://www.alcyone.com/max/
> > / \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
> > \__/ Dead men have no victory.
> > -- Euripides



Regards, Paul Clinch
 
Reply With Quote
 
Steve Lamb
Guest
Posts: n/a
 
      12-16-2003
On 2003-12-11, Erik Max Francis <(E-Mail Removed)> wrote:
> It sounds like you just want a server statistics package, of which there
> are many available. See Google; a good one is PsychoStats. There's
> really no need for you to reinvent the wheel here.


Not true. Psycho stats does not, for example, take the details given by
the connection and translate it into something MRTG or LRRD can parse for a
general graph of players per time unit. Furthremore Psycho works on the logs
not on the udp interface.

With that said I'd recommend the person just sit down with a good Python
book and hammer at it. Took me about 10m to get my script working to query
just what he was asking for and translate the results into information I
needed. Prior to that I had never worked with network code in any language.
The major boon was being able to play with code interactively.

--
Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
PGP Key: 8B6E99C5 | main connection to the switchboard of souls.
-------------------------------+---------------------------------------------
 
Reply With Quote
 
Erik Max Francis
Guest
Posts: n/a
 
      12-16-2003
Steve Lamb wrote:

> Not true. Psycho stats does not, for example, take the details
> given by
> the connection and translate it into something MRTG or LRRD can parse
> for a
> general graph of players per time unit. Furthremore Psycho works on
> the logs
> not on the udp interface.


At this point I don't know what the original poster wanted; he said he
wanted a "monitor, to make some nice statistics for an upcoming
LAN-party." He certainly never said anything about requiring MRTG or
LRRD capability, and I don't know where you're getting that.

PsychoStats and similar log processing packages will be more than
sufficient for the task of giving some interesting statistics during a
LAN party. The fact that he started talking about trying to get UDP to
work doesn't necessarily indicate to me that's a coherent solution to
his problem, just that's the road he took.

If he wants to analyze the status of the game in realtime, i.e., ping
the current server activity to see what's happening, he can use qstat (a
standalone application), for which I've already written a Python wrapper
(PyQstat):

http://www.alcyone.com/software/qstat/

Although you can get information like how long players have been on the
server, what their current scores are, etc., you simply cannot get the
level of detail involved in actually processing logs.

Even if he were to write a complete dummy client from scratch that
merely spectated in order to try to collect as much information as
possible (which is not a trivial task), it's unlikely he would get the
level of detail he would be satisfied with, since information given to
an individual client is in some sense "unprivileged," whereas the server
logs are by contrast "privileged," since the server knows everything
that is going on in the game. The server logs will contain more
information than he can get via any playing around with UDP; if he wants
pseudorealtime status, he can just run the log processor on small log
files (not a problem since it's going to be for a LAN party) every
minute or so.

--
__ Erik Max Francis && (E-Mail Removed) && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ It is impossible to love and be wise.
-- Francis Bacon
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments