2009/09/07

First optimization (+video)

Hello kids,
I’m going to tell you more about some programming things I’ve done in my game and how it affected the results. And I got fresh new video for you. Again with nice music by “Eva a Vašek”. I can guess that younger people don’t like it, but I love it. I wanted to add some Hungarian polka, which I also like, but I got it only on LP records (you know these black big discs :) ) and was unable to digitalize it.



What you can see is very first look at gameplay itself. One finger for moving, two fingers for rotations. When 3 colors match together, little square inside the brick appears – whole brick should disappear after that, but It doesn’t. Yet! :)

What you can’t see are many hours of experiments and failures with optimizing the code to run as fast and smooth as possible. First of all I found out, that when I switch off “Compile for Thumb” in XCode settings, the application runs much faster. But that was just beginning. Next thing I’ve learned was, that Chipmunk should be compiled in GCC compiler with parameter “--fast-math“. But that helped just a little.

Then I was kind of stuck at one point. My physics operations took so much time and I was unable to improve it. I tried to change size of spacial hash, that’s what documentation says and should help -> doesn’t. Then I changed squares for circles as the basic physical object -> again no improvement. After that I’ve developed idea that I’m going to do the physics operations not on all objects in the scene, but only on upper ones, because the bottom lines don’t need that. They are fixed at one place. Of course that was wrong idea and leads to even worse results.

But in the end I’ve discovered it! I’ve lowered the number of iterations of physical solver. That means that all calculations are less precise. So you should say that is a bad thing. But it’s not! Firstly it lowers the time for physical processes significantly and that’s what I really wanted. And secondly, because of less precise calculation results, objects in the scene acts more elastically. And that’s wonderful.

At this point my physics engine takes same time as graphics processes and I’ve got some pretty good ideas how to improve them too. But you need to wait for some future post about that.

Bye kids,
Granny Marie

2 komentáře:

  1. Okay... if those are hands are yours, I'm a 120 years old granny.

    But I have to say that it's a clever marketing idea. Good luck Kladno guys!

    OdpovědětVymazat
  2. I am quite sad that people are more interested in fact, that I am granny and why it can't be possible, instead of the game and developement process itself.

    And just for you my dear> my grandsons are making these videos, because I don't have camera. Next time read the blog more carefully :)

    OdpovědětVymazat