Wednesday, 10 September 2014

iPhone 6 event keynote viewing on doesn't work this morning?

Was trying to view the iPhone 6 event keynote from this morning around 6:30am Sydney time using Safari on my iPhone 5 through Wifi. But it crashes every time I tried, after the 3rd crash I just gave up. In the end, have to visit to have a look at the "cut-down" versions of much shorter videos - at least theirs won't crash!

Have seen quite a few reports about problem with Apple's iPhone 6 event live stream. Not sure if what I experienced is also similar issue but it's certainly very, very, very disappointing.

Just tried again around 11pm Sydney time, and now it all works perfectly. Looks like Apple certainly still have some technical issues to be resolved for handling huge traffic volume during major events like this...

iPhone 5 replaced

Went to Apple store last Friday and got my iPhone 5 replaced with a refurbished one which looks brand new.

Although there were reports about some iPhone 5 not been fixed/replaced by Apple, mine was replaced without problem. I guess it might be because (1) mine was also eligible for the sleep/wake button replacement, (2) I experienced an instant battery drop from about 80% to 0 around 2 weeks ago.

The service was quite good and only took about 30min, much shorter than expected. I was really worried about the data, and did 2 backups before visiting Apple store.

Surprisingly everything back to normal quite smoothly after data restored from iTune. Only issue I had was as below. Because  iTune tried to restore all the games/apps I purchased before, there were 195 apps to be installed and iTunes shows it's "Over Capacity by 147.6 MB"!! I have to manually delete quite a few old games/apps during the restore.

Wednesday, 27 August 2014

How to create a "cross" (or "plus") shape spinning object with Sprite Kit Physics?

Was following the example in this Free PoBo site, but want to create a "cross" (or "plus") shape instead of just a seesaw.

Uploaded a small test project here, basically it creates a scene as shown below, some seesaws with one of them replaced by the cross thing I tried to put it.

When you tapped on anywhere on the screen, you will either create a small ball or square box which will drop down from where you tapped. When the object hits the seesaw it spins as expected.

Problem is, the cross object doesn't always spin as expected - only when the object hits the middle green circle of the cross shape object, then it will start spinning. Otherwise the object just drop through the blue area as if it doesn't exist. Wonder what have I done wrong??!!

