Top
Navigation
I'm talking about
Last bookmarks...
mercredi
27mai2009

Multi-threading final toughts & Loading screen

Well.. So I implemented the operation queue and it's indeed very easy to use BUT.. actually not useful for me.

My goal was to parallelize the pre-loading of textures while keeping the cocos2D rendering loop active so the UI wont seems "frozen".

However, in my particular case, I was creating textures while the main thread was living his own life.

So when I would add a texture, the cocos2D OpenGL loop might not be in the correct state and the app might crash "randomly".

I tried another solution with loading "steps": load some files, wait, load some other files... But the loading screen would lock up, animate, lock up, animate etc.. Not satisfying.

What I need was another rendering thread.. So I ended up by mixing UIKit (wich has his own rendering thread) and Cocos, just for the loading screen: my loading scene has now an UIActivityIndicatorView until the loading has completed. It looks very nice and polished, but take a look yourself :)

dimanche
24mai2009

Must get friendly with multi-threading...

Just a quick post to share my next objective regarding the (perceived) performance of my game: implementing multi-threading to avoid blocking the UI at all.

Well, it seems there are multiples ways to do it (from the doc):

  • Thread
  • OperationQueue
  • RunLoop

Apple say that "OperationQueue" is brand new and very simple so I'll try to use that. It basically works by encapsulating small tasks for me, and threading them, optimizing the concurrency and all by beeing "very close to the kernel". And I like thoses kind of stuff :)

In the next post, we'll see if it'll live up to the hype from the doc and if the performances are improved.

lundi
18mai2009

Do not re-invent the wheel, check out three20

Hi dear readers (yeah, all 3 of you),

If you have started a project on the iphone, you certainly wanted to implement some kind of remote async loading mecanism for images (does it ring a bell).. and some other features that are quite commons in many apps, I bet.

Before you spent hours (I have), check out Joe Hewitt ("the" man behind Firebug, the Facebook app and more...) latest project: three20. He basically open sourced a lot of what he had to do for the iphone Facebook app. I just checked it out and it's great: three20 homepage on github

I will definitely use the StyledLabel (finally! an easy way to stylize text) and I'll then go deeper to see if I can use some more and/or replace some of my code by his.