Hello everybody! I am happy to announce that Sparrow 0.9 has just cracked its eggshell and found its way to the download section.
Without further ado, I’ll describe the most important changes in the following sections. The detailed change list is, as always, part of the download package.
Beware: Interface Changes
There’s one thing we had to change for performance reasons. If you use the methods “colorOfVertex:” or “texCoordsOfVertex:”, the ID of the vertices has changed.
- old order: 0 = top left, 1 = top right, 2 = bottom right, 3 = bottom left
- new order: 0 = top left, 1 = top right, 2 = bottom left, 3 = bottom right
Sorry for that! But I guess that those methods are not used by the majority of Sparrow users, and it should be easy to change those calls. The alternative would have been for Sparrow to change the IDs internally, but I thought it was better to make the change now instead of carrying a workaround in all future versions of Sparrow.
Other things you should be aware of: Sparrow 0.8 requires the iOS SDK in version 4. The “Base SDK” of all projects was changed to “iOS 4.0″. Of course, you can still deploy to older system versions — that’s the “Deployment Target” setting of your project. That’s the approach that is recommended by Apple.
But now to the real enhancements!
Performance improvements
Isn’t that the coolest benefit of using a framework? You upgrade to a new version, and your application just runs smoother and faster. Better than a free lunch!
The changes won’t be visible when you start the benchmark (part of the demo project), though. The biggest changes were made in parts that are not tested by the benchmark, namely:
- Touch Events
- Rendering of Bitmap fonts (SPTextField)
The first change is a direct result of the huge number of objects in the higher levels of “Twins”. Touching a cell in those levels led to a visible performance drop. Well, not any more!
The other thing is something I wanted to improve right from the beginning, but never found the time. Now, all glyphs of a text that uses a bitmap font are sent to OpenGL simultaneously, which makes rendering of those texts much faster (3x-4x!).
Support for high resolution screens
It’s now extremely easy to create your game with crisp, sharp textures for the iPhone4. That’s achieved with the same convention as in Apple’s core libraries: just add the suffix “@2x” to the filenames of your textures, and they will be loaded automatically instead of the low resolution textures — only on devices with an HD display, of course. This works with all kinds of images: plain textures, texture atlases, bitmap fonts.
All you have to do is enable the feature by calling “[SPStage setSupportHighResolutions:YES];” at the beginning of your game.
The demo project is now in full HD — just change the device type of the simulator to see it in action. Other than the line above, no changes to the code of the demo were necessary!
Texture atlas generator
When you work with HD textures, it’s a lot of work to create all textures in two resolutions … normally. But Sparrow has got its own texture generator now, which does all the work for you! Create your images in the high resolution, and then let the tool create two texture atlases for you: the high resolution atlas, and a scaled down version. It even supports automatic sharpening!
Here’s a small introduction — a detailed description and installation instructions can be found in the README file (sparrow/util/atlas_generator/README).
# Basic usage: creates "atlas.xml" and "atlas.png" from the
# provided images
./generate_atlas.rb input/*.png output/atlas.xml
# The same with some options
./generate_atlas.rb --scale 0.5 --padding 2 --sharpen \
--maxsize 2048x2048 *.png atlas.xml
The next blog entry will show you in detail how to use this feature to create your next game in HD.
Miscellaneous
In brief, some other minor changes:
- Another utility, the “texture resizer”, can be used to resize those textures that are not part of a texture atlas
- Support for loading textures and sounds outside of the application bundle
- SPMovieClip now dispatches “SP_EVENT_TYPE_MOVIE_COMPLETED”
- SPJuggler’s “delayInvocation”-method now retains its arguments, which makes it easier to use
- fixed several bugs (thanks to all of the reporters!)
Last words
I’m very happy with the latest version of Sparrow. As you can see, we added a lot of functionality without bloating the interface — most functionality just works behind the scenes. The code base was also cleaned up in several places.
We are also proud to announce that several games have appeared in the app store that are powered by Sparrow! I’m looking forward to presenting them in a separate blog entry.
Now, happy upgrading! If you encounter any problems after the upgrade, don’t hesitate to post them in the forum — we tried our best to test everything, but you never know!



Well done Daniel,
What lovely news for a Friday! Cool stuff to play with on the weekend
I’ve got some questions if that’s ok:
Should it work happily with XCode 4.0?
Any special precautions one should take in the event that you have been using the 0.8 templates?
Then just a general question…. I loooove SVG. Why is it that one cannot use vector graphics directly in games, rather than using different resolution rasters? I suppose it’s speed, but it just seems “wrong” to use different raster sets instead of one scalable vector set of graphics.
Thanks for the update, hard work and well written blogs and instructions. Quality is a rare thing
Cheers,
Jacobus
Hi Jacobus!
I must admit that I have not yet tested it with XCode 4.0! I guess it should work, I hope that only the installation instructions need to be updated.
The project templates work fine, all you have to do is change the “Base SDK” to “iOS 4.0″ in the generated projects.
Concerning SVG: you are of course right, the best way to support different resolutions would be to use a vector image format like SVG! The problem is the way OpenGL (and current graphics hardware in general) works: by drawing triangles that have bitmaps mapped onto them. Who knows, perhaps that will change some time, but currently we have to live with that
! I hope that the texture resizing tools make the process as painless as possible, though!
Thanks for the nice words, and good luck with your projects!
Daniel
I can’t compile a scaffold project under both Xcode 4 and Xcode 3.2.1. The SPARROW_SRC variable is pointing at the documents_folder/sparrow_v0.9/sparrow/src. But still it says “Cannot find Sparrow.h”.
What am I doing wrong? I am new to Xcode environment, so I can’t handle this issue =(
Hm – please check if your target build information (in the left pane in Xcode, open “Targets”, then right-click on “AppScaffold”, choose “Get info”, then go to the “Build”-Tab) has “SPARROW_SRC” in the setting “User header search path”. Perhaps it was somehow removed from there.
BTW, the Forum is the best place for questions like these, because many users visit it regularly.
I hope that helps!
Daniel