Skip to content

Chasing bugs isn’t always fun. When I got back to it after my first release, a few useful tools went missing and I didn’t immediately realize it. Here’s at least 3 tools/functions that you want to use in development:

  • NSAssert – get your code to fail fast and report when a bad condition occurs.
  • NSLog – dump text to the console
  • NSZombieEnabled – an environment variable that gets really helpful to detect zombies.

You might want to disable NSAssert. NSAssert will crash your app immediately when a condition isn’t met (useful in development). I feel biased about disabling NSAssert when in production mode. First, none of your asserts should ever fire by the time you release to the app store. Second, if an assert did/should fire, what next… Well, either you have a fallback mechanism ready – then you probably don’t want a live app to crash at that point. Or (common case) you don’t have a fallback mechanism. Then what? Most likely, your app will crash anyway. So you will get a crash log, but that crash log might tell you nothing about the error.

You surely want to disable NSLog. NSLog is just wasted processing time and shouldn’t be used in production mode.

I’m not sure whether NSZombieEnabled needs to be disabled before shipping to the app store. My guess is, it’s a runtime setting, shouldn’t be passed to your app when running from iOS desktop anyways…

Code to conditionally disable NSAssert, NSLog.

If you put the following code in your *.pch file, NSAssert, NSLog get disabled when building for release – as a side effect of the __OPTIMIZE__ flag being set.

#ifndef __OPTIMIZE__

#define NSLog(…) NSLog(__VA_ARGS__)

#else

#undef NSAssert

#undef NSAssert1

#undef NSAssert2

#define NSAssert(x,y)

#define NSAssert1(x,y,z)

#define NSAssert2(x,y,z,w)

//

#define NSLog(…) {}

#endif

Beware that you don’t put code that actually does something inside your asserts. That probably looks like a no brainer, but it’s actually quite easy to accidentally paste a function call that returns a BOOL inside an assert, and forget that once the assert is removed, the call is being skipped. By any means, if you use the above code, regression test at least once in release mode before shipping your app.

Macros are evil! Welcome to the dark side.

1. [UIImage imageNamed:]

This retrieves an image from the ‘main bundle’ and loads it.

Try this:

  • [UIImage imageNamed:@"foo"]

If it works for you, you are running OS 4.0 and later. This won’t work on OS 3.1.3 or OS 3.2. Instead, use this:

  • [UIImage imageNamed:@"foo.png"]

This will work on all iPhoneOS/iOS versions and will also retrieve ‘@2x’ variants of your pics when available.

2. [UIImage imageWithContentsOfFile:]

Avoid using this. This won’t reliably retrieve ‘@2x’ variants (high quality images for retina display devices).

If you’re still hoping that your iPhone game will get reviews as soon as it is released, think again.

The market for app review sites may not be quite saturated yet. Meaning these guys have a lot on their hands. We haven’t seen too many thematic review sites yet, and it’d be nice to have sites focusing on, indie games… core games… arcade or action games, and so forth…

If you think a review will get your game to sell, start tweeting yourself to death. In fact, start your PR work even before you know what your game is about.

Anyways, iFanzine did grace us with a beautifully written in-depth review. If you’re wondering what Antistar is about and don’t want to get yourself dirty reading 50 articles on this blog, then you surely want to check it out. They have identified with threatening accuracy the main sources that inspired the game.

Thanks, iFanzine :)

Today I grabbed an iPhone4 – not quite at the price you get it in the US or the UK, and that gave me an immediate opportunity to judge the work I did on Antistar to support so called retina display.

For reminder, development started on an iPod 2nd gen. If you followed this blog on and off, you already know that getting the game to run at frame rate on the older iPods has been a constant struggle. Then I bought an iPad, and an iPhone 3GS along with it. The original plan was to do a separate version for the iPad, and performance tuning on the 3GS. The ‘iPad project’ sat in a cupboard for 8 to 12 weeks.

Optimizing for 3GS and iPod 3rd gen

On the 3GS, it became clear very quickly that there was spare processing time. Since I had already implemented depth of field (DoF) balancing (less details in the background when running out of processing time), this translated immediately into… more detailed images.

But I still felt I hadn’t reached the limits. So I figured a way I could introduce antialiasing without directly relying on the GL (remember multisampling is a late addition on iDevices), and that turned out to be rendering on canvas 1.5x as big as the screen, and letting the system resize and antialias the picture.

