Posts Tagged 'Programming'

Game Engine Listings

In case you missed it, the good folk over at ManiacDev have updated their game engine listings:

iPhone Game Engine Comparison – Open Source

The Commercial iPhone Game Engine Comparison (3D and 2D)

Seems pretty comprehensive as of today, but if you’re reading this a little later you might want to see what’s happened since over at Pixelwave, particularly if you’re looking at Flash porting; and the Esenthel engine appears missing too.

And as if you’re researching game engine choices you probably have some cross-platform deployment in mind, there’s yet another ManiacDev list for that;

6 Cross Platform iOS And Android Solutions That You Can Use Right Now

and you might want to also consider cocos2d, if any of the various porting initiatives we listed a few days ago come to some deployable fruition.

Any other game engines/cross-platform development options that we should be collecting here, Dear Readers?


Hah! And just a couple days later, look what we have here:

Announcing cocos3d – a 3D extension for cocos2d

I am pleased to announce the public release of cocos3d, a significant extension to cocos2d that adds a full 3D modelling space, including 3D mesh models, perspective projection cameras, materials, and lighting. With cocos3d, you can populate your world with 3D models exported from 3D editors such as Blender, 3ds Max or Cheetah3D, combined with models you create dynamically in your Objective-C code.

Integration with cocos2d is seamless. Rendering of all 3D model objects occurs within a special cocos2d layer, which fits seamlessly into the cocos2d node hierarchy, allowing 2D nodes such as controls, labels, and health bars to be drawn under, over, or beside 3D model objects. With this design, 2D objects, 3D objects, and sound can interact with each other to create a rich, synchronized audio-visual experience…

That’s some serious additions … and still all MIT licensed, no less!

Continue Reading →

Review: Cocos2d for iPhone 0.99 Beginner’s Guide

So as we mentioned in our latest cocos2d links collection, the nice folk at Packt Publishing provided us a review copy of Pablo Ruiz‘s book Cocos2d for iPhone 0.99 Beginner’s Guide,

Cocos2D For iPhone Beginner's Guide.jpg

and we’ve gone through it now for you, Dear Readers!


If you’ve completed a cocos2d game … no, this is not a reference; you’ll probably find some tidbits of value, but I wouldn’t make it a high priority purchase. You probably guessed that from the ‘Beginner’s Guide’ name.

However, if you are a complete beginner to game programming … no, the name notwithstanding, what this does cover will be over your head, and it doesn’t cover things not related to cocos2d directly a beginner needs introduction to. We heartily recommend the iPhone Game Kit for you.

If you’re a programmer new to the iPhone platform … you’ll struggle with the Objective-C, no doubt. Come back after you’ve done a program or two, got the Cocoa memory model down, and so forth.

So if none of those apply, presumably you know something about programming iOS already at the UIKit level and now you want to get into programming games, and you need a walkthrough of cocos2d design principles and the associated development toolchain? Excellent, you’re the person this is actually appropriate for — as long as you’re fully aware that much of the book has already been overtaken by recent developments.


First off, take a look at the chapter list in this cocos2d forum announcement. Topic selection is good, progression is straightforward. No complaints about the overall structure then, this is indeed a well designed introduction to cocos2d.

However …

One big problem with doing a book like this is that you will inevitably be overtaken by events. Let us take this exchange from the cocos2d forums:

cell-gfx: Reading through the timer example in the book on page 28, you use the schedule:@selector method of scheduling an update to your node. However, when I refer to the cocos wiki, it says to use scheduleUpdate…

pabloruiz55: Yes it would, but as the chapter was written a while back the scheduleUpdate method didn’t exist :)

scheduleUpdate was added in 0.99.3. The version of cocos2d distributed with the sample code as of right now is 0.99.1. The current version of cocos2d is 0.99.5. The changes are substantial enough that people are encountering some difficulty applying the book’s code with the current release. So it’s pretty difficult to recommend something wholeheartedly when you know people are going to struggle with it through no fault of their own; at the very least, if you publish a book like this you should at least keep the samples up to date with the current release, and a list of updates/errata such as the above, I’m thinking; in a designated blog for book discussions, if nothing else.

