For one week only (until Tuesday, December 18th) CartoonSmart runs an exclusive offer for Learn Cocos2D readers:

You get 50% off on the Angry Ninjas, Wave Attack and Awesome E-Book Starter Kits Bundle!

The bundle also includes several Tutorial Videos plus free bonuses: the Isometric Pixel Art Tutorial for Photoshop, the royalty free Vector Art Collection and the first 120 pages of the interactive Cocos2D iOS Game Programming iBook.

The iOS App Development & Starter Kit Bundle normally sells for $100 but you can get it for $49.95 until Tuesday, December 18th.

This is an affiliate link - if you make a purchase I’ll receive a commission. It’ll help me pay off my new iMac (still working with a 2009 model). :)

Line-Drawing Starter Kit still 50% off

While I’m at it: my Line-Drawing Starterkit’s Xmas Sale (50% off to $49.95) still has some of the 100 coupon codes left!

I keep forgetting that if I don’t keep mentioning it, sales slow down dramatically. It’s called marketing (in my case: not doing enough of it). If you have a product that doesn’t sell as much as you expect - perhaps you need to mention it more? You would be surprised how much of a difference frequent blog posts or tweets can make.

So here you go. This new iMac is rather expensive. :)

Due to technical issues (blank page) I had to split the previous article (now focuses only on memory optimization) in two. This is the second part which (mostly) focuses on reducing the app bundle size.

Loading Assets In Sequence

Here’s the code that I use to load textures or other assets asynchronously (in background, on another thread).

Imagine loadAssetsThenGotoMainMenu being a scheduled method that runs every frame or perhaps less often. The assetLoadCount and loadingAsset variables are declared in the @interface as int and BOOL respectively.

When this method runs the first case statement is executed. To avoid accidentally loading the same image multiple times every time the selector runs, the loadingAsset flag is set to YES. When the texture cache has completed loading this texture, it will call the increaseAssetLoadCount. This then ensures that the next case statement is executed the next time loadAssetsThenGotoMainMenu runs.

The cool thing about this solution is that you can easily add more switch statements to add more textures to load. Because the default case is where the scene changes, and that only happens if there are no more switch cases to process.

Be sure not to skip a number in the switch cases because that will also run the default case.

Decreasing the size of your app

Besides the memory usage advantage, reducing the color bit depth of textures to 16 bit will also significantly reduce their size. But there are other options that will allow you to reduce your app’s size, perhaps significantly.

TexturePacker PNG Optimization

If for some reason you still want to use PNG files instead of the highly recommended .pvr.ccz file format, TexturePacker has a slider named “Png Opt Level” to help reduce the size of PNGs (doesn’t affect loading time though):

As far as I understand it, it tries a given number of optimizations and picks the one that creates the smallest file size. The downside is that the maximum level can take very long for large texture atlases, in some cases 10 to 20 minutes on a Late 2009 27″ iMac. The task is multi-threaded, so it should be a lot faster on quad core systems.

Fortunately there’s really no need to do this unless you’re ready to release the app. Question is, how much can it reduce the size of PNG files?

Continue reading »

I’m currently completing one last contract project. One of the last things I had to deal with was to optimize the game’s memory usage.

In today’s iDevBlogADay article I’ll explain how I was able to cut down memory usage by about 25-30 MB (down to 90-95 MB, ie fixing memory warning related crashes) as well as reducing the size of the app bundle from around 25 MB to below 20 MB (which would have been more awesome if Apple hadn’t already increased the over-the-air download limit from 20 MB to 50 MB some time ago).

I’ll also explain how to animate the loading screen while you’re loading resource files, and I’ll add some best practices and common wisdom too.

What’s using 90% of the memory?

Take a guess.

In almost all cases, it’s textures that consume most of the app’s memory. So textures is where you look to optimize first and foremost if you’re having memory warning troubles.

Avoid loading PNG/JPG Textures one after another

The problem with texture loading in cocos2d is that it happens in two steps: first, a UIImage is created from the image file. Then a CCTexture2D object is created from that UIImage. This means while a texture is being loaded, it will consume twice as much memory for a short time period.

The problem used to be so bad that if you loaded 4 textures one after another in the same method, at the end of the method each texture would still consume twice as much memory as it ought to, probably because of the way autorelease works.

I’m not sure if this is still the case, or whether this only applies to manual reference counting but not ARC. I made it a habit to load textures in sequence, waiting at least one frame before trying to load another. This will allow any texture loading overhead to be released from memory. Besides, as you’ll see later, if you want to load textures and other assets in the background this asset-load-sequencing is something you’ll do anyway.

Continue reading »

Cocos2D Developer Survey Results

On November 16, 2012, in idevblogaday, by Steffen Itterheim