Well. That looked pretty good, and the game was still running very smoothly. Adding antialiasing did cause the DoF balancer to kick in at times, but nothing like the iPod 2nd gen.

The ‘Retina incident’

Now we get to the part that finally cost me nearly a $1000 (that’s what I got mine 4!) and somehow produced, as a collateral, a universal app running on all devices.

I postponed getting iOS4 on any of our devices. I also postponed getting the latest SDK. Seriously, if you’re about to release a game, what do you want? Do you want to fix all the bugs, then look into device / OS specific issues, or do you want to make a mess?

The first big surprise came from the iPhone4 simulator, and a short email clearly indicating that all iPhone games would run on the iPhone4 anyway.

Surely I did want to support the retina display (and the game does!). That still left me guessing what the performance of the device might be. With vague echos suggesting that the iPad and the iPhone4 ran pretty much the same hardware, the best way to have a try must be to run the game on an iPad. So I migrated the build to universal, and got to work.

At this stage, I was in for the second big surprise, and not a good one: given a bigger screen size, the iPad’s horsepower is worth something between the iPhone3GS and the iPod touch when it comes to 3D rendering (assuming you take away GPU optimizations, and I don’t have that running yet). Meaning…

…meaning that the DoF balancer kicked in much earlier on the iPad than it did on the 3GS. Kind of regrettable considering we have a much bigger screen, providing a more immersive experience, somewhat at the expense of having to handle a heavier, clumsier device.

And then what, well, this is what I did:

  • Disabled antialiasing on the iPad. the game looked beautiful in a different way, and surely ran smoother and better than on the 2nd gen iPodTouch. No great loss then (and no negative feedback from players).
  • Limited the canvas size to 1.5x iPhone – quite the same as the 3GS, but not rendered quite in the same way. Instead of antialiasing by blending pixels, we’re running somewhat under the maximum definition.

Where the user experience comes in…

Players reported that the iPhone 4 renders ‘just a little better than the iPhone’. If you’re comparing with an iPhone 3GS, this is necessarily true. We get a picture that’s just a little more crisp on the iPhone4. Other players asked me if the game really supported retina display. And it really does! But not quite in the way mip-mapped textures or a 2D game would look on your iPhone4.

I don’t feel my players on iPhone 4 are very happy. The truth is, they’d rather have less depth of field (and not know about it), than have less definition. Because increased definition is what they dropped the buck for.

So what’s left for me to do is drastically improve the engine performance. Because I don’t want anybody to feel they don’t get what they paid for.

Oh my. think about it, it’s a $3 title and it needs to run on a screen that’s 4 to 6 times as big as your PS3’s telly.

