Phasic Labs Dev Blog game development musings from Phasic Labs

2Mar/113

XCode, iPhone, and updating resources

A bit of a techy blog post this time, but hopefully this will be of use to any iPhone developers out there.

It's a well know problem that if you add resources to your App using Folder References, rather than manually adding each resource to your project, then if you update the contents of the folder externally to XCode, XCode does not always update the resources in your App next time you build.

See http://majicjungle.com/blog/123/ for more info on this, and a workaround that seems to work for some people (a script that touches the resource files).

I've tried using a similar script to the one described at the previous link however, and still find that I have to regularly clean and rebuild my app to get the latest levels into my game.
This can be vey time consuming when you are tweaking a level, and need to make small changes and restart the game often.

I finally came up with a solution that works for me every time.

Rather than letting XCode manage my resources (using the Target's default Copy Bundle Resources script), I wrote my own script to copy resources directly into the built App.

I'll walk through an example of how I did this for the game I'm currently developing.

The game has a folder called Levels, with a number of subfolders (world0, world1, etc.), and each subfolder has a load of individual level definition files.

I had originally dragged the Levels folder into my project Resources, as a folder reference. XCode automatically adds the folder to the Copy Bundle Resources script of the project Target.

To see this in your own project, expand the Targets section in the project tree-view, then expand the actual target node, and you'll see all the build phases. Expand the Copy Bundle Resources node, and you'll see everything that XCode will try and copy into your App.

So, I deleted the Level folder from the Copy Bundle Resources script, right-clicked on the target, and select Add->New Build Phase->New Run Script Build Phase.

I then renamed the new script to something meaningful, and double-clicked it to begin editing.

Firstly, I set the Shell to /bin/bash, and then entered a script that deletes any existing Levels folder from the built App, and then copies it back in from the game's source folder.

The script is as follows :

#!/bin/bash

echo "forcing refresh of level XMLs...";

if [ -d "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_NAME}.app/levels" ]; then
rm -r ${BUILT_PRODUCTS_DIR}/${EXECUTABLE_NAME}.app/levels;
fi

cp -R -p ${SRCROOT}/levels ${BUILT_PRODUCTS_DIR}/${EXECUTABLE_NAME}.app/levels;

This ensures any old levels are cleaned out (as XCode can also leave old files behind), and that all of the levels copied back in are the latest ones.
Nice and simple! No more having to fully clean and rebuild each time a file is modified.

Another useful feature of writing your own copy script is that you can copy different things depending on your build configuration, or target, eg.

echo build config : ${CONFIGURATION}, target : ${CURRENT_ARCH};

if ( [ "${CURRENT_ARCH}" = "i386" ] && [ "${CONFIGURATION}" = "Debug" ] );
then
...
else
...
fi

This script would do one thing if you were build a Debug App for the Simulator, and another thing for every other build configuration/target.

14Sep/101

Colour blindness and games

Since the release of Phasic Labs' first iPhone /iPad game, Hexius, I have received quite a few emails from players who experience red/green colour blindness, expressing their frustration at being unable to play the game.

I have recently tried to address this problem with the 1.4.0 update, but have to admit it was not an issue that I initially considered when developing Hexius.

I'd like to describe what the issue was, and how it was addressed, and hopefully this will help other developers who may be developing computer games that could cause similar problems.

Hexius is a puzzle game that involves selecting hexagons of the same shape and colour (amongst other things).
There are 5 shapes available, each of which may appear as red, blue, green and yellow.

These colours were initially chosen to be very distinct, to aid gameplay.

Unfortunately for the players who experience protanopia, deuteranopia, or tritanopia (see wikipedia), the symbol colours were very hard to distinguish.

Protanopia and deuteranopia can be generalised as red/green colour blindness, and affect between 7% to 10% of males to a differing degree (colour blindness is much rarer amongst females).
Tritanopia, or blue colour blindness, is much rarer (see here for more info).

For players with protanopia, the green and yellow symbols could look identical, whilst the red symbols could look very similar to the green and yellow symbols, but darker.

In the case of deuteranopia, the red and green symbols could look identical, and the yellow symbols look very similar but slightly brighter.

One player pointed us to the excellent vischeck website, and by uploading Hexius screenshots, the problem soon became apparent, as you can see from the images below.

original screenshot deuteranopia simulation screenshot protanopia simulation screenshot
original screenshot deuteranopia simulation protanopia simulation

These screenshots are simulations of complete red/green colour blindness - I spoke with a partially colour blind friend who said that just reducing the brightness of the green symbols would make Hexius playable for him.

I have addressed this problem in the latest update of hexius by introducing selectable themes, with a theme specifically designed to aid with red/green colour blindness (of any severity).

Unfortunately, I haven't been able to address the much rarer tritanopia so far - sorry if this is a problem for any Hexius players.

new theme - original screenshot deuteranopia simulation screenshot protanopia simulation screenshot
new theme - screenshot deuteranopia simulation protanopia simulation

Hopefully this is of use for any developers reading this - if your game in any way depends on colour as a mechanic (and probably even if not), you should definitely check out your colour choices and make sure that they won't impede any of your players.

From doing a quick search, it certainly appears that Hexius isn't the first game to overlook this problem (for example, Bioshock and Call of Duty : Modern Warfare 2).

One final note - while I was updating Hexius, and adding themes, I also decided to add the now obligatory doodle theme as well :)

Check out the new Hexius themes in the App Store.

Tagged as: 1 Comment
4Aug/102

Hexius – Strategy Mode Tip

Hi all,
I've had quite a few emails from Hexius players asking how to get the insane high scores in Strategy Mode (The current high score posted in OpenFeint is 27771250!).

Well, as you know (you did watch the Hexius tutorial right?), in Strategy Mode, you have 30 moves to get as high a score as possible, and to do this you need to create multiplier bonuses to multiply your scores.

What may not be obvious is that you need to try and create as many multiplier bonuses as possible, without collecting them, and then collect them all in one go!

The multipliers multiply each other, so for example, if you collect 8 multipliers at once, your score is multiplied by 256 (score x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2).

Here is an example - I managed to create a lot of bonuses, and by creating a loop using the yellow diamond shapes, I can collect 8 multipliers at once :

step 1

In this case, I collected enough hexagons to score 7750, but 8 of those hexagons were multipliers, meaning my score was multipled by 256, giving a score of 1984000 for that go! :

step 2

If you can do this multiple times in a game, you can quickly rack up very high scores.

Sounds simple eh? In theory - but it takes a bit of practice...

20Jul/100

Hello

Hi there,

I'm Paul from Phasic Labs, and I've finally got around to settings up the Phasic Labs blog.

Hopefully I'll be adding the occasional thought on game development here, probably about iPhone/iPad to start with, but hopefully about other platforms as we start to branch out.

If you haven't heard of Phasic Labs before, here is a bit of info - I founded Phasic Labs as an independent game development studio in March 2010, and since then we have publish an iPhone/iPad action puzzle game called Hexius (check out screenshots and videos here)

We have another iPhone/iPad game in development, and the proof of concept prototype is nearing completion.

Prior to Phasic Labs, I was a senior programmer at Sony Computer Entertainment Europe (Studio Liverpool), where I contributed to Wipeout HD, MotorStorm 2 : Pacific Rift, and Formula 1 CE 2006, all on PS3.

Before that I worked at Magenta Software here in Liverpool, and worked on quite a few PS2 and PS1 games.

I also had a fun year off writing music about 5 years ago, and managed to get an album published (it did ok, but not enough to make a living from though) - check it out in iTunes here if you like electronica.