Same problem applies to the chapters about tools. It goes over the Zwoptex web version for sprite sheets, not the native version or Texture Packer. The fonts chapter, we were wincing at the Hiero and Angelcode discussion: “Both are very good tools” — no. No, they are not. Granted that Glyph Designer is brand spanking new right now and no doubt was completely unheard of as the book was written, but someone picking up cocos2d today really needs to be informed about that. Again, this is the kind of thing that would be most properly addressed by something like a designated blog, or perhaps errata updates mailed to registered users.

Another example of this problem is that even the design walkthrough, which is generally good, can be significantly in error. We were brought up short on page 47 of the PDF for instance, with

“When you quit your game … the applicationWillTerminate method will be called. This is a good time to save your game’s state…”

Ah … no. Not on iOS 4. (Unless you go to some effort to get that behaviour). That would be a perfectly acceptable oversight in a book released in July last year. In December? Not so much. If lead times are so long that a statement that’s been wrong for six months can’t get corrected for publication, then there really needs to be some mechanism for distributing errata.

Moving on, we were mildly disturbed by the code samples in general. Picking on the Chapter 4 ‘ColouredStones’ example in particular, we load it up to find it’s looking for SDK 3.0. Sort that, we get

“Code Sign error: The identity ‘iPhone Developer: Pablo Ruiz (4LFH26A558)’ doesn’t match any valid certificate/private key pair in the default keychain”

and it’s set at project and target level both. OK, we can sort this out in 15 seconds, but a beginner cannot. Messr. Ruiz overlooking this before uploading, hey we can let that slide. Technical reviewers? Not so much, guys. Especially when we get around to Build and Analyze:

Screen shot 2011-01-29 at 2.21.33 AM.png

Okay, if you’re working for me, and you check in code with any warnings or analyzer results, we will have words. If you check in code with an analyzer error “Incorrect decrement of the reference count of an object that is not owned at this point by the caller”, we will have harsh words. That code which would only compile on the author’s machine and that contains significant errors made it through to the downloads? The reviewers have not done their job acceptably. Yeah, our standards are high. So should yours be.

That said, with a little coaxing we did get all three of the game samples to run, and they are well chosen to give a good overview of the functionality discussed throughout the book; so we’re only mildly disturbed, there is a good bit of value here.

We could nitpick a while more, but you’ve pretty much got our feeling now; the book is well designed for what it is, which would be more accurately named “Walkthrough of cocos2d Development for the iOS Programmer” than a “Beginner’s Guide”, that being somewhat of a misnomer. However, it’s well designed for the state of cocos2d development prior to iOS 4, which makes reading it now mildly problematic. And that goes even more so for the source code, which is not only somewhat outdated but really should have had much better review before letting it loose on the readers. Valuable, yes; exemplary, not by a long shot.

So clean the code, update it to current recommended practices, update the tools chapters, and put a process in place for updates to stay in sync with continuing cocos2d development; yep, we’d give 2nd Edition a nine, nine and a half as an excellent introduction to cocos2d. What we’re reviewing today … yes, we’d recommend it to someone who asked for the best way to start getting up to speed on cocos2d we knew of, but would make a point of telling them to read the caveats above. Six and a half, seven, that’s about the best we can muster up. Still, a fine effort by Messr. Ruiz, and we do hope sales go well enough to merit an update!

Continue Reading →


So here’s another worthwhile initiative around the use of URL schemes for iOS IAC

x-callback-url: iOS interapp communication

The goal of the x-callback-url specification is to provide a standardized means for iOS developers to expose and document the methods they make available to other apps. Using x-callback-url’s source apps can launch other apps passing data and context information, and also provide parameters instructing the target app to return data and control back to the source app after executing an action. Specific supported actions will be dependent on the individual apps…

Hey, if you’re planning to implement a URL schema for some reason, seems no good reason not to support it!

h/t: @joe_carney!

Continue Reading →

Designing To Succeed

Must reading for all you game designers out there, indie or not:

Indie Games: Designing To Succeed

The golden rule of game design is that if the game itself is of exceptional quality, it will succeed despite any shortcomings in its business plan. Games like this are rare, though we all seem to set out to make one. What follows here is not a recipe or guide to exceptional game design. Instead, this essay is meant as a road map to maximize your chances of your game becoming successful, from conception to release. It looks at everything from coding practices to business practices in an attempt to clarify common and critical mistakes, and point indie developers into a profitable direction…

Read it all!

