Preface
As a new C2 programmer, I spent some time trying to understand what is under the hood, how events work, and how to use them wisely.
I've put here the infos I found on how to optimize events, especially building a medium-big scale game. I'm not error-proof, and would be happy to correct anything that isn't correct. Don't hesitate to leave feedback !
Intro
Every single example in C2 is beautiful, enjoyable to play, and runs pretty smoothly. On their own, they aren't really a game, but put together, they can make nearly whatever you want.
Though, you can be sure that after adding too may features in your game, FPS start to drop, and soon the game is too slow to play.
This can be of a lot of source (too many ram used by animations, too many costly behavior like sine, ... all explained in this performance tips tutorial) but we are going to focus on one that requires to understand a little more how event works and that can be crucial once your game starts to grow to a certain point.
After writing specification : As said in this blog article by Ashley, optimizing isn't your first priority at all, and there are other key verification to do before going into this.
Before starting
To fully understand this tutorial, I strongly suggest that you spend sometimes on this manual entry and this tutorial.
Final reference will be the most read tutorial, the beginner's Guide.
We now have all we need, let's open the tutorial example "GhostShooter (tutorial version).capx", available in the example folder.
This example runs smoothly, but we'll see how we can make it even more CPU Friendly and open to even more features.