Wednesday, September 29, 2010

Friendly Bugs Live Wallpaper v1.1

  - New Feature: Butterflies!  Six different types!
  - New Feature: Population Settings (ladybugs & butterflies)
  - Update: Categories in settings menu
  - Update: Name change from Ladybugs Live Wallpaper
  - Bug Fix: Now calling glFinish() to satisfy HTC's drivers

Ladybugs has long been the least popular of our live wallpapers, and let's face it: the lack of butterflies is why.  So, taking action on that observation, it now has a whole mess of butterflies (six different types) and if you set the population to "Invasion" you get swarms of them!

This, of course, means "Ladybugs Live Wallpaper" is now a bit of a misnomer, so after a few attempts that kept bumping into the 30 character limit, we're going with "Friendly Bugs Live Wallpaper" for the new name.  It's descriptive, it's totally friendly, and it's got a vaguely Japanese anime vibe that we like.

The butterfly models and textures are the work of Allyson Kates, who did damn well for just a few hours!  Getting the landing and taking off to feel right took a bit of time, but overall I'm happy with the result, and it'll probably get a bit of tweaking in future updates.  Summoning a butterfly when you tap the screen might make sense too. :)

Monday, September 27, 2010

How to disable vCast Media Manager popup

If you have an HTC Incredible, you probably noticed that as of the 2.2 update Verizon saw fit to include an agonizing popup every time you plug your phone in, telling you to install vCast Media Manager.  Here's how to disable that.  I use this phone as my main test device, so I get to see that thing dozens of times a day.  No more!

Here's how to disable it:

* Go to the dialer, dial ##7764726
* Hit Call
* Type Password 000000 (six zeros)
* Select Feature Settings -> CD ROM
* Disable it

Thursday, September 23, 2010

Asteroid Belt Live Wallpaper v1.0

(Android Market Link)
(YouTube link)

Been working on this one on and off the last couple weeks, and finally have it to a point where I like it.  For a change not a lot of tech development happened with this one, it was mostly a matter of tackling the art and scene setup, and I'm happy with how all that turned out.

There's a few dozen asteroids in the foreground that tumble from one side of the screen to another, with the rest of the solar system in the background.  The orbits of the planets in the system are tied into time of day, with the slowest (the green gas giant) orbiting once every six hours.  The rest of them are at 3, 2, and 1 hour intervals.

The original scene didn't have the planetary orbits outlines, and it felt rather empty, and was hard to understand where the planets are were relative to each other (since they're all different sizes).  Adding the rings helped that a lot and means you get to see some shift when switching home screens.

The sun is a couple of layers of alpha, rotating at different speets, multitextured together, with a color gradiant overtop.  The result in a subtle but attractive animation, I think.

This is the first wallpaper that's really leaned heavily on OpenGL's lighting for effect, I think, and it didn't turn out badly.  I'm actually quite happy with the asteroids -- they're two passes, the first diffuse lighting and the second specular lighting.  They've got a good cold shiny look that feels very appropriate, I think.  They're also dark enough that they don't distract as a background.

All told I'm quite happy with how things shaped up.  It still needs a few more user options, I think, but I haven't worked out exactly what those should be yet... they'll happen in future updates.  Any thoughts as to what those should be, I'm all ears.


Things to tackle over the next few days:

* Halloween update (ghosts & witches!)
* Vertex color support in model format
* Seahorse (finally) in Aquarium - 50%
* Upsell activity into Silhouette
* Butterflies
* Landscape mode upsell dialog
* More prefs for Asteroid Belt
* Implement Jungle Waterfall

Monday, September 20, 2010

Thunderstorm v1.2

  - Update: Sharper lightning bolts
  - New Feature: Minimalist Mode

Minimalist mode is actually a bit of an off-the-cuff feature in response to an e-mail asking if they could get just the lightning against a black background.  As it's easy to do, why not?