h/t: @markjnet!


And here’s another piece on designing game mechanics, specifically rewards:

… studies have shown that the order in which players (that would be “customers” for most of us) actually value rewards is thus:

Status – ie: Platinum Elite in frequent flyer programs.

Access – ie: Gilt Noir members get access to sale items 15 minutes ahead of everyone else.

Power – ie: After a certain level of achievement, the player gets “power” over other players, like power moderators on Craigslist.

Stuff – ie: Buy ten coffees and get one free.

The best thing about this revelation is that this is the exact OPPOSITE order for which it costs to provide these rewards…

h/t: @rwenderlich!

Continue Reading →

Speech Stuff: OpenEars

Well, this certainly looks like a big jump in functionality over any of the open source speech libraries we were previously aware of:

Welcome to OpenEars!

OpenEars is an open-source iOS library for implementing round-trip English language speech recognition and text-to-speech on the iPhone and iPad, which uses the CMU Pocketsphinx and CMU Flite libraries.

Check out this veritable cornucopia of niftiness:

  • Listen continuously for speech on a background thread, while suspending or resuming speech processing on demand, all while using less than 10% CPU on average on an iPhone 3G (decoding speech and speaking uses more CPU),
  • Use any of 8 voices for speech,
  • Know whether headphones are plugged in and continue voice recognition during speech only when they are plugged in,
  • Dispatch information to any part of your app about the results of speech recognition and speech, or changes in the state of the audio session (such as an incoming phone call or headphones being plugged in),
  • Deliver level metering for both speech input and speech output so you can design visual feedback for both states.
  • Support JSGF grammars,
  • Be easily interacted with via standard and simple Objective-C methods,
  • Have all significant operating options controlled via configuration files,
  • Be installed in a Cocoa-standard fashion using static library projects that, after initial configuration, allow you to target or re-target any SDKs or architectures that are supported by the libraries (verified as going back to SDK 3.1.2 at least) by making changes to your main project only.

That’s a pretty serious helping of awesome there, indeed. And there’s even excellent-looking installation and configuration documentation available – starting with, eponymously enough, Getting Started With OpenEars!

h/t: ManiacDev!

Continue Reading →

Animated Water

Now this is some really serious niftiness in low overhead cool graphics effects — how to animate infinite water with one 300×300 texture:

The Cool Effect that No-one Noticed

… I painted a set of 4×4 ocean tiles that were tileable spatially (from one tile to any other tile), and temporally (through the horizontally adjacent neighbours). This allowed me to create a 3D ocean grid with a random texture tile in each grid cell. Each cell was then animated forwards in time from its starting frame. All tiles were guaranteed to match up with all neighbouring cells due to the arbitrary tiling nature of the texture…

Woah. There’s no way we’d even try to design a texture like that, trolls not being artists in approximately the same sense in which a fish is not a bird. Luckily, we don’t have to, as the good folks who came up with it freely sharing the texture in question:


Check out the link above for a video showing the in-game effect — no, seriously, go check it out, it’s really quite striking — and a visual explanation of how to set up the grid to display it. Cool effect, indeed!


Continue Reading →

cocos2d Linkapalooza

So it’s been a while since we made our last collection post of cocos2d goodies, just a few particularly interesting notes since; so this is a good time for another one of those. Particularly as we’ve just starting reading this new book on cocos2d development,

Cocos2D For iPhone Beginner's Guide.jpg

which the obviously brilliantly discerning folk at Packt have provided a review copy of in return for sharing our thoughts on it with you all, Dear Readers, which we’ll post in a few days no doubt you can read here.

In the meantime, here’s a jumble of links we’ve noted since that last collection:

Ray Wenderlich, of course, has posted more of those brilliant tutorials of his:

How To Drag and Drop Sprites with Cocos2D

How To Create A Mole Whacking Game with Cocos2D: Part 1/2 and Part 2/2

Steffen Itterheim has a starter Xcode project up on github that looks rather more fleshed out than the standard templates.

Miscellaneous interesting-looking tips and samples:

Infinite scrolling background with Cocos2D

Cocos2d Sprite Swipe Angles

Cocos2d Cool Gallery [allows users to scroll between data read from a plist]

Cocos2d Box2d Car

Cocos2D Sliding Menu Grid

