bzscoreboard, a BZFlag LED sign controller

Place all meeting requests / announcements here...
Post Reply
zshall
Private
Private
Posts: 3
Joined: Wed Nov 01, 2006 3:12 am

bzscoreboard, a BZFlag LED sign controller

Post by zshall »

Hi everyone. I have developed a simple program called bzscoreboard which monitors the output of bzadmin and displays information about a BZFlag game on an LED message sign. This program was developed for use during LAN parties but could also be used for tournaments or in any event in which a lot of people are playing BZFlag in the same room and other people are watching. Here is a demo of bzscoreboad in action. Y'all are free to fork the code if you'd like, as at the moment I only support Linux and one type of LED sign.

I was wondering about a few things regarding bzadmin. First off, is there a way to get bzadmin to display individual or team scores? I haven't had a lot of success finding information about bzadmin commands, but I know that scores are displayed in the bzflag client itself. Secondly, is there any way to retrieve server info (# of players online, server description, server map, etc) using bzadmin? I know about the bzflag list server's text format, but it doesn't work for LAN servers that aren't publically registered and I'm also not sure how to parse the number of players and some other info from the list.

I'm sure a lot of people don't have LED signs laying around, so I'm not sure how useful this program is but I thought I might share it here in case anyone does find it useful!
User avatar
blast
General
General
Posts: 4931
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: bzscoreboard, a BZFlag LED sign controller

Post by blast »

That's really neat. :D As for bzadmin, there are different message types that you can enable and disable with the -show and -hide parameters, respectively:
  • bzdb
  • chat
  • admin
  • join
  • kill
  • leave
  • pause
  • ping
  • rabbit
  • score
  • spawn
  • time
  • over
By default, it has these enabled:
  • join
  • admin
  • kill
  • chat
  • rabbit
  • pause
  • leave
Unfortunately, it seems that bzadmin doesn't actually spit out the updated scores, it just says something like the following:

Code: Select all

*** Received score update, score for 2 player updated.
You could, of course, modify bzadmin to do what you want.

However, another direction you might want to look into would be writing some kind of server plugin. You could, for example, write out chat messages and score data to an SQLite database with a server plugin written in C++. Then you could have your Python script query that database periodically to see if there are new chat messages to print to the board, or score updates. Another option would be making the server plugin directly talk to the serial port. Or you could write a web service that both talk to.. or have the server plugin use the HTTP server built into the BZFlag server.. or probably other ways I'm not thinking of. :)
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image
mr64bit
Private First Class
Private First Class
Posts: 89
Joined: Fri May 06, 2011 4:58 pm
Location: Hang on, let me get a map...
Contact:

Re: bzscoreboard, a BZFlag LED sign controller

Post by mr64bit »

Very cool. What happens if several things happen at once? Say two people kill each other almost simultaneously?
---mr64bit
zshall
Private
Private
Posts: 3
Joined: Wed Nov 01, 2006 3:12 am

Re: bzscoreboard, a BZFlag LED sign controller

Post by zshall »

Thanks for the info!! I can certainly add more of the default bzadmin messages into the mix. As far as getting the score goes, there are two routes I see that could work. First off, I think I'll poke around the source for bzadmin and BZFlag and see if I might be able to copy the score displaying code from one to the other. I'm not very experienced with C++ but I can read code, and writing a server extension could be a nice opportunity to learn some C++. As far as a second option, a human operator could indicate to bzscoreboard when a tournament begins and I could keep my own dictionary of scores, adding and subtracting points relative to when logging started.

I'm aiming to make the program as extensive as I can, as it's already pretty limited in scope. The way I see a future version is that you will be able to pass in bzadmin show and hide commands and I'll have support for all of them. I know at least two different documented protocols for serial LED signs, and I'm planning on finding and adding more to allow one to specify a sign brand or protocol version in command arguments.

As far as what happens for events in rapid succession, I have a solution I'm working on too. Basically, I'm thinking of a priority-queue style list of messages to send. Messages like kill and "blew myself up" will have high priority, followed by messages like rabbit and chat, and finally join, leave, and server info. It takes anywhere from 3-5 seconds on average for any message to run its course, and since so many things can happen in a short time, especially on large servers, I'm going to have a maximum queue size at any one time, discarding lower priority messages that haven't been displayed yet.

I'm planning on using timing routines to throttle how many messages are sent at a time as well. The code for loading a message and displaying it are two different commands, meaning I can load a message and show it at a later time, and the fact that I can link the end of one message to another helps a lot. In fact, I could do dynamic linking of messages instead of hard-coding them to load in messages without needing to send a RUN PAGE command in the middle of a message.

Thanks again for helping!
zshall
Private
Private
Posts: 3
Joined: Wed Nov 01, 2006 3:12 am

Re: bzscoreboard, a BZFlag LED sign controller

Post by zshall »

I worked on it all day and I've fixed the problem of messages coming in too fast. I now have a priority queue described above in which low priority messages are bumped off and high priority messages stay on when too many messages are happening at once, and a forced wait time to make sure that one can actually read the messages before they're overwritten. Still no progress on getting an actual score, but I haven't had time to look into it yet. This week I'll try and do that.

In case anyone wants to run the program, the sign I use is the PL-M2014v6 TruColorXP.
Post Reply