Dingoonity.org

GCW Zero => Development => Topic started by: macsforme on July 02, 2016, 04:13:07 am

Title: BZFlag
Post by: macsforme on July 02, 2016, 04:13:07 am
I have been working on a port of BZFlag (http://"http://bzflag.org") to the GCW Zero. I'm pleased to announce that it is in release candidate status, and just waiting on some testing until I have enough confidence in it for a stable release. BZFlag is a tank game originally created in the 1990s, but still has a following today.

An .opk binary and the source code are provided at https://github.com/macsforme/bzflag-embedded/releases/tag/v2.4.6.gcw0.1-RC1 (https://github.com/macsforme/bzflag-embedded/releases/tag/v2.4.6.gcw0.1-RC1). You are welcome to build it from source, but due to several external dependencies it is complicated to do so. See the file "README.Embedded" in the source code for instructions.

There are a few factors to keep in mind:

* The playing controls can be found in the "Help" section which you can access from the main menu.

* There is a set of servers just for GCW Zero users, which is what you will get by default. If you want to play with desktop users, on the "Join Game" screen, go down to "Protocol" and toggle it from "GCW Zero" to "Desktop." Keep in mind that some of the more popular maps for desktop clients have some very complicated geometry which will slow the GCW Zero down to a crawl, so stick with simple maps.

* This client uses the main BZFlag game list server, which was already a bit flaky at times and even more so with the sluggishness of the GCW Zero processor compared to desktop computers. When you select "Find Server," occasionally it may fail, so if nothing comes back after 20 seconds or so, back out and try again.

* This same list server uses an authentication system for registered players (you would register an account at http://forums.bzflag.org and enter the same username and password in the game). Trying to authenticate with a registered account seems to compound the above flakiness, so it's best to try an unregistered name and stick with that (if the game kicks you after you join, you might be using someone else's name, so try a different one).

* While porting this game, it was a significant effort to adapt the menus, controls, and rendering code for a console system, and I encountered several driver issues and bugs that required workarounds. Nevertheless, I've worked hard to polish it and I believe everything is now working pretty well. If you do encounter any issues, it would help me out significantly to have these reported to me so I can try to iron them out prior to the stable release.

Enjoy.
Title: Re: BZFlag
Post by: Senor Quack on July 03, 2016, 03:42:37 am
This is great, I had quite a bit of fun playing on public servers. Unfortunately, noone was on GCW servers at the time. I think you should release it officially. It's obvious you put a lot of work into the port, so thank you very much.

What GLES driver issues did you encounter BTW?
Title: Re: BZFlag
Post by: macsforme on July 03, 2016, 06:00:05 pm
Thanks for trying it. It's rewarding when people enjoy the end result of your hard work. I do intend to release it officially soon, once others have helped me test it and I've fixed any bugs that are revealed.

As far as the GLES driver issues (this is for OpenGL ES 1.1):

First, drawing GL_LINE_LOOPs or STRIPs causes the program to crash. I had to convert them all to GL_LINEs.

Second, BZFlag uses a scissor area to draw the radar in a box on the screen. On the GCW Zero, when GL_LINEs from the radar were drawn outside the scissor area (which should have simply culled them), it caused line artifacts to flash across the radar area. I thought, no problem, I'll just use a stencil test instead, activating only the pixels in the radar box. Nope, that didn't work either (I don't recall exactly, but I think it activated something like every other horizontal line in the stencil test area, instead of the solid quad). What finally worked is when I used the depth test, clearing the depth buffer from the main scene and then masking out the area outside the radar box prior to drawing the radar.

Third, turning the texturing setting to off in the program would cause it to crash when starting up the next time (although you could continue to play with texturing off while the program was active). I tried for a long time, but I couldn't figure out exactly what is triggering this crash (the backtrace showed it was crashing somewhere in the GLES driver). The workaround for this is to not save and reload the texture setting; you can turn texturing off, but it will revert to the standard setting the next time it loads.

Fourth, I noticed that using the GL_RGB texture format caused textures to fail to be rendered, so I had to use GL_RGBA (I also noticed this on other platforms that use OpenGL ES, so maybe it's a widespread issue).

Fifth, glClipPlane() simply doesn't clip against the specified plane. I had to once again hack up the depth buffer to block out the area under the ground so that effects are properly clipped (I also experienced this issue in the Mesa OpenGL ES implementation on my desktop, so it may not be a unique issue to the GCW Zero).

Those were all I could think of.