Page 1 of 1

BZFlag Embedded Port

Posted: Mon Mar 14, 2016 6:45 am
by macsforme
I'm pleased to officially announce my port of BZFlag's graphics code to OpenGL ES, which allows BZFlag to run on so-called embedded devices. BZFlag's graphics code was originally created to work on desktop computers, and what I've done is modified the graphics code to use subset (almost, with some differences) of those calls that will work on devices like cell phones, tablets, tiny computers, and handheld consoles. I have been working on this for about eight months, and it has been a significant amount of work (currently the "diff" from the main BZFlag project is approximately 32,000 lines long).

The source code is available at a GitHub repository at

It is worth pointing out that this is a personal project of mine, supported only by myself, and not supported by the larger group of BZFlag developers. This project takes a somewhat different direction than the main project is going in, so it is very unlikely that this code will ever be merged into the main BZFlag code repository. If you feel compelled to point out that this isn't a good direction for the main project, please save your breath... that's not what's going on.

I have the project working on several devices, and support for others may be within reach without much additional effort.

Raspberry Pi
raspberry pi.png
raspberry pi.png (296.47 KiB) Viewed 2990 times
Video (captured over component output, so a little grainy compared to HDMI)

The Raspberry Pi is probably the platform with the best support for this project right now. On my RaspBerry Pi 2 Model B, on an average map I would get somewhere between 30 and 45 FPS at 640x480, and closer to 30 FPS at higher resolutions. When the resolution gets too high, however, the framerate can drop significantly. Otherwise, the embedded client generally runs on the Raspberry Pi just like the standard client does on desktop computers.

ios.png (313.82 KiB) Viewed 2990 times

There have been a multitude of threads here discussing whether a BZFlag client for iOS would be feasible. Yes, BZFlag does run on iPhones and iPads. I chose the word "run" carefully, because right now you can navigate the menu and join games, but there is no touch control interface for driving, firing, and other critical functions. It is possible that with an external keyboard or a bluetooth controller you may be able to actually play the game (especially on a larger screen, like a standard iPad, or using AirPlay to stream to a television), but otherwise the client is mostly only good for observing games or some minimal chatting.

Would I like to implement full touchscreen support? Absolutely. Unfortunately, there there is a conflict between BZFlag's LGPL license and the Apple App Store terms, meaning that if I did implement such an interface (which would be a significant amount of work), I would not be able to distribute the finished product through the App Store. The options are to either 1) distribute the source code only, and make people compile it (a real pain), 2) obtain an alternative license to BZFlag's source code from Tim Riker (such as the Mozilla Public License, which is similar in many important aspects), or 3) re-create the game from scratch. I am hoping for option #2, but so far Tim Riker has not informed me whether he will grant such a thing, despite 8 months of waiting for an answer so far. If this is something you would like to see, it might help if you contact him as well and let him know that you support the idea (his email address is shown at the top of BZFlag's console right when you start up the game). Currently, further development on the iOS port is stalled while I wait for an answer.

GCW Zero
gcw zero.png
gcw zero.png (248.94 KiB) Viewed 2990 times

The GCW Zero is an open handheld console created several years ago. There was a topic about it on these forums several years ago as well. This is very different from other embedded devices because it has a gamepad-style interface. This device has a special branch in my repository due to special code required specifically for this device. The implementation is almost complete. You can play the game just fine on it; it primarily just needs an on-screen keyboard so you can enter your callsign and password and chat with other players. Support for this device is a work-in-progress, but it's coming along well so far.

Other Devices

I am interested in bringing support to other devices, such as Android phones/tablets, possibly the OUYA, and maybe the Apple TV, but right now I am trying to prioritize the platforms I've already started to support. It may not take a significant amount of work to support additional platforms. If you are interested in helping bring support to other platforms, feel free to have a look at the code or get in contact with me.

Re: BZFlag Embedded Port

Posted: Mon Mar 14, 2016 7:46 am
by netochka nezvanova
nice !

next a cardboard version? or rift....

Re: BZFlag Embedded Port

Posted: Mon Mar 14, 2016 10:39 am
by blast
Note that the GCW Zero version is currently less secure because it does not validate the SSL certificate, because that device is a broken mess. It doesn't bundle any root certificates, so Constitution has decided to (at least currently) disable SSL validation. And the device hasn't had any firmware updates since 2014-08-20, so it probably has a dozen other vulnerabilities. ... 14004ea15e

And also, the Raspberry Pi 2 and 3 are capable of running full OpenGL inside Xorg now with an experimental driver. You may have to allocate less memory to the GPU (say, only 128 or 256, maybe less) because it uses memory allocated to the ARM cores instead of the GPU and you have to enable the experimental driver. After that, you can just run the normal BZFlag client, which is packaged in Raspbian (sudo apt-get install bzflag-client). I have not checked if it performs better/worse than Constitution's embedded port, though.

Re: BZFlag Embedded Port

Posted: Tue Aug 01, 2017 7:44 pm
by messa
Any brief instructions how to compile that port? Unless you can kindly provide compiled binaries.


Re: BZFlag Embedded Port

Posted: Tue Aug 01, 2017 9:08 pm
by blast
There's instructions in the repository. There were also binaries posted on the GCW Zero site for that version.

Re: BZFlag Embedded Port

Posted: Wed Aug 02, 2017 12:55 am
by macsforme ... E.Embedded

Let me know if you have further questions related to the specific platform you are trying to build on.

Re: BZFlag Embedded Port

Posted: Mon Aug 07, 2017 9:54 pm
by messa
Not that I dive deep into compilation process but so far I've got to here:

Fresh current raspbian install. When I've tried to install packages as described in instructions apt screamed about the ares lib files. Package not available.

Is that package common in main debian tree?

Should I download ares source and compile it myself?


Re: BZFlag Embedded Port

Posted: Tue Aug 08, 2017 11:39 am
by blast
It would help if you'd provide the output of the apt/apt-get/aptitude run (along with the exact command you're running). Additionally providing the output of 'apt-cache policy' and 'apt-cache policy PackageNamesHere' (where PackageNamesHere are the names of the packages that are not working) would provide useful information.
EDIT: The apt command worked fine on my Pi3 running the latest Raspbian Jessie.

Additionally, again note that the Raspberry Pi can run the normal client if you just enable the experimental OpenGL driver in raspi-config.

Re: BZFlag Embedded Port

Posted: Mon Aug 14, 2017 12:05 pm
by messa
I've got everything compiled finally. Maybe I've missed to run apt-get update before or just file was temporary unavailable at the moment. Not quite sure.

Now I get error that SDL could not open video device.

Maybe SDL2 could not find it or something else.

I ran another OpenGL ES ported game armagetronad and runs fine. This is not related but it is form of testing :)

Re: BZFlag Embedded Port

Posted: Mon Aug 14, 2017 7:06 pm
by macsforme
Are you trying to run it from the graphical desktop? If so, boot into the command prompt and try running from there. SDL 2 has issues trying to support both X11 and the native video output at the same time.

Make sure you also allocated enough video RAM as the README states. Also, assuming you followed the directions to build SDL 2 from source (as required), please make sure you don't also have SDL 2 installed through apt as that version will conflict with the one you need.