I was a bit bored today, so I started playing around with the new “text” object in BZFlag 2.99.x. (For those of you who don’t know, 2.99.x is the development version that will become 3.0.0 when released.) Because of the new font engine in the game (FTGL) we can pull in any TTF font and use it in the game. The text object uses this same font engine. It can pull a font file from a web address, as well. You can then position the text anywhere in the map. I’ve already seen an example from the Planet Mofo crew that was a scoreboard of the top players on the server. My example won’t be that cool.
I wrote a basic plugin called NewestPlayer. When a player joins, a variable named $newestPlayer gets set to their callsign. A text object in the world can then make use of that variable. When a player joins, the variable changes, and the text object will update in real-time.
Here is what it ends up looking like. Hard to see in the thumbnail, so click on it for full size.
I have the plugin and world file posted as well, so click on over to the full article.
The plugin code is dead simple. It only has one event, so I didn’t need much code. I also have the map file itself here.
NewestPlayer plugin Source Code (14KB ZIP file)
Map file:
box size 20 0.5 10 position 0 0 5 end text name test string Our favorite player is: font http://trepan.bzflag.bz/fonts/edenmb.ttf justify 0.0 fontSize 48.0 shift -10 -0.55 10 upright end text name test2 varName $newestPlayer font http://trepan.bzflag.bz/fonts/edenmb.ttf justify 0.0 fontSize 48.0 shift 0 -0.55 10 upright end
I can see this object having huge possibilities, and I look forward to seeing what map authors do with it!
Pingback: Another example of the text object – BZExcess