AWTextureFilter implemented in cocos2d [blur/shadow effects]

Making it rain in Cocos2d

RPG-like text box with Cocos2D

Reusable Particles and cocos2d

Create a Looping and Scrolling Menu in Cocos2D

iPhone platform game, how to create tiled maps and How the monsters are added in a game

Creating a Slider Control in cocos2d (discussion)

Game Kit Data Send/Receive Demo Project

Another Cocos2D gem: ClippingNode

Cocos2D and Hexagons

Spice up your game with Particle Effects

Page Scrolling CCLayer like UIScrollView

A SpaceManager Game [want to clone Angry Birds?]

Sure to be something for you in there! And to finish up, did you know how many versions of cocos2d are out there?

cocos2d: The Mac/Windows/Linux Python project that started it all

cocos2d-iphone: The project generally referred to simply as ‘cocos2d’ in the iOS world; increasingly inaccurately named as it’s added support for iPad and lately Mac OS X as well

ShinyCocos: Ruby wrapper for iOS

CocosNet: C# port for MonoTouch and potentially other .NET platforms

cocos2d-win: Intended Windows port, appears DOA

cocos2d-android / cocos2d-android-1 (more recently active fork): Java port to Android

cocos2d-javascript: HTML5 port to the Web

cocos2d-x: C++ port to iOS, Android, Win32, uPhone

Certainly be interesting to see development of all these branches shake out!

Continue Reading →


Here’s a handy-looking piece for your table view cell value editing needs:

ELCTextFieldCell – A Useful TableViewCell for Forms

… we have found that many times a form of some type is required. This is common in Registration forms, contact forms, feedback forms, etc. The problem was writing the same basic code over and over to have an elegant fast form experience for the user. To quicken the development time of these elements we created the ELCTextFieldCell class which facilitates the creation and flow of a larger form…

Well, we generally just copy and edit our editable cell class, but that does smack of inelegance yes. These fellows went to the trouble of setting up delegate callbacks from the edited cell, which does enhance the resuable elegance, indeed. Code is on github, check it out!

Continue Reading →

C Macros

Now if there’s something one would think it’s unlikely we would learn something from at this point, it would be an article called

C Macro Tips and Tricks

but noooo, the inimitable Mike Ash actually has some things here we didn’t know after using C macros for decades! Take for instance

… if you take an Objective-C string and follow it with a C string, it still works, and produces an Objective-C string result:

   NSString *helloworld = @”hello, ” “world!”;

You can use this to combine a macro parameter with a constant string within the macro definition:

   #define COM_URL(domain) [NSURL URLWithString: @"http://www." domain ".com"];

   COM_URL(“google”); // gives

   COM_URL(“apple”); // gives

Huh. We did not know that. Kinda handy, indeed.

Or some neat tricks with compound literals to make not only arrays, but dictionaries as well, with concise macros like

NSArray *array = ARRAY(@”one”, @”two”, @”three”);

NSDictionary *d = DICT(@”key”, @”value”, @”key2″, @”value2″);

Nifty stuff. Even if you think you’re a peerless C guru, give it a read!

Continue Reading →

OpenSSL Keys

Have you found yourself linking in OpenSSL libraries to your apps to deal with your key manipulation needs? Why yes, yes we have. Is there an alternative? Why yes, if you’re very clever, it turns out there is:

Using an RSA public key generated by OpenSSL in iOS

Apple have gone to pains to make crypto in iOS (and MacOS in general) secure, building a layer between applications and the low-level stuff, like OpenSSL. The principle is to keep these functions in separate address space thus significantly reducing the surface area available for malicious code to find a weakness. In iOS this separation is enforced and, significantly, the documentation is sparse and terse. Public/private key use without also using certificates is mentioned but only in the context of using keys generated on the device. Posts on the Apple Developer forums indicate that using certificates is suggested because using public/private key pairs is “involved”. It turns out that the reason it’s involved is because of some odd implementation details and the aforementioned lack of documentation or useful examples…

If you really care, the odd implementation details are discussed therein, but what we really want are the useful examples. And why yes, there they are:

… Assuming you have your OpenSSL generated RSA public key in an NSData object, this method will verify that it is in fact a PKCS#1 key and strip the header:

Handy — nay, vital — if you need it!

Continue Reading →
Page 40 of 88 «...1020303839404142...»