Thursday, April 10, 2014

Perf Separates the Men From the Boys

Hey everyone! It has been a little while since my last post, but finally there is a new build for you. I will explain some in this post what I spent all that time doing. Or, if you don't care, you can just check out the build here...


So what was I doing you ask!? I was trying to make sure that the game will run at a whopping 60 fps on any computer. It turns out that by using the normal Unity sprite renderer for every tile on the screen was a bad idea. It was making a call to the graphics card for every tile. This resulted in 100's of calls to the graphics card every frame of the game! I didn't notice this for quite a while because a modern gaming PC can handle this just fine, but when I tried to load the game on my phone it ran at 1 fps or worse.
Something that you might be surprised to hear is that making games in general isn't that hard. The tools are so good that I am confident that most people who wanted to could figure out how to make a game. However, what makes great game developers great is their ability to make the game perform well even on old machines. This requires you to employ lots of design patterns and techniques that professional software developers use. You need to understand concepts such as memory utilization, garbage collection, algorithm complexity and much more.


http://www.darklegacycomics.com/3.html
Dark Legacy Comics: Lag
When you want to do mobile development, this whole performance issue becomes critical. To give an example, on windows phone if you want to run on any device (not just the high end ones) then you can only use 90MB of memory for your game. This is like having to write your game to run on a computer over 10 years old, and as a result, brings a whole new set of challenges to bear. That being said, even after spending some weeks on perf optimizations, this game is still not running smoothly on my phone. Hopefully I am able to figure out how to harness Unity in a way that will work. Nonetheless, for now, I am putting the perf optimizations aside to focus on adding some more content because that is more fun.

In the next build (v0.5) you can expect for the environment to change dramatically. We will be trying out a more pirate based theme which will take place on ships and whatnot. So, look forward to that!