This is how the cross been added in the code:

        float wWidth = 100.0f;
        float wHeight = 10.0f;
        [self addCross:CGPointMake(self.frame.size.width*0.75f, self.frame.size.height*0.60f)


-(CGMutablePathRef)getCGMutablePathRef:(float)ww thickness:(float)tt {
    CGMutablePathRef boundingPath = CGPathCreateMutable();
    float halfTT = tt*0.5;
    CGPathMoveToPoint(boundingPath, NULL, halfTT, halfTT);
    CGPathAddLineToPoint(boundingPath, NULL, halfTT+ww, halfTT);
    CGPathAddLineToPoint(boundingPath, NULL, halfTT+ww, -halfTT);
    CGPathAddLineToPoint(boundingPath, NULL, halfTT, -halfTT);
    CGPathAddLineToPoint(boundingPath, NULL, halfTT, -halfTT-ww);
    CGPathAddLineToPoint(boundingPath, NULL, -halfTT, -halfTT-ww);
    CGPathAddLineToPoint(boundingPath, NULL, -halfTT, -halfTT);
    CGPathAddLineToPoint(boundingPath, NULL, -halfTT-ww, -halfTT);
    CGPathAddLineToPoint(boundingPath, NULL, -halfTT-ww, halfTT);
    CGPathAddLineToPoint(boundingPath, NULL, -halfTT, halfTT);
    CGPathAddLineToPoint(boundingPath, NULL, -halfTT, halfTT+ww);
    CGPathAddLineToPoint(boundingPath, NULL, halfTT, halfTT+ww);
    CGPathAddLineToPoint(boundingPath, NULL, halfTT, halfTT);
    return boundingPath;

-(void)addCross:(CGPoint)pos game:(SKScene*)game  whipWidth:(float)whipWidth whipHeight:(float)whipHeight {
    SKSpriteNode * anchor = [SKSpriteNode spriteNodeWithColor:[UIColor clearColor] size:CGSizeMake(1, 1)];
    anchor.position = pos; = [NSString stringWithFormat:@"whip_anchor-%d",idNumber];
    anchor.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:1];
    anchor.physicsBody.affectedByGravity = false;
    anchor.physicsBody.dynamic = false;
    [game addChild:anchor];
    CGMutablePathRef boundingPath = [self getCGMutablePathRef:whipWidth thickness:whipHeight];
    CGMutablePathRef boundingPath2 = [self getCGMutablePathRef:whipWidth thickness:whipHeight];
    SKShapeNode* polygon = [[SKShapeNode alloc]init];
    polygon.path = CGPathCreateMutableCopy(boundingPath2);
    polygon.physicsBody = [SKPhysicsBody bodyWithPolygonFromPath:boundingPath];
    CGPathRelease(boundingPath2); = @"polygon";
    polygon.lineWidth = 0.01;
    polygon.fillColor = [SKColor blueColor];
    polygon.lineWidth = 0;

    polygon.physicsBody.affectedByGravity = NO;
    [anchor addChild:polygon];
    SKSpriteNode * gear = [SKSpriteNode spriteNodeWithImageNamed:@"ball"];
    gear.size = CGSizeMake(whipHeight+5, whipHeight+5); = [NSString stringWithFormat:@"gear-%d",idNumber];
    [anchor addChild:gear];
    SKPhysicsJointPin* jointPin = [SKPhysicsJointPin jointWithBodyA:anchor.physicsBody
    [game.physicsWorld addJoint:jointPin];


[2014-08-29 Update]
Posted the question on

[2014-09-03 Update]
Was trying different ways of creating the polygon - clock-wise, anti-clock-wise, …etc. Sometimes only the left hand side of the cross works and sometimes the right hand side, sometimes keep getting this "Assertion failed: (area > 1.19209290e-7F), function ComputeCentroid, file /SourceCache/PhysicsKit/PhysicsKit-6.5.4/PhysicsKit/Box2D/Collision/Shapes/b2PolygonShape.cpp, line 122." error similar to this link due to polygon not convex,  quite frustrating.

Finally got it working today by joining the second rectangle to the first one using fixed joint. The code as below:

-(void)addCross2:(CGPoint)pos game:(SKScene*)game whipWidth:(float)whipWidth whipHeight:(float)whipHeight {
    SKSpriteNode * anchor = [SKSpriteNode spriteNodeWithColor:[UIColor clearColor] size:CGSizeMake(1, 1)];
    anchor.position = pos; = [NSString stringWithFormat:@"whip_anchor-%d",idNumber];
    anchor.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:1];
    anchor.physicsBody.affectedByGravity = false;
    anchor.physicsBody.dynamic = false;
    [game addChild:anchor];
    SKSpriteNode * whip = [SKSpriteNode spriteNodeWithImageNamed:@"box"]; = [NSString stringWithFormat:@"whip-%d",idNumber];
    whip.size = CGSizeMake(whipWidth, whipHeight);
    whip.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:CGSizeMake(whipWidth, whipHeight)];
    whip.physicsBody.mass = objMass*0.5f;
    whip.physicsBody.friction = 0;
    whip.physicsBody.linearDamping = 0;
    [anchor addChild:whip];
    SKSpriteNode * gear = [SKSpriteNode spriteNodeWithImageNamed:@"ball"];
    gear.size = CGSizeMake(whipHeight+5, whipHeight+5); = [NSString stringWithFormat:@"gear-%d",idNumber];
    [anchor addChild:gear];
    // extra whip
    SKSpriteNode * whip2 = [SKSpriteNode spriteNodeWithImageNamed:@"box"]; = [NSString stringWithFormat:@"whip-%d-2",idNumber];
    whip2.size = CGSizeMake(whipHeight, whipWidth);
    whip2.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:CGSizeMake(whipHeight, whipWidth)];
    whip2.physicsBody.mass = objMass*0.5f;
    whip2.physicsBody.friction = 0;
    whip2.physicsBody.linearDamping = 0;
    [whip addChild:whip2];
    // join with whip 1 using fixed joint
    SKPhysicsJointFixed* jointPin2 = [SKPhysicsJointFixed  jointWithBodyA:whip.physicsBody
    [game.physicsWorld addJoint:jointPin2];
    SKPhysicsJointPin* jointPin = [SKPhysicsJointPin jointWithBodyA:anchor.physicsBody
    [game.physicsWorld addJoint:jointPin];



Monday, 25 August 2014

iPhone 5 Battery Replacement Program

Have you checked the serial number of your iPhone 5 on Apple's iPhone 5 Battery Replacement Program page?

As shown below, mine is one of the unlucky ones... No wonder some time last week it suddenly dropped from about 80% to 0 and I thought it was dead! Have to wait for a long time for it to be charged.

This is not the first time my phone has issue, remember the previous sleep/awake button replacement program? Mine was in there too....

[Update 10/Sep/2014]
My iPhone 5 was replaced, see this post for details.

Sunday, 24 August 2014

Background color change effect similar to "Spikes"(Don't touch the spikes) game

If you ever played the popular "Spikes"(Don't touch the spikes) game, you will notice that every 5 levels, the background color changed. You can have a look using this YouTube video:

Since background color is controlled by 3 RGB value, I use info from this stackover page to create a "number to binary string converter". Then based on the returned result, add together required value for each R, G, B colour depending on the "0" and "1" of every group of 3 digits.

I have created a test project to simulate the effect at this github repository.

Tuesday, 19 August 2014

Open Source Piano Tiles game published!

After last week's small incident, we finally have our "Open Source Piano Tiles" game published in the App Store!

The game was written in Sprite Kit, and the source is published both as a marketing tool to promote my other games, plus help anyone who might be interesting in learning Sprite Kit or writing his/her own Piano Tiles game.

High level structure is as below and shouldn't be too hard to understand.

(1) What's the difference between the published game and source available for download?
The only difference is the launch image been replaced by simple image as below.

(2) I can't find the link to download the code?
After you clicked on the link (shown far, far below...), as shown highlighted in red below, click on the icon with downward pointing arrow in the upper middle of the screen to download the file.

(3) Under what license was the code released with?
The only condition for downloading the source will be to download all my games as below and play everyone of them for a few times, simple as that! Optionally, please leave a positive comment for me!

(4) I found a bug, what next?
Well done, thanks for that! Please post it as comment below or email me, and I will try to fix it in the next release.

(5) I don't understand why you do xxx this way....
Please post any question or suggestion or further improvements ideas below and I will try to explain it here if possible.

(6) Cut the crap, where is the link?
Alright, assuming you did follow my conditions above and downloaded all my other games, here it is , enjoy!

[Update 24/08/2014]
For those who prefer github, it's also available here

Thursday, 14 August 2014

Open Source game rejected by Apple because of the word "Demo" mentioned in the description

OMG! My Open Source game was rejected by Apple!

Checked the "Resolution Center" and as shown below, it's because of this rule '2.9 Apps that are "beta", "demo", "trial", or "test" versions will be rejected' ... Never heard of that??!!

I guess lots of people are like me who never carefully study and remember each and every rule and policy and whatever clauses and conditions for App submission...

Ok, I reviewed what I entered and have to admit that I did mention the word "Demo" in the description:

"Demo game with full source code in objective-c available on blog URL specified within the game."

But, but, but it's a fully functioning game!.... Well, don't think the chance of arguing and winning would be that high. So I changed the word "Demo" to "Simple" and resubmitted the game, another long week of waiting, damn!

Hope you find this information helpful and none of you ever made the same mistake like me!

[Updated 02-Sep-2014]

See this "Common App Rejections" page published by Apple.

Friday, 1 August 2014

New Open Source Game

We will be releasing a new open source game in the coming weeks, more details coming soon...

Saturday, 24 May 2014

Problem with Game Centre Leaderboard on iPhone 5 and iPad 2 resolved

After my games released, everything seems fine for a while. Then about 2 weeks ago I noticed although the game still works perfectly, the Leaderboard for 2 of the games always say "No Items" as shown below on my iPhone 5, which is a bit strange. But on iPhone 5s and iPad 2, the Leaderboard shows up perfectly.

But if I go to Game Centre, I can still browse through the game list and see the Leaderboard data, and the other 2 games were working ok, so I wasn't too worry about that.

However sometime last week, it changed. As shown below, although it says 67 games at the beginning, after tapped on the "Games" icon at the bottom, it shows "No Leaderboard or Achievements". What the...

A few days ago, it gets worse. As below, it's showing "Not Available" and wouldn't show anything. Note that the phone doesn't have SIM card (hence the "SOS only" message) but it's always connected to WiFi, so definitely no network connectivity issue.

And even other games installed on the same iPhone 5 also showing "No Items" for Leaderboard.

Start searching on the net and found a few others also experiencing similar issue, and got their problem resolved by reset the phone settings.

At the same time, my iPad 2 also have a funny issue with the Game Centre - no matter how I try, it also shows as "sandbox" in Game Centre.

As the iPad 2 is not as important as the iPhone 5, I use it as guinea pig and tried the "Reset All Settings" fix - it works! Other than losing the WiFi password and backend images, no other data were lost - which is one of my concern. Forgot to capture screen shot on the iPad 2 but I did capture the iPhone 5 one, as below, just select the first "Reset All Settings" and wait for it to restart.

After that, all the game Leaderboard/Achievements returned in the Game Centre!

And the Leaderboards for all 4 games all worked now!

Thursday, 15 May 2014

Comparing Nuance with OpenEars

I mentioned I was testing OpenEars in this post, and I also tried Nuance in past few days.

While using both in a quiet room, the response of Nuance seems to be more accurate and the text to speech sound quality is better and more natural. Although it has slight delay as it has to travel back to the server while OpenEars works offline.

Then tried at a noisy train station on 2 separate occassions and the difference is huge! With OpenEars it's almost impossible for it to pick up anything correctly even though I tried to speak as loud as possible - without shouting too loudly as don't want to get too much attention. However, with Nuance, I just need to raise my voice a little and it correctly picked up whatever I said, which is really impressive.

Yes, there are other add-ons available for OpenEars which I haven't tried yet, but even the lowest level of "silver" service level provides lots of things that OpenEars is far, far behind.

There's a small catch with Nuance though, as it's not completely free. For the lowest silver level pricing, it says:

In the production stage, silver service members receive up to 1 million free speech transactions per month per application, after which the cost per transaction is $0.008.

Need to do some calculation - 1 million free speech transactions per month, which is about 33,333 per day. How popular your app has to be to get that kind of volume everyday? After that for $0.008 each, even if your app can get double the amount of transactions and get 2 million transactions per month - about 66,666 per day, with first 33,333 free you will be paying about $267 per day...... Well, I guess if you have an app that's so popular and can generate that much traffic per day, this might not sound a lot, or is it?

Tuesday, 13 May 2014

Ideas learned from line drawing game "Blek"

I remember back in 2011, I created this post talking about not that easy to make a line drawing game. Now, if you look at this tutorial from Ray Wenderlich, you basically got everything covered! How I wish there was something like this a few years back!

One of the main thing for this post, was this beautiful game Blek, in case you haven't heard about it, have a look at this video:

I quite like it, and was wondering if there's tones of flappy bird clones on the market, how come there's no one copying this much better, nicer game? Well, I did found one short video on YouTube talking about Blek Clone on Android, looks like it's in German but the quality was really awful and I was really disappointed (Note: strangely, can't find the video from blogger when tried to embed it to the post??!! please use the link above)

Using the skills learned from the Line Drawing tutorial, I created a small proof of concept demo project. Not finished yet as there's nothing to collide with, and when it hits the border it just stuck there... still got some more work to do, but this kind of "interface" is definitely something worth exploring. The question then, is what sort of game would it be suitable for? No, I am not going to make a Blek Clone, just looking for ideas with this kind of interesting line drawing method.... You draw something, and it will keep repeating again, again and again... Any suggestions any one?

Tuesday, 6 May 2014

Semantic Issue - Use of undeclared identifier 'AcousticModel' error in OpenEars "Using LanguageModelGenerator" tutorial

Was playing with OpenEars for the first time, downloaded the framework, and followed the tutorial to setup the framework but as shown below it failed in the first "Using LanguageModelGenerator" tutorial straight away....what the..... The error is "Semantic issue - Use of undeclared identifier 'AcousticModel' "

Searched the net but couldn't find much info. Later worked out the fix by looking at other tutorials, simply add this line at the beginning and that fixed the problem.

#import <OpenEars/AcousticModel.h>

Monday, 5 May 2014

App Store "Invalid binary" error due to "Improper Advertising Identifier [IDFA] Usage"

Finally, very excitingly submitted my 4 new games to App Store. Surprisingly the status all changed to "Invalid binary" and received an email saying "Improper Advertising Identifier [IDFA] Usage".

Ok, I have to admit I got no idea what the hell is that, so I just answered "NO". Obviously Apple doesn't like that answer....

Did some research on the net and temporarily removed "AdSupport" framework as instructed. Found that it's Google AdMob that's the culprit.

Checked Flurry and AdMob but both doesn't have any updated SDK recently. So I just changed the status in iTunes Connect to ready for binary upload again, this time it automatically selected "YES" for the IDFA question. Ticked the 2 boxes which I think should be relevant and then it works!

Then as shown below, the status is now "Waiting for Review" for all 4 of them. Let's wait and see how long it's going to take this time.

Tuesday, 29 April 2014

iPhone 5 Sleep/Wake Button Replacement Program

Any one heard of Apple's iPhone 5 Sleep/Wake Button Replacement Program ?

Unfortunately, after entered my serial number, as shown below, found that I am one of the unlucky ones.

But after read through the info on the web site, don't think I can survive without my phone for 4-6 days just to get the rarely-used button replaced, NO-WAY!

[Update 10/Sep/2014]
My iPhone 5 was replaced, see this post for details.