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. :)

KoboldTouch v6.0 Done – v6.1 with improved Tilemap Renderer

On December 8, 2012, in KoboldTouch, by Steffen Itterheim

I completed KoboldTouch v6.0 today. Time to let you know what changed and what will be coming for v6.1.

KoboldTouch v6.0 – Foundation

This version mostly included changes moving from Kobold2D to KoboldTouch. I had already removed superfluous libraries, so KT now only includes Cocos2D with CocosDenshion and the Cocos2D extensions project, the Kobold2D and KoboldTouch source code obviously and Box2D.

But there’s more of course:

Continue reading »

Tagged with:  

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 »

What the FAQ is going to happen with Kobold2D?

On November 23, 2012, in Kobold2D, by Steffen Itterheim

Since I’ve started to offer KoboldTouch developers have been wondering what will happen to Kobold2D? I’ll answer these questions here.

Kobold2D Updates

When cocos2d 2.1 (stable) is released, I’ll update Kobold2D to include this latest cocos2d version. Same with any other cocos2d version that will be released in 2013. I won’t update to beta versions – sometimes they’re riddled with bugs, other times the next beta comes only a week or two later.

I’ll continue to support and update Kobold2D for as long as there’s interest in it but I’ll definitely focus my efforts on KoboldTouch now.

KoboldTouch “Lite”

Sometime in 2013 (probably not before Q2) I’ll release KoboldTouch “Lite” for free, with limited features and support. This Lite version will then take over as the successor of Kobold2D, while Kobold2D will remain available for some time.

KoboldTouch “Lite” will have the MVC framework but not much else. It will not include any additional features such as OS integration, better tilemap rendering, Box2D Objective-C wrappers and what not.

This ought to help developers get accustomed with the MVC framework.

Relaunch of www.kobold2d.com

Sooner or later I’ll relaunch the www.kobold2d.com website as www.koboldtouch.com. I’ll go for a simple look & feel (KISS), it will include the Kobold2D articles and I’m going to write all KoboldTouch documentation publicly.

For one this will make it easier for me to write and publish documentation. It should also help KoboldTouch’s popularity to reveal its documentation to both developers and search engines.

KoboldTouch compatibility with Kobold2D

KoboldTouch is not 100% compatible with Kobold2D, since I’ve already trimmed the less popular libraries from KoboldTouch: Chipmunk, Chipmunk Spacemanager, Cocos3D, ObjectAL, SneakyInput, iSimulate, AdMob. The remaining libraries are: cocos2d-iphone, cocos2d-iphone-extensions, CocosDenshion, Kobold2D, Box2, Lua and a few smaller additions (BitArray, LOG_EXPR, etc).

You should be able to port code that does not use one of these libraries with ease. Though without adapting to the MVC framework you lose a lot of the benefits of using KoboldTouch.

Custom Folders and Source Control

Issues regarding custom folders and source control usage come up frequently. I will alleviate those with KoboldTouch.

The project starter tool will be improved to support creating new projects in a custom folder, with or without copying the offline documentation to the new folder. The project upgrader tool will also work with custom folder locations.

The documentation accounts for most of the disk space usage of a Kobold2D/KoboldTouch project and should therefore not be included when you intend to manage this project with source control. Specifically if it’s an online repository with limited disk space. With the additional libraries stripped and documentation not included, a new KoboldTouch project weighs in at around 15 MB of disk space.

What will remain is that the installer will install to a fixed folder, since you will then be able to create new projects in any custom folder so there’s no real need for a custom folder location during installation.

There are plenty of issues with PackageMaker to overcome to support custom folder locations and I’d rather spend that time on other things. As was always the case, you can of course move the Kobold2D folder anywhere else after the installation completed – it’s just one click & drag operation in Finder.

Your question not answered here?

Let me know by writing a comment.

Tagged with:  

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.

Page 8 of 37« First...678910...2030...Last »