Friday, December 9, 2011

New way to declare private methods

Normally I would put private methods in the header file. But noticed from "Learn Cocos2D 2nd Edition" book a different way been used.The header file is quite simple:#import "cocos2d.h"@interface HelloWorld : CCLayer{}// returns a Scene that contains the HelloWorld as the only child+(id) scene;@endThe private methods are however declared in the .m file as shown below with "(PrivateMethods)" added behind "@interface":#import "HelloWorldScene.h"// private methods are declared in this manner to avoid "may not respond to ..." compiler warnings@interface HelloWorld (PrivateMethods)-(void) onCallFunc;-(void)...

Sunday, December 4, 2011

ARM CPUs of the iOS devices don't support division operations in hardware?

Read in the "Learn Cocos2D 2nd Edition" book Chapter 4 that "since the ARM CPUs of the iOS devices don't support division operations in hardware, multiplications are generally a bit faster." So instead of divide by 2, you should use multiple by 0.5 - this is interesting...

Saturday, December 3, 2011

uDevGames 2011 result published

In case you are not aware, the result of uDevGames 2011 is available here. Although most of the games are for Mac OS X, you should be able to learn something there, as most importantly - there's quite of few of them with both source code and binary available for downlo...

Monday, November 21, 2011

Check list for all future projects

I like to slowly build up some sort of template/check list which I can follow and gradually improve on every future projects to make sure I don't miss anything important and sort of maintain a standard for the quality of work.Things I can think of at the moment listed as below, will keep updating this list:1. Handle device rotation properly2. Test for memory leak3. Handle different devices correctly - including icon, launch image, size of sprite, screen resolution, ...etc4. Save game state/data on different scenario5. with sound/audio6. proper menu/high score 7. help/tutorial 8. [future] Game...

Things learned from "iLabyrinth"

Was reading the code of iLabyrinth game by UD7 Studios and learned quite a few things worth written down even though only looked at a few files:1)The way they handle the loading of different sprite/map files according to different device/resolution:2) The "isDeviceIPad()" is a macro defined as below for detecting if the device is an iPad, very handy.static BOOL isDeviceIPad(){#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200    if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )...

Tuesday, November 15, 2011

Malware detected in iphonedevsdk.com forum by chrome 14.0.835.202

I got a chrome session with iphonedevsdk.com forum left overnight, and this morning when I look at it, Chrome says "Warning: Something is not right here!" and the content talks about malware. The chrome version is 14.0.835.202, wonder if the forum admin guys aware of this, probably some sort of injection atta...

Monday, November 14, 2011

5th Open Source Game (1st in Cocos2D) - Dice in Cup

Finally got 5th Open Source Game (1st in Cocos2D) "Dice in Cup" all done (or in other words - sick of working with it and wants to start another new one :-) ). The source link is at the end of this post.As I mentioned before, I purposely picked this simple game idea to have a chance to get familiar with Cocos2D.A high level flow of the game from code's point of view is as below:1. Game first started, "init" calls "initialiseGameVariables" which set "GameState" to "kGameStateStarted"2. "init" creates...

Strange error in Xcode 3.2.3 "texture_ undeclared"

While still working on the project, I copied the "Dice in Cup" project (with Cocos2D 1.0.1 and named "Cocos2dDiceInCup") from my MacBook Pro (which the project runs perfectly with Xcode 4.2/OS X 10.7.2) to a test VMWare box running Xcode 3.2.3 on OS X 10.6.4, strangely it won't compile at all. As shown below, keep complaining about "texture_ undeclared" error. If I right click on "texture_" and select "Jump to Definition", as below you can clearly see "texture_" is properly defined in CCSprite.h",...

Sunday, November 13, 2011

Almost ready - 5th Open Source Game (1st in Cocos2D) "Dice in Cup"

Sort of "almost" finished my 5th Open Source Game (1st in Cocos2D), still working on code tidying at the moment - hopefully this won't break the code :-)...Although I called it "Dice in Cup" - which is what I first intended to do - it now looks quite different. The "Dice" is now actually the "Seeker" image from Cocos2D, and the "Cup" is actually a ugly green rock image I created in Inkscape in 5 minutes.It's a very simple game and everyone can easily understand it within seconds. Though it's quite slow and simple at the beginning, when you reached level 9 and above, the cups move really fast and...

Saturday, November 12, 2011

Strange behaviour when method in "@selector" missed a parameter

