Friday, May 27, 2011

Life is what happens when....

I probably wont get a real post out this week. No, it isn't blogapathy, life and work is a little hectic right now.
Next up will be my game announcement though. Then maybe I can get back to hacking :)


Monday, May 23, 2011

Lot's todo

All developers are familiar with the infamous "//TODO" comment in code. It means "I know this code is not finished and will need work", or "I have deadlines and Fred's code is broken so this is the best that can be done until he fixes his library".  The problem is that these thing can linger forever. I know, I'm guilty of it myself.

Who hasn't seen things like:

//TODO fix after June

(But that comment was checked in 2 years ago)

//TODO see Fred for a fix.

(Fred doesn't work there anymore, by the way).

Amongst the many code quality techniciques and policies, such as unit testing, treating warnings as errors, and using static analysis tools, I propose a system for dealing with a "TODO" - something that has been identified as needing rework eventually.

In my Android Game, I have recently started using a class to denote such beasts. Behold:

Saturday, May 14, 2011

An alternative to the Android emulator and setting up ADB for TCP.

[Update 7/28/11 :See updated information at the end of this post]

I touched on it in my last post, but Android x86 running on Virtual Box can often (but not always) perform better than the standard Android emulator. OpenGL is painfully slow on either. I'm running one of their pre-built Froyo binaries, but Gingerbread source is on the site, if you're feeling adventurous.

The main advantages are:

  • it starts up faster
  • less prone to lockups the the SDK emulator
  • it depends somewhat on what you're app is doing, but many things, like file system IO and math intensive code, seem to execute much faster
The main disadvantages are:
  • Not very representative of a "main stream" Android device.
  • Cant be used if you're using NDK with native code targeting the Arm processor.
  • Configuration of things like screen dpi, and emulated hardware is not as easy or non existent.
  • You can't emulate certain operations like SMS
A guide to setting up your x86 virtual machine can found here: (It takes less than 10 minutes) Install Android Froyo on PC

Launching Android-x86 is not automated like the emulator and ADB takes slightly more effort to setup, but it's not hard. So here's my quick-start guide

Wednesday, May 11, 2011

Android OpenGL ES texture management.

My Android game is still 'coming along'. I'll be making an announcement post soon. It's consumed most of my late evening "dad time", I haven't touched a soldering iron in a while, I'll make up for lost time later.

Progress on the game has generally gone like this: bang out some framework code, bang out cool feature, cool feature, find a minor bug, spend the next few evenings pulling my hair out, framework code, cool feature, cool feature, rinse, repeat. This post is about one of those hair pulling moments and my solution. It revolves around Android's handling of the OpenGL texture buffer management API's.

Recently, I was reworking my texture management code in my "engine" (if you can call it that, it's really just a few folders of Java files with a focus on lower level Graphics and my own Collision detection). I wanted to add the ability to have "dynamic" textures, ones that could be created and modified in the middle of a game in progress. Android has been fun to work with, but the there is a dearth of documentation when it comes to the 3D stuff, you are typically refereed to external Open GL ES docs, or to the SDK samples, which invariably don't do what *you* are trying to do.

Disclaimer: Though I have been in the video game business for a long time, I have rarely done low level graphics rendering work. I would not consider myself a guru in that area, so take this post as food for thought and not as an authoritative doctrine. If you think I'm wrong on something, call me out!

Sunday, May 1, 2011

Rebuilt Swingset.

We inherited 1/2 a swing set from our neighbors. Last weekend, I turned it from this:

to this:

Alright, this isn't at all electronics or programming related, but it is still "hacking" in a form. The local hardware store doesn't stock parts for this purpose, they only sell "playground kits". It's mix and match, but they assume that you are buying a complete swingset, so they package some important parts in the big expensive kits, and don't sell them "loose". So I was on my own. At least they sold the actual swings separately, but I did have to make a return trip when I realized they did not come with hooks to mount the swing chains to the frame.