воскресенье, 28 сентября 2014 г.

Planet Shooter. Optimizations.

So, I made fixes I mentioned in my last post. Plus I made everything as I could [Inline]. And this gave tremendous performance gain - up to +30%! Now I can handle 800 objects with 60 fps!

The video:

Some interesting things I learned about [Inline] in as3 (in addition to well known, such as mandatory to function be final, static, global):

you can't use super keyword inside method marked as [Inline]. That's logical - compiler just take the method's code and places it instead of function call. So in the new place there's simply no such super.

you can't use optional parameters with method marked as [Inline]. You'll get compiler error if you'll try.

you can't debug a code succesfully inside method marked as [Inline].

For now I can say that I finished the core engine for my game. I heavily optimized it, can explain every line of code, fixed all bugs that I found. It seems that it's stable and fast. I don't have memory leaks - this is how the game session looks in Scout:

As you can see, the only memory allocations I have are done with player runtime and are unavoidable.

So from now on I'm starting to work on graphics! No more ugly cubes and spheres!