I was reading and trying some of the code from this article (Cocos2D iphone tutorial: Die, Grossini, Die! – Part I) about some basic Cocos2D stuffs. One of the things I have is to create a clickable "Restart" text as below:-(void)stateChange_gameOverDisplay {        CCLOG(@"inside stateChange_gameOverDisplay");        [CCMenuItemFont setFontName:@"Marker Felt"];    [CCMenuItemFont setFontSize:30];    CCMenuItem *play_menu = [CCMenuItemFont itemFromString:@"Restart" target:self selector:@selector(restartGame:)];  ...

Monday, November 7, 2011

Cool! Face Detection in iOS5 works even with Johnny Deep's multiple eyes photo!

Was following this example from ManiacDev.com which as below quickly detects the eyes and mouth in a few seconds time and highlighted all of them.I then quickly tried it with the Johnny Deep's multiple eyes photos and it sort of works too! Except the left side picked up the wrong one, not bad isn't ...

Monday, October 31, 2011

What's the benefit of having 2 names for the same variable?

I was following this tutorial called Cocos2d Sprite Tutorial, and noticed as below, the variables were first declared in the header file with an extra "_" underscore character at the front.    CCSprite *_dragon;    CCAction *_flyAction;    CCAction *_moveAction;But then at the @property declaration, the underscore character was removed.@property (nonatomic, retain) CCSprite *dragon;@property (nonatomic, retain) CCAction *flyAction;@property (nonatomic, retain) CCAction *moveAction;And then in the main ".m" file, both names were used as below with the "="...

Friday, October 28, 2011

Error "Sending 'ccColor4B' (aka 'struct_ccColor4B') to parameter of incompatible type 'CIColor *'"

While trying to compile some old Cocos2D projects, as attached, keep getting this error "Sending 'ccColor4B' (aka 'struct_ccColor4B') to parameter of incompatible type 'CIColor *'" in my Xcode 4.2As below, the Cocos2D is version 0.99.01 according to "cocos2d.h". Looks like have to upgrade the Cocos2D in the project...[UPDATE 16/01/2012]I found the fix!Instead of:+ (id) layerWithColor:(ccColor4B)color{ return [[[self alloc] initWithColor:color] autorelease];}The fix is to change it to as below, with...

Wednesday, October 26, 2011

Error "Illegal Configuration - Pattern colors on iOS versions prior to 3.0"

While looking at some old projects developed with Cocos2D from the net, found that the new Xcode 4.2 throws the following error: "Illegal Configuration - Pattern colors on iOS versions prior to 3.0" and refused to compile.Checked the net and found this page from Mark Tomlinson's site which says "The error is due to incompatibilities with older nib/xib files prior to version 3.0". It also mentioned about the fix is to "change the **Deployment** type in the *Interface Builder Document* settings",...

Monday, October 24, 2011

Problem after upgraded iPad 2 to iOS 5 [fixed]

I have an iPad 2 with wifi only, and I always connect to my iPhone 3GS (iOS 4.3.5) through Bluetooth and then using the "personal hotspot" on iPhone, I can share the Internet connection and do lots of stuffs on the net with the much bigger screen.However, after I upgraded my iPad 2 to iOS 5 yesterday, the Bluetooth connection still works, but it can't get any Internet connection any more!This is really annoying. I guess can also upgrade my iPhone to iOS 5 to see if that would fix the problem, but there's first of all the risk that it still won't work, plus I will then loose a device for testing...

Saturday, October 22, 2011

Top "In App Purchases" shown in App Store

You might already know this, while studying the 101-in-1 Games, I noticed theApp Store shows the top "In App Purchases" ranking too. It sort of provides you a rough idea about:(a) whether the game provides In App Purchase(b) what sort of In App Purchase options the creator provides(c) which product/price range is the most popular one Also have a quick look at another one of my favourite game Tiny Tower and it also shows similar ranking as well, but only 3 been displayed instead of 5.This also proves...

Where to get hundreds of game ideas for free

When you started learning to write games, one of the main problem will be about finding an idea for you new game project.I found this new game 101-in-1 Games which is quite interesting.When I first saw the game, to be honest I was a bit depressed - as if someone already provided a free application that includes 101 games, how much space will be left for us? After tried the game for a while however, I felt a lot better. As each of the included games is only in a very simple form - which means each...

Monday, October 17, 2011

Inspecting Apps (.ipa) files under Microsoft Windows

A friend told me that although the code for iPhone Apps are protected by encryption, other stuffs like music, images, ..etc can still easily accessed from any Microsoft Windows machine. I didn't quite believe it until I check it on a XP machine after synchronised with my iPhone. No I didn't jailbreak or change anything on the phone - all I have to do is look at the "My Documents\My Music\iTunes\iTunes Media\Mobile Applications" folder and open each of the ".ipa" files using WinZIP or WinRAR. Tried...

Thursday, October 13, 2011

Can iOS5 Face Detection API detect this?

Seen quite a few blogs/news articles taking about the new iOS5 Face Detection API "CIFaceFeature" which has properties like "hasLeftEyePosition", "hasRightEyePosition", "hasMouthPosition", ...etc. Would be interested to see how it really works.Also, just wondering, what would be the result if we run it against Johnny Deep's famous "multiple-eyes" image? :-)[UPDATE 2011-11-08] Yes it works! See this post about the result when I use this photo to run the face detection example... Quite co...

Instrument 4.1 (Build 4138) still hung in OS X 10.7.2 Lion - issue fixed in 4.2 (Build 4233)

Software update prompted me to upgrade today, so I upgraded my MacBook Pro to 10.7.2 straight away.Although the new iCloud function looks interesting, the first thing I tried is actually the annoying Instrument 4.1 hung issue. Unfortunately still the same...Wait, isn't iOS5 out now, what about Xcode update? I must have missed something.... Have a quick look at AppStore, and yes! Xcode 4.2 is available!Can't tell you the result yet as I have to download the 1.8GB file first... Will let you know how...

Wednesday, October 12, 2011

4th Open Source Game - Follow Me If You Can

After a few weeks hard work, I am please to announce my 4th Open Source game - "Follow Me If You Can" - released in MIT license.It's a very simple memory game: the computer moves some tiles around and you have to remember all the moves. As when it's your turn you have to repeat it. You get points for every correct move, extra bonus and life if all correct. You loose life for every incorrect move - but the correct move will be shown as hint.Some screen dumps as below:Features:1. My first project...

Sunday, October 9, 2011

Expect to finish 4th Open Source Game this week

My 4th open source game almost ready. This time I added music, first attempt on KVO, start up/ending menu, a simple scrollable "how to play" view, top scores, ...etc. So far, the most complicated open source game I ever created...Expect to release it before end of this week...

Saturday, October 1, 2011

Started learning Cocos2D

Just started learning Cocos2D with the Learning Cocos2D book.Currently halfway through chapter 1 and already found a few issues: (1) "HelloWorldScene.m" should be "HelloWorldLayer.m"(2) The new code to add the space cargo ship image should be "under" the existing Hello World label code inside "init()" so that the previously declared variable "size" won't cause compiler error.The forum for the book is also not as organised as the others I have seen - which organised the questions into different chapters to make it easier for readers to find what they want instead of using search.Any way, so far...

Friday, September 30, 2011

Not that easy to create a "flight control" type game as first thought

I was reading this article by Mike Nachbaur which was quite amazing. From short video below you can see the car running on the track.Demo Video:This reminds me of the Starter Kit - Line Drawing Game and thought I can just extend the idea a bit and create some sort of prototype quickly. As looks like the only difference is: Mike's demo has the race track hard coded. All I have to do is merge it with some "touch" code, right?Wrong! May be it's just I am not up to that level yet, as after a few tests, it's definitely not as easy as I first thought!At first, spent some time studying "bezier curve"...

Thursday, September 29, 2011

Have a look at this "iOS Game Revenue Survey" result

Thanks to Owen Goss for organising this "iOS Game Revenue Survey" and the result is available here, I think everyone should have a look as the result is quite interesti...

Tuesday, September 27, 2011

Is having a constant/similar style important?

While still working on my next project, I started spending some time analysing some of the popular games available at the moment. One of the topic I am looking at, is the constant/similar style of game design.As you might be aware, the games from Nimblebit has always been quite popular. I love the "Tiny Tower", "Textropolis" and "Sky Burger", while my kids are big fans of "Pocket Frogs".However, if you compare between the games from Nimblebit, the style seems to be quite different between most of...

Monday, September 26, 2011

How many lines of code required to play an Audio file?

While looking at codes required to play an audio file, I found huge differences between different books/resources.In the book iOS 4 Programming Cookbook, it talks about:1. Adding " <AVAudioPlayerDelegate> " to the .h file of the ViewController2. Create 2 methods:- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag;- (void) startPlayingAudio;3. in viewDidUnload, you have to do the following:    if (self.audioPlayer != nil) {        if([self.audioPlayer isPlaying] == YES){            [self.audioPlayer...

Saturday, September 24, 2011

Wolfenstein 3D for iPhone Ver 1.0 working on Simulator

Yeah! I finally got "Wolfenstein 3D for iPhone" Ver 1.0 working on iPhone Simulator, and the sound works too, pretty cool!Note: have to disable "GLimp_AppActivate( active );" and "GLimp_Shutdown();" in "opengl_main.c" to allow it to compile and run on Simulator. Read on the net that you only need those files when you are running/compiling it for the actual device.Also read this article by Fabien Sanglard which provides some info about the code. But as I know nothing about Open GL yet, so it's still...

Stop killing open source!!

Noticed this game called "Bubble Explosion" almost identical to ABC123 - sequence in App Store. It was originally selling for $1.99, now reduced to free.Alright, to be fair, this guy did change the background colour from green to blue, the front menu, and when the game starts, the background bubble image wasn't displayed.Other than those mentioned above, everything is identical. Yes, even the font, the bubble image, the labels, the messages, everything... I guess that's where all those copyright/legal...

Page 1 of 66712345Next