For the past two weeks I’ve been running a Cocos2D Developer Survey. As of today, 236 developers started the survey and 189 finished it completely. That’s 80% despite the many questions they had to answer.

Here are the results with my observations. I started the survey also to see if I was on track with KoboldTouch, and whether certain assumptions hold true. Specifically I had a hunch that cross-platform development is only perceived to have great value or appeal. Let’s see if I was right.

Click on each image for full resolution.

Who are you?

I was very curious how many cocos2d developers consider themselves to be hobbyists and indies compared to professionals, who either work for a mobile developer or are taking on freelance jobs as one.

Almost half of those who answered the survey are hobbyists. Nearly 30% consider themselves indies who make a living making mobile games. This is great!

Continue reading »

Line-Drawing Game Starterkit: 50% OFF Limited Xmas Sale

On November 9, 2012, in Announcements, by Steffen Itterheim

This year’s Line-Drawing Game Starter Kit Xmas sale starts early and runs for two months until January 7th, 2013. You can have it for $49.50 instead of $99 - 50% off!

But there’s a catch: the XMAS2012 coupon code has only 100 uses! Act fast before it’s used up.

Site License! Unlimited Apps!

Royalty Free! No Attribution!

60 day money-back guarantee!

Made with the popular cocos2d-iphone game engine.
Compatible with cocos2d-iphone v1.1 and v2.0, and iOS 6.
Includes ARC enabled versions of the starterkit!

XMAS Sale - 50% off - only $49.50

Enter: XMAS2012 as coupon code.

Coupon code limited to 100 uses. Act now!

Tagged with:  

KoboldTouch vs cocos2d-iphone Architecture Comparison

On November 7, 2012, in KoboldTouch, by Steffen Itterheim

I posted a KoboldTouch vs cocos2d-iphone architecture comparison chart to the KoboldTouch product page.

It’s only a start to better explain how KoboldTouch compares with cocos2d-iphone.

KoboldTouch Mini-Game

I’m now working on a KoboldTouch mini-game to showcase the KoboldTouch workflow and features. It’ll be the basis for the KoboldTouch Introduction Tutorial.

I’ll post a video presentation of the project and key points once it’s done. If you’re interested you can follow KoboldTouch development via PivotalTracker.

The mini-game project is also very important to “eat my own dogfood”. Even just a simple game made several things that didn’t feel right obvious, and presents opportunities for improvement.

I’m happy that the KoboldTouch users requested this simple game tutorial.

Excellent Growth

Speaking of members: leaving aside the initial 2-day launch rush, on average two new members sign up every day.

If KoboldTouch continues to grow at this rate, it will have 100 members before Xmas! That would be a major milestone I did not expect to achieve before February/March!

You can help KoboldTouch by taking 5 minutes of your time to complete the Cocos2D Developer Survey. I’ll post the results in a week and what they mean for KoboldTouch.

It’s hard to find the right words to describe the launch of KoboldTouch. I can’t think of anything else but WOW! right now. :)

I can’t wait to hear what you have to say about KoboldTouch, and then act on your feedback.

For those who were just waiting for the launch:

Sign up on the KoboldTouch product page to get access to KoboldTouch and Essential Cocos2D.

The rest of this post is a summary of what I wrote before on these two-products-in-one. Actually, I think of KoboldTouch & Essential Cocos2D as being much more a service than products. And it’s a full time commitment from myself.

This calls for music! :)

Continue reading »

Tagged with:  

The Development Plan for KoboldTouch

On October 25, 2012, in KoboldTouch, by Steffen Itterheim

I like to take a moment and explain what the development process of KoboldTouch will be, and how you will influence the direction of KoboldTouch. But first, let’s have a look what I have planned for the initial version:

UPDATE: KoboldTouch is now available!

First Goal: KoboldTouch equals Cocos2D

To be completed in November, the main goal is to allow users to use the MVC framework of KoboldTouch with all features of Cocos2D, minus a few exceptions (odd features like CCMotionStreak).

You should be able to write Cocos2D apps with Cocos2D features entirely within the KoboldTouch framework. You’ll experience the KoboldTouch API design goal “feels like Cocoa”.

The first version’s features will be:

  • Controller/Model Framework wrapping Cocos2D views
  • View Controllers for “view” nodes, minus exceptions (see below)
  • Scene Transitions
  • Scheduled updates (Step methods in KT)
  • Touch & Accelerometer input controllers
  • Mouse & Keyboard input controllers
  • Simple Audio Controller
  • Simple Model Classes
  • Archiving & Unarchiving Model Classes
  • Basic “Hello World++” Example Project

This first version will be KoboldTouch v6.0.

Continue reading »

Page 5 of 27« First...34567...1020...Last »