Hairlock - dev pic
Today I got a second Antistar review at iPadGames.org. I’m also preparing a proto-site (to get affiliated so I can track ad performance, although…

…the gut feeling at the moment is, not worth it.

I’m getting close to 200,000 impressions and 700 clicks in just a couple of weeks, with 3 spots and a google ad campaign over London. With 200 sales so far and a strong feeling that no more than 5% of these come from advertisement, I’ll be dropping my wishing coins into another well.

It may be worth noting that ppc google advertisement is costing me 3 to 10 times less than other channels.

iPadGames.org is the weirdest review site ever. Seems like a genuine .org, and I had to skim through other reviews to come to terms with the fact that the ever so slight cynical tone is normative, with little beyond the descriptive level to speak for each and any other title. Or maybe there just isn’t anything exciting on the iPad yet… Oh well. At any rate, it’s a genuine .org since I’d be hard pressed understand how they monetize. No referrals(?) No advertisement(?), no ‘features’.

Since you ask… OOgtech is a .org because I’ve registered the .com somewhere else, and I can’t access it at the moment.

5 minutes of celebrity

On Friday the 13th of August (Tokyo time), Antistar 3D:Rising made a quick dash into the top 75 adventure in App Store Japan.

My, it’s all in the title.

If you’re still missing out, best time to get onboard and try our serial adventure game. 4 chapters delivered, more on the way via free updates and rated 4-5 stars by more than 50% of players in the US app store.

App store link:
http://itunes.apple.com/us/app/antistar-3d-rising/id383382828?mt=8

Promotion ending as follows:

Honolulu: 24:00 Friday
Los Angeles: 03:00 Saturday
London:         11:00 Sunday
Beijing time: 18:00 Sunday
Tokio: 19:00 Sunday
Kiritimati: 00:00 Monday

Honolulu: 24:00 Friday
Los Angeles: 03:00 Saturday
London: 11:00 Sunday
Beijing: 18:00 Sunday
Tokyo: 19:00 Sunday
Kiritimati: 00:00 Monday

Hairlock - dev pic

Originally developed under the codename ‘Hairlock’, Antistar 3D: Rising. is a universal game (iPhone, iPad, iPod Touch) published on the 1st of August 2010. Artwork in the game is a mix of Blender art and procedurally generated elements.

A Key Decision…

It was decided very early that all the details in the game would be modeled – no textures! There are several reasons why Antistar was created this way:

1 – I have never been very fond of textured games. This is isn’t because I think textures are bad, but because usually, I find that textures are abused, becoming an easy substitute for shading and high quality visual content.

2 – I trained myself in blender around 2000-2002; I always focused on modeling.

3 – Supporting textures would have added a load on the engine, taking longer to develop, leaving much less time to produce the actual content, making it potentially harder to run at frame rate and increasing loading times.

4 – Although it is now available on iPhone 4 and iPad, the game was originally developed to run nicely on an iPod Touch. On a small screen, the need to crowd scenes with tiny flatland decorations isn’t obvious – even if some games (e.g. Samurai: Way of the Warrior) use textures very ingenuously.

Blender’s good

Edit mode rocks!

Back in 2000 when I discovered Blender, I was still looking for software that could help me make my models. I am not a professional artist, so I need to try again and again until I see what I have in mind in the 2D view. Blender’s edit mode, with one hand on the keyboard and another securely cuddling the mouse, lets you change things over and over again at the speed of thought.

While the game doesn’t use textures, Blender has a nifty ‘retopo’ mode allowing to project geometry onto a surface while editing. This was used to add effects that make some players think that the game supports textures, but more importantly, offer an OK substitute to textures in situations where they’re really needed.

Free and comprehensive

It just turns out that Blender is completely free, open source and comprehensive. I didn’t use many features, but these are key to creating a game:

1 – Support for bone animation, with a little of a learning curve, but the same ergonomics found in edit mode, allowing to quickly define and adjust areas of influence for bones, add constraints, etc…

2 – Python scripting. I looked around for an export plugin for ages before getting into it, only to realise that python scripting isn’t hard, and there are key advantages to writing your own file format for 3D. In Antistar, geometry is loaded on the fly, in a format that Open GL understands, as exported directly from Blender, in just a couple of clicks.
Hairlock - dev pic
Technical data

How much geometry in there?

As this was my first 3D engine, and my first experience on a mobile platform, I was fairly cautious when I started modeling, as I was worried I would run out of GPU time fairly quickly. Over time I realised that (a) rendering is pretty fast, even on an iPod Touch 2nd gen, and (b) once we do away with mapped images, we have a lot of polygons to play with (it’s also good to know that smaller poylgons render much faster than large ones). Here are some examples:

- Humanoids and other creatures: 650 to 2500 vertices/quads(*)
- Small decorations: ~40 vertices/quads or less. These can get duplicated a few dozen times in the same scene.
- Terrain (e.g. the ‘incubator’ scene displayed at the top): up to 10,000 vertices/quads.

(*) In most cases, the number of vertices is roughly equal to the number of quads.

Rendering

For rendering, I used a mix of just-in-time calculated and real time lighting (for actors and props). Evaluating simple illumination on the fly while loading models has advantages, but I haven’t implemented a method to refresh lighting following the day/night cycle in the game; instead, fog is used to affect the rendering of the environment according to the day/night cycle.

I’m still considering whether to use LOD (level of detail) nodes (aka, lighter models when viewed from far away) or not. In the first version of the game, I used depth of field balancing to avoid dropping the frame rate too much. depth of field balancing works quite well, although it seems a little difficult to make it perfect :) . in the meantime, artefacts aren’t usually disturbing and may even bring a little life to the game, with soft oscillations in depth of field and fog level.

Cheats ?

