Platform Transform

I’ve been burying my head in Brazil – the framework – over the last few weeks.

The first step was taking Friendlier and making it work as an API. Cutting vast blocks of functionality (which forshame resided mainly in one or two huge files) into firstly addressable chunks and then to plump out this component based API with blocks that would equate to finer grained control with subsequent apps.

To whit – I parcelled up the old stuff and kept it working while creating new things that had a cleaner and therefore more reusable interface. The output of this phase of work was a half completed game called Paulo. This is what Christmas Chickens is turning into. A 3D XNA game written using Brazil.

So once I had satisfied myself that the framework was usable I set about moving it immediately on to another platform. Why not finish the game? Well my goals are bigger than ‘just’ writing games and also not limited to one platform. I could just write a game in XNA if I wanted to target that platform. I wanted to see if this framework would translate to another platform – and I didn’t want to wait any longer to test out the theory.

Next stop – Eclipse, Java, Android OpenGLES. Big change from the (yes) cosseted world of Visual Studio and XNA 4.0.

Select java version, install java SDK, get Eclipse (or another IDE), download the Android SDK and virtual device (AVD) manager, then select and download target Android SDKs, integrate the Android and Mercurial plugins for my IDE and fire up a new Android project.

Then on to the OpenGL integration. Subclass the Renderer object and port my existing C# framework into Java. This bit is relatively straightforward as C# and Java share a great deal of syntactic similarities. The larger challenge is working out how much abstraction to keep in Brazil for Java. OpenGL is a lower level API than XNA is therefore the choice is to bind directly with it or introduce some XNA like helper components such as Vector3s and BoundingBoxes. However, so far so good. I have a working Java framework and a working application and I’m able to fire up a virtual Android device and see the app working.

Next steps will be Paulo for Android and then I tackle the next platform. I’m documenting this transformation here and also over on the xyglo site where you can see code examples.