WARNING : This content was auto generated from a backup file, links and images may be broken.

Ok been slightly off the ball at the moment and not making as much progress as I would like. Though on the up side I have now sorted out the frame rate problem I was having. I made the decision early on that I would try to avoid the use of OpenGL (unlike so many other game developers) and develop my entire product in the apple framework provided. Hopefully this would let me write less code and produce something functional quickly.

Why the on earth do this your a bloody game developer Come on you can do it better

Well to be honest I saw it as a challenge and an opportunity to learn something new so feet first I jumped into objective-C and the UIKit all was going well until I started adding lots and lots of UIImageView by the time I added all the graphical layers that I need i was up to 3*60 (180) views with the potential of each one changing and animating. Which as an after thought is quite a lot.

Initially I set out to only use the core animation system provided this worked well and permitted me to make a look of quick progress on the initial game and got it into a playable state within a couple days (thanks to my play test team). At this point every thing was just using UIColor’s the animations ran perfectly with no visible performance problems. I moved on to start adding some of the overlay graphics this was when I started (ok some friends said "I don’ see whats the problem is" I play it dream about it and think about the thing constantly) to see a performance drop when the animations were playing back playing slowly skipping completely and basically it bugged the hell out of me.

So I figured it I had to fix it or it would drive me crazy (and so it did) though I did find it interesting that I have all the tiles animating when I bring them on at the start of the game and this does not seem to suffer from the same problem. The main difference was that I moved all the small views in a single animation block rather than constantly creating small animation sets so maybe I could store up a bunch of animations and batch them. Sounds easy unfortunately not so easy with questions like whats a good number of animations to batch together and two how do I do it with out killing the game play. Yea the idea would work for something like an RTS where the player controls can be really out of sync with the game actions but in my little puzzle game it was just going to get frustrating. So back to the drawing board and I decided to run the simple animations myself. This would give full control over the number of things animating on screen and hopefully solve my problem.

Well after all that work I was still having some performance problems (though I now do have a much smother moving game due to the fact I can alter that animation before they finish). Arrrgggghhh is about all I can say.

I have now come to the conclusion that it was a redraw issue every time I was animating a tile I was changing the color of the background. This caused it to redraw the entire tile at the start and the end of each small animation though now that I added images over the top I had not noticed this still going on. So I changed the code so draw was only called when the tile was created I also stopped using UIImageViews as sub views and instead decided to draw the images manually inside the main views render function. Wam Bam thank you mam it now runs smoothly.

So with the code a little bit messier than I’d like I have finally fixed the issues and can sleep at little easier.

Latest Pics:


Level 12 Sam beat that one.



Concept Image.



Ok would I use core animation again hell yea it was real easy to get going I did wrap the API functions into a set of utility animations writing three lines of code rather than rolling my own would be a better solution. Though do be careful with the async nature of the core animation system and remember not to do work in the callback method you have no clue what thread it is running on.

Core Animation Code:
[UIView beginAnimations:_name context:_context];
_view.alpha = 0.0f;
[UIView setAnimationDelegate:_delegate];
[UIView setAnimationDidStopSelector:_selector];
[UIView commitAnimations];


So the core game is now in place I have a few things still to play with. Score bonus time addition and can I get above level 12 (not as yet) but I can tweak these endlessly. So I’m going to try and move myself away from the core game area and work on the time bar the collect bar and the level / score system. I will have something more to show in the next installment of the adventure.

Have a good Xmass you here.

Bert

p.s. The Beer comes in the form of Guinness tonight in Frank Owens. :)

Comments

Comments powered by Disqus