At times 3D can get a little intense. To create the dark forest near Klinnburg, I flattened the trees, only leaving 2D geometry. This allowed keeping patches of procedural grass that I kinda like, and adding walkable stones here and there. I don’t like doing that too much, because it always does show a little.

Future work

materials

In the first release, the exporter only processed RGBA colors for materials. The engine is a little more powerful though, as it can take parameters for shading, ambient… well, the basic kit.

I probably want to get better at python scripting, so I can explore ways of generating geometry using plugins, and better balance what’s generated on the fly versus what gets loaded.

Hairlock - dev pic

level editor

Currently, my export plugin handles objects and bone animations quite well, but it works more like a library export plugin, with any blender file containing a generous mix of actors, items and terrain. I want to take the time to turn this into a level editor. This would help streamlining the workflow, as for now the ‘level editing’ process consists in walking around the world and writing down coordinates (**)

forward raytracing?

And finally, I’ve been working on ‘rough and ready’ procedures for self illumination (!). This can be used part in real time, part by pre-calculating contributions. Initial results are promising and the results may ship with the game within a couple of months!

————-

Antistar 3D: Rising – is a realtime 3D adenture taking advantage of 3D capabilities on the iPod Touch, iPhone 3G/3GS, iPhone 4 and iPad. (app store link)

After 9 months of patient (neurotic?) elaboration, Antistar 3D: Rising (codename ‘hairlock’) is now available on the app store.

App Store link:
http://itunes.apple.com/app/antistar-3d-rising/id383382828?mt=8

Here’s what players say on forums:

“It’s a different adventure experience and it’s something I’ll definitely have to play more of to get a better impression”

“pros include: a very fitting and atmospheric soundtrack, day/night cycles in the open-yet-linear world, properly written dialogue, no loading times, small monologues from the protagonist as she comments on her situation and surroundings (gives her more character), unique and artistically styled environments, and the ability to play in either portrait or landscape.

“I totally dig the psyched out gfx and enviros”

Sure! I’ve picked the best. There’s always a way to find negative comments especially if you spend enough time looking for them.

I want to take this opportunity to thank everybody who’s been visiting this blog since I started this project. There hasn’t always been much else other than page counts to encourage this work, and overall, I already know it’s been well worth it.

So yea. Here goes, did put a game together eventually. Time to stop?

No way! I think we’re here to stay.

While I get out of the promotion and release mess, an artist is helping me out towards a second release.

Tell you what. I can’t wait to get back to design and dev.

Hairlock - dev picUpdate: Antistar 3D: Rising is now available on the app store!

Why is a 13 year old dreaming of metal cities?
What lies in the dark forest beyond Klinnburg?

Anticipating the success of the Twin Star Saga,
Antistar 3D offers stylish anime action and adventure.

>> Watch the video
>> More screenshots

Join the buzz or check discussions on Touch-Arcade forums.

With an exciting title putting experienced and new players on fair ground, we’ve just proven that mobile entertainment owes nothing to game-boxes:

Hairlock - dev pic

  • Realtime, fullscreen interactive 3D
  • Unique mix of adventure and arcade
  • Unexpected allies and opponents
  • innovative ‘no grind’ gameplay
  • An original cast of haunting, magic creatures.

From the quaint emptiness of a marooned village to a mice gang’s lair, become a child without memories,
armed with only courage and a forward attitude to solving life’s little annoyances – not having a clue what’s going on, not having a chance against oversize wildlife and getting captured by really bad guys.

With procedural landscapes, three dimensional growth and beautifully detailed models,
Antistar 3D: Rising pushes the limits of 3D on mobile platforms and will seamlessly adapt to your device’s capabilities.

Main Contributors: T.E.A de Souza, Chan Zhang, Karen Xu; Music: Matt Hansen (Calpomatt), Justin R. Durban (Edgen), Mark. SFX: Mark E Buckland, Robert Gacek (FXProSound), Joel Carli, Sith Master, Starmanltd, The_lone1, T$_Technologies.

Antistar 3D: Rising will be distributed as a universal app taking advantage of all device’s capabilities:

  • Basic rendering optimized to run smoothly on iTouch
  • Antialiasing (iPhone 3GS)
  • Retina Display (x1.5 iTouch definition 3D view)
  • 1004×768 full-screen on iPad

Visit the product homepage for a quick description.