Thursday, May 31, 2012

BlackBerry GamePlay3D 2

The previous build is boring. Let’s kang some code from SDK sample 1. And by kang, I mean replace virtually all of the code.

Rubber Ducky, you’re the one!
Riveting. That number in the upper left is the FPS display. I don’t like it. Let’s mess with it.

Now if you have built the sample application you’ll notice that my build looks a bit different than yours. I did some work on automatic recognition of the target system, the build environment, and so on. This is relatively easy, but I made it difficult (three header files that will recognize pretty much every processor/build environment since 1980). I split the previous drawFrameRate function into two, making a new function drawText that drawFrameRate calls. I then added a new function, drawBuildString. All preprocessor definitions are strings (automatically selected, but I’m not posting that) with the exception of GAMEVERSION, which is a float. In any case, the relevant code looks like this:

// Debug vs Release
#ifdef _DEBUG
#define BUILD "Debug"
#define BUILD "Release"

#define BUILDSTRINGFORMAT "%s %1.2f%s.%s.%s.%s %s %s"

void Core::render(long elapsedTime)

   // Draw compile info
   drawBuildString(5, 1);

   // Draw the fps
   //drawFrameRate(_font, Vector4(0, 0.5f, 1, 1), 5, 10, getFrameRate());
   drawFrameRate(5, 15);

void Core::drawFrameRate(unsigned int x, unsigned int y)
   char buffer[16];
   sprintf(buffer, "%u FPS", getFrameRate());
   drawText(_font, Vector4(0, 0.5f, 1, 1), x, y, buffer);

void Core::drawBuildString(unsigned int x, unsigned int y)
   char buffer[128];
   drawText(_font, Vector4(0, 0.5f, 1, 1), x, y, buffer);

void Core::drawText(Font* font, const Vector4& color, unsigned int x, unsigned int y, char* buffer)
   font->drawText(buffer, x, y, color, 20);

Now we have a baseline to build a real application. My first concern is file system/network streaming. I want a system where I can precache octree nodes and stream them regardless of data source (the application does not know or care whether the data comes from the file system or the interwebs). Additionally, I want each level of the octree to contain a mipmap of the combined sublevels. By this I mean that if I load the top level of the octree, that level contains a lo-res version of all necessary data for rendering. Each subdivision (leaf) of the octree contains increased detail. We will see how well this goes.