The lightning bolt graphics are now double the resolution, with some tech development done to offset the memory usage.  While previously all images were treated as RGB, now the engine supports loading of greyscale TGA images, and will appropriately treat them as luminance at upload time.  That means while the image is much higher res, it should actually be using a comparable amount of memory to before.

Notably, while the glTexImage2D description says input format and internal format are supposed to be separate, and that it's OpenGL's responsibility to convert from one to the other, I didn't find that to be the case on my HTC device.  Whatever your input format is dictates your internal format, so far as I can tell.  I suspect the internal format argument is more or less ignored.

Tuesday, September 14, 2010

NA Flags v1.15 & EU flags v1.1

  - New Feature: Custom Backgrounds
  - Update:  Removed banner-style Canadian flag
  - Update:  Added England flag

These are all pretty self-explanatory.  Everyone seemed to hate and loathe the portrait-mode Canada flag, so away it goes.  It was based on an actual banner that some reference photos showed (similar to American flag banners that might put the stars all the way across the top), but the general tone of the comments clearly didn't appreciate that.  It's gone now, as the customer is always right.

EU Flags gained the red-and-white flag of England, which was an oversight in the original release.  Sorry folks.

The Custom Backgrounds feature is using most of the same tech development as Aquarium's equivalent (which you can read about below), though it was interesting dealing with PreferenceActivity rather than with standard UI buttons.  Similar but not quite the same, and I'd been leaning on the load-from-XML implementation enough previously to not have to deal with it.

Aquarium v1.95

  - New Feature: Custom Backgrounds
  - Update: Three-position bubbler

Some people apparently don't like the new bubbler, so now the bubbler button is three-position.  Off, old style, new style.  Simple.

Custom backgrounds, on the other hand, took a while to get working, as there's actually some complexity to it under the hood.  On the surface it looks like a button, you push it, an image browser gets launched, you pick an image, and you're good.  Underneath there's some interesting complexity.  Let's discuss that for a bit.

Firstly, since Aquarium is OpenGL rendered, everything needs to be a power of two.  So, the first step was to load the selected image, determine the best power of two, and resize it.  The logic got a little more complicated though, as I wanted to make sure the size was reasonable and the proportions worked out sanely.  So, the actual logic ended up like this:

1) Determine the longest dimension, X or Y
2) Scale that dimension to the nearest power of two, maxing out at 1024.
3) Determine the amount of scaling it took to get it there
4) Scale the other dimension by the same amount
5) Find the other dimension's nearest power of two

This means you get something more or less proportional, with the longest axis safely capped.  Then you do some browsing around and the entire process gets task-killed.  What's up with that?

Basically, a given Android process isn't allowed to allocate more than 20 meg of memory.  In these heady days of 8 megapixel phone cameras, some of these images are freaking big.  Loading a 8 megapixel image and manipulating it takes up several meg of ram.  On top of that, a year from now we'll probaby be seeing phones with 12 megapixel+ cameras.  On top of that, what if somebody has some gigantic 8000x5000 photoshopped something or other on their SD card, and they select it? 

What to do about that?  BitmapFactory has a subclass called Options, which you can use to, well, set options on bitmaps when loaded.  One of these options (inJustDecodeBounds)  tells the system not to load the actual bitmap, but just load the dimensions.  So, to save loading the entire 8 meg image, I get the starting size, then work out what scaling factor (bitmap supports scaling to half, one quarter, one eighth, one sixteenth, etc) gets me to the 1000-1500 range (preferably) then load the bitmap with that scaling factor.  Sweet, I can now rest easy that I'm not blindly reading 40 meg of image data.

This works pretty good, we're back to being well within our memory budget.  Now the problem becomes the secure digital card, which lots of people store their images on.  The SD card can be pulled from the phone, or unmounted to be read via USB, and on top of that is unmounted at boot time for a while.  Basically, the SD card's presence at any given time isn't trustworthy.  So, you need to make sure that the custom image that's selected actually exists when you're trying to read it, and that you have a reasonable fallback -- I end up just using whichever standard background was most recently selected.  After that I check the status of the custom image's path every time the wallpaper becomes active, so if you put the SD card back in (or it finishes mounting after a reboot), it'll eventually get loaded when the user leaves and comes back to the home screen.

If the SD card is removed and the custom image is already loaded as a texture, then sweet, I keep it around until I'm forced to throw it away (like during an OpenGL context change).  This means you can take the SD card out and your custom image will remain visible until you put it back, almost all the time.

After all this, the thing seems to have gotten sewn up pretty well.  Hopefully if anything apocalyptic happens I'll get an e-mail.  :)

Monday, September 13, 2010

Halloween Live Wallpaper v1.0

(Android Market Link)
(YouTube link)

Had a few requests for one of these, and it was fun to put together! You get a collection of Jack-O-Lanterns sitting atop gravestones, with a full moon and swarms of bats in the background.  There's a cartoony haunted house with glowy eyes and everything.  :)

The prefs on this one are a little thin on the ground currently, but I expect to add more stuff over the coming weeks.  Basically, you can control the density of the bats and the color of the candles in the pumpkins, the camera speed, and can set it to only spawn bats when you touch the screen.

On  the technical side, the particle system now supports animated meshes as particles, which is what the stream of bats is composed of.  Particle systems now can have their spawning enabled and disabled at will, plus a few other minor features that should come in handy in the future.  The visibility system worked out for Bamboo works well in this case as well.  It's not nearly as object intense, but it's getting a few fps back.

I'm quite happy with how it looks overall, it was a fun project and it's cool to get it out there for folks to see!

Saturday, September 11, 2010

An Android Logging Class That Writes to SD Card

In case anyone's interested... I'm currently trying to work out the cause of a very uncommon lockup that happens with one or two of the wallpapers.  It only seems to happen on HTC phones so I'm honestly guessing it's a driver bug, but the real problem is that it happens with no apparent cause with a frequency of perhaps once or twice per day.

I've got an HTC Incredible here that I have seen it happen on, the problem is actually seeing what's going on.  I'd normally use the system log, but since this problem can lock-up the phone, that log gets wiped out upon a restart.  So, I've tossed together a simple static logging class that can output to an SD card.  The filename is tagged with the date and time upon creation, so it won't overwrite an earlier file, and since it's on the SD card it can run and get plenty gigantic.  I've put calls to LogToSD.write at the top of basically every single method on the wallpaper, so it's going to get big by the time I see it lock up next.  :P

Here's the class, if anyone's looking for something like this.  Don't forget you'll need to set uses-permission WRITE_EXTERNAL_STORAGE.

public class LogToSD
    static PrintWriter outFile = null;
    private static void initialize()
        try {
            File root = Environment.getExternalStorageDirectory();
            if( root.canWrite() )
                Calendar rightNow = Calendar.getInstance();
                long day = rightNow.get( Calendar.DAY_OF_YEAR );
                long hour = rightNow.get( Calendar.HOUR_OF_DAY );
                long minutes = rightNow.get( Calendar.MINUTE );
                long seconds = rightNow.get( Calendar.SECOND );
                String date = day + "-" + hour + "-" + minutes + "-" + seconds;
                File gpxfile = new File( root, "log_" + date + ".log" );
                FileWriter gpxwriter = new FileWriter( gpxfile );
                outFile = new PrintWriter( gpxwriter );
                outFile.write( "\n\n----- Initiating LogToSD Session -----\n" );
                outFile.write( "----- Start Time: " + date + " -----\n\n" );
        } catch (IOException e) {
            Log.e( "LogToSD", "Could not write to file: " + e.getMessage());
    public static void write( String text1, String text2 )
        if( outFile == null )
        Calendar rightNow = Calendar.getInstance();
        long minutes = rightNow.get( Calendar.MINUTE );
        long seconds = rightNow.get( Calendar.SECOND );
        long ms = rightNow.get( Calendar.MILLISECOND );
        String time = minutes + ":" + seconds + "." + ms;

        outFile.write( time + "\t" + text1 + " " + text2 + "\n" );
        Log.v( "LogToSD", text1 + " " + text2 );
    public static void shutdown()
        if( outFile != null )

Wednesday, September 8, 2010

Thunderstorm v1.15

  - New Feature: Tap to summon lightning!

This one's pretty simple but a few folks have asked for it.  Basically, there's now a setting that will cause lightning to flash whenever you tap on the screen!  It's a bit silly, so it's off by default, but it's there if you want it.  :)

This will be uploaded in the morning.

Aquarium v1.91 & v1.92

  - New Feature: Fish Selection Window
  - Update: Twelve Fish at a time!

This update happened pretty soon after the last one - sorry about that.  Generally I'd have waited longer, but v1.90 had an unfortunate bug that resulted in the particle bubbles being visually wrong on some phones.  I hadn't excluded them from mipmapping, and on some handsets the automatic mipmap generation doesn't work correctly with an alpha channel.

So, v1.91 was primarily to fix that problem.  At the same time I'd started working on a popup window for selecting your fish species, as the tap-to-cycle approach was getting kind of ridiculous when there's a dozen fish in the list.  The new window has all the available fish listed.  You tap the thumbnail, the window appears, and you make your selection.  It's a lot more elegant at this point, I think.

While I was messing with the UI, I figured I may as well use up that couple FPS we gained and allow 12 fish instead of 10.

This all went in just fine, until I started getting mail asking how to remove a fish.  Now, the thing to remember is, when I'm testing this stuff I ended up wiping my preferences a lot and starting from the default values... so while I'd confirmed all 12 slots worked I'd really just been testing the new functionality, and somehow managed to completely forget that you might want to take away fish too.

So, v1.92 was a rush to fix this problem, by adding the "no fish" red X to the popup window.  I confirmed it worked and got that out as quickly as possible, so hopefully not too many people needed to update twice in a day.  Sorry folks!

Thursday, September 2, 2010

Bamboo Forest v1.0

(Android Market link)
(YouTube link)

In the mood for something a bit zen?  Bamboo Forest is a serene scene of waving bamboo trees with shafts of light from above.  It's got a mess of color preferences for fog and light, along with settings for fog density and camera speed, and controls for enabling/disabling the particles and light rays if you don't like them.

There's a surprising amount of complexity to this scene, and a lot of time went into making it perform well with that many object visible and at that detail level.  It works well and is quite pretty!

A lot of useful functionality came out of this one, development-wise.  The export tools can finally handle multiple animated objects being exported in one file, for one thing.  Originally, the scene had somewhere in the neighborhood of 100 separate animated models at a time, and that was just too much for the phone to handle.  Some of these got thinned, while others got combined to reduce the total object count.

There's also a basic visibility system in place that avoids updating and rendering objects that are off-camera.  That doesn't sound like much, but none of the other wallpapers so far have really justified writing something like that, as generally they're floating around 5-15 objects at a time.  These features combined with a lot of profiling and optimizations should help make future projects go quicker and smoother, as a bonus.

Aquarium v1.9

 - New Feature: Particle-system based bubbles
 - Update: A bunch of optimizations

Most of this update is invisible, honestly.  Been doing a lot of optimization for high-object-count scenes and the library changes have been moved into Aquarium as well.  This gets it a couple of frames per second, but honestly it's high enough already that you probably won't notice.

The noticeable change is the addition of particle-based bubbles!  These are exercising a new system that is starting to work its way into the various wallpapers are updates are done, and feel a lot more dynamic than the old ones.

The original plan was to get better fish selection and a seahorse into this update... unfortunately other stuff got in the way, so that'll be in next round.