Prior to that, I need to deal with file formats. Gameplay includes a proprietary bundle format (.gpb) that requires a proprietary tool to build (think Doom WADs back in the day - It is a well thought out, comprehensive format. What seems to be lacking is support for compression and encryption. For this, I will use the public domain LZMA SDK that can run on ARM, x86 (actually 386 onward!!!), PowerPC, and so on. The question is how to do this. If I were designing this from scratch, I’d say that I would want to compress the data within the container. I want to minimize my impact on the SDK, and avoid unnecessary rewriting of the toolchain, so I don’t think that is the way to go.

What I think I need to build is a comprehensive Resource Management system. The Bundle code does a lot of this already; however, it appears to be path dependent. By this, I mean that assets are represented in code by their string path. If I want my rubber ducky model, I load it:

// Load mesh/scene from file
Bundle* bundle = Bundle::create("res/duck.gpb");
_scene = bundle->loadScene();

Then every time I want it I attempt:
// Get the duck node
_modelNode = _scene->findNode("duck");

This code isn’t checked, so if “duck” doesn’t exist in the scene, I crash. I don’t want to hardcode “duck” all over the place. And, I don’t want to crash if “duck” doesn’t exist. So what can I do with this?

So, to sum up, I need to build a resource manager with the following properties:

  • Transparent streaming from either local or remote file system
  • Precache capability
  • Intelligent unload capability
  • Mipmaps/Clipmaps/Level of detail (ideally the lowest level of detail will be compact enough to always be in memory)
  • Compression/Encryption support
  • Null (default, placeholder) models/objects
  • Ability to load resources individually or by node/cell
  • Centralized media manager not reliant on path or object strings
  • Reference counting for automatic release of memory?
A tall order, for sure. Many headaches loom ahead…

Friday, May 25, 2012

BlackBerry GamePlay3D

So this is the first in a series of blog posts that explore the cross-platform Gameplay SDK that BlackBerry (remember them?) is producing.
First thing to do is to explore and see what the capabilities of the SDK are.
Second thing to do is to clone the Git repository. I did this by using the quite nice (Metro style) Git for Windows application from

For whatever reason, this app thinks that I have modified SDK files (32 of them!), even though I haven’t. This prevents me from changing branches (from master to next, for example), even if I discard the changes for every file (has to be done individually, very annoying).

The program has this annoying behavior on both of my Windows systems (one running Windows 7, the other running the Windows 8 Consumer Preview). So, if you want one of the other branches, I suggest simply downloading the .zip archive from Git. Use the “Clone in Windows” button to clone using the Metro app, or use “ZIP” to download the snapshot.

If that is not a concern (probably should not be), then GitHub for Windows is good enough at cloning repositories. One other annoyance – GitHub for Windows does not allow you to select the folder where repositories will reside. The default (when cloning the Gameplay repository) is %Userpath%\%Username%\Documents\GitHub\GamePlay, so fair warning. I’m sure GitHub will for the kinks out of the program eventually (at the time of this writing it is only version 1.0, just out of Beta).
So for the next part, I followed the directions in this post:
The author does a great job of getting you up to speed quickly with a Windows app. Mobile platforms (Android and iOS) require quite a bit of additional work that I will not get into here. Start by running the gameplay-newproject.bat file in the gameplay directory.
Public Service Announcement: Build errors. C++ would not be any fun without them.

If you want to avoid them, I suggest keeping the project on the same hard drive as the gameplay sdk when prompted by the gameplay-newproject.bat batch file. Additionally, the batch file does NOT like path names with a space in them.

Make sure to add the gameplay.vcxproj project (located in your Documents or wherever you extracted the .zip to) as a dependency.

Then build! I am using Visual Studio Professional 2010, but it should build just fine in an Express edition if that is all you have. I would not recommend using a version older than 2010, though.
Great success. But boring.

Next time, we will spice this up a bit.

Monday, May 3, 2010

TBB Actor Model

I have been interested in the Actor Model for some time. I have previously written some functioning actor code, but I was a little overzealous in my application of the model, it was single threaded, and my message-passing scheme was extraordinarily slow. I have also been interested in the potential of TBB for some time. Game Programming Gems 8 has a very well written article by Robert Jay Gould about implementing the Actor Model using Intel Threading Building Blocks ( Naturally, I was excited to get my hands on the project and start messing around. Unfortunately, the code associated with this article is missing off the included CD. I figured that I might be able to find it online, and in fact, I did find the project (owned by Robert Jay Gould) at Google Code: GO figure that the project has no source files in Subversion. A bit further digging (OK, the next thing down on the Google search results) resulted in finding the following in the Intel TBB forums: (Associated but older links are and Some acknowledgement is given here:; however, it simply notes that the project is "embryonic" as of July 21st 2009. I have taken what code gleaned from the TBB forum and I am tinkering with it, but hopefully somebody (read RJG) posts the content that was supposed to be included in GPG8…

Sunday, May 2, 2010

Family Guy - Brian and Stewie

Nausea. So nasty. Never before in my life has a cartoon induced such a negative physical reaction in me (with the possible exception of Junior High Health class). I could smell the diaper - I could visualize the hot nutty schmear piled on top of the absorbent liner... Awesome, totally awesome episode. If you missed it head over to tomorrow (when it should be posted) and check it out.
Sent from my Verizon Wireless BlackBerry

Times Square VBIED

It seems to me that the Vehicle Borne Improvised Explosive Device (VBIED; colloquially 'car bomb') found in Times Square at approximately 6:30 PM Eastern last night was intended to cause one of two outcomes. Terrorism was the means, and terror was the goal. Both were accomplished, although New Yorkers (perhaps because we are all so jaded) aren't exactly freaking out and there are people going about their business as usual in Times Square. They would be well advised to stay on their toes, and this incident provides a timely reminder that all is not well with the world.

Before diving into the possibilities that I see, a discussion of the device is in order. The construction of the device was, in a word, childish, as if it was assembled by a 12 year old with pyromania. I am basing my opinion on the description of the device by NYPD Commissioner Kelly. He described the device as consisting of two 5-gallon canisters of gasoline (evidently not pressurized, and therefore merely flammable) with an 'explosive' between them (M-88 firecrackers evidently serving as primers throughout the VBIED). These were sitting in the back seat. Behind the seat in the cargo area were 3x ~15 pound standard propane tanks of the type that you use on your barbeque grill. One of these had M-88's strapped to it (rather ineffective primer I think). Behind that a metal gun case (dimensionally probably a rifle case of the type you check weapons under the plane in) filled with several 'bags' of an unidentified chemical substance (probably fertilizer per Kelly, and no hints that it was soaked in fuel oil). According to Kelly the system was functioning, referring to the wiring and potential to actually detonate. Taliban claims to the incident are likely unfounded (

The device evidently would have functioned by first igniting the gasoline, then the ensuing blaze detonating the propane (assuming the M-88 was ineffective), and then detonating the presumed fertilizer in the gun case. This sequence of events could conceivably take only minutes; however, that leaves plenty of time for a warning to be raised (as it was) and people to get safely away. This in and of itself makes the device orders of magnitude less efficient than an instantaneous device. Also, the vast majority of the device was constructed using materials that deliver an impressive fireball but very little oomph (the effects are NOT directly related). These points beg the question: did the perp want the device to be discovered before it hurt anybody?

The ultimate point of terrorism is to scare people into pressuring their government for political change. In this case the message seems to be that it is still possible, even in our current world focused on homeland security, for significant civilian targets (i.e. Times Square) to be hit. The unlikely possiblity exists that this bomb scare was perpetrated by someone simply trying to remind us of that for our own good. This perverse altruism is reinforced by the apparent 'slow' and exposed design of the device (lending itself to discovery and deactivation), and would almost certainly be a product of some delusional psychopathology. Regardless of motive, the individual amateur theory is reinforced by the poor design of the VBIED itself. If they were to operate in a group/cell, they would be far more likely to produce a better bomb (someone in the group could have at least Googled the proper way to build a bomb), and the apparent lack of group involvement lends support to psychopathology. It is important to note that disorders such as Schizophrenia do not necessarily preclude higher brain planning functions and so on. Sub-clinical diagnosis is also possible, or an individual disturbed enough to want to lash out at society (a la Timothy McVeigh). In the latter case, the intended message would more likely be to protest against the excesses of commercialism.

If this was in fact perpetrated by a group, the likely motive would be to observe and analyze the police response for use in future 'real' operations, and/or to provide a distraction and resource sink for the NYPD while something happens elsewhere.

While I am just speculating and rambling, the important thing to take from this is to keep your eyes peeled for things that are out of place and don't be bashful about alerting the authorities to them.
Sent from my Verizon Wireless BlackBerry

Thursday, April 29, 2010

Quake Standards Group redirects to and is apparently parked by an Israeli ISP of some kind or another:

I figured I would post links to the archived versions and duplicated content as I come across them.
For the old tutorials:
For the site itself, the last useful copy on the web archives is:
After that date the archive doesn't have much except for a splash page about the site going down and/or SQL errors.
Given that the quakesrc forums were where most of the useful information actually was (far beyond the few things that actually got made into tutorials), here is a direct link to them from that date:
The links within the forum don't work, but they should give you an idea what to search for within
While searching for the information, I discovered that Pat Aftermoon (frequent quakesrc contributor) already has something like this up on his site:
Additionally, this inside3d thread provides a bunch of useful information:
I hope that somebody finds this useful. When I get some time, I might try to extricate my Bleeding Eye Studios forum and see what I (NeVo) had in there (I still have the vast majority of the code for my Quake2 project, but I do not recall where I left off). L

Visual Studio 2010

The install process took about 90 minutes, not counting the help files that are downloading now. The Help Library Manager is actually a nice tool, but its functionality should really be integrated into the VS installer instead of adding an extra step. It is not necessary to download the help files, as they are simply local versions of what is online, but I personally feel that they will be useful in the event of an internet outage or if I am not in a location with net access… essentially any scenario where I would not have access to the internet. Given that the NYC subway system lacks cellular and internet access for some reason (it is only the capital of the world and we are only in the 21st century) this scenario might be common enough for me. Following the installation of VS2010, yet another reboot is required, which is not really a big deal considering that Windows 7 boots fast enough, but still annoying. In my case, the option to 'Reboot Later' is grayed out inexplicably. The help installer seems to take forever, with the caption on the progress bar (which is not moving) vaguely stating that it is 'merging indexes' (shouldn't it be indices?). The next step is the DirectX SDK ( I am currently installing the February 2010 edition, but the next one is slated for June ( which will add official VS2010 support, a few random but useful Direct3D enhancements, and a bunch of housekeeping. Although I don't foresee doing anything so crazy with DirectX that it won't work in VS2010, there are no guarantees that anything I do will work so I may have to use VS2008 to compile in the interim (messy and inconvenient).