Join! Login   Search
RaMtiGA - Raising a Middleworld to its Golden Age
RaMtiGA - Raising a Middleworld to its Golden Age: Blog
Jan 27

Written by: Jashan Chittesh
2011-01-27T20:43:14 

I already started optimizing the levels in previous releases but V1.1.2 has a main focus on optimizations, so now I'm really doing the best I can (at this moment, this will change as I'm learning). While Level 01 - The Square was really trivial to optimize, and Level 03 - The Cube was pretty easy, Level 02 - Plus Ceiling had a somewhat more complex geometry and took me a little while. At the same time, however, this particular level was particularly embarrassing. Let's have a look at the stats:

I started out with 11354 verts, 32915 edges, 21611 polygons and ... OMG ... 72 mesh items. With apples and powerups, this resulted in up to 925 draw calls, 163k tris and 218k verts when playing in Unity. When you know the comparatively simple geometry that Traces of Illumination has, this should be rather surprising. When you also know that when I created this level, I just started out modeling again with Cheetah 3D and would rather do boolean geometry than proper hard surface modeling.
New Version of Level 02 - The Square, Quality Setting: Fantastic

So let's turn that page on history - here's the new Level 02 - Plus Ceiling: 1349 verts, 2490 edges, 1299 polygons and a mere 7 mesh items. I'm not perfectly sure if putting this much geometry (in terms of "spatial room used") into this few objects as Unity is pretty good at dynamic batching (and this could even be done with static batching) but for now it also simplified my process. Most of this "mass" belongs to two of those mesh items: Tubes and Balls ;-) ... and that's 1092 verts, 2116 edges and 1024 polys. Well, round stuff just doesn't optimize that well ;-)

But there's one really nice change on that end, too: I also have a lo-poly version of this, which only has 32 verts, 44 edges and 20 polys. It's simple boxes and it doesn't look that bad.

Level 02 - Hi Poly
Level 02 - Lo Poly

So, I had some decent improvements in the area of the level geometry but as you can see from the first screenshot, when looking at the stats, we still had around 650 draw calls. This may work fine on a Mac Pro - but even on a MacBook Pro this won't be fun to play. And on an iPhone or iPad: Forget it!!!

So, I started tweaking the objects in the levels, namely power ups and apples - of which their are plenty in each level. I've also added logic to switch this automatically depending on Unity's quality settings. There's fantastic, beautiful, good, simple, fast and faster. The first screenshot was taken with fantastic and in that setting, nothing much has changed except for the color of the power ups:

Apples and Power Ups, Quality Setting: Fantastic

When we're moving to beautiful, the only change we have is still a pretty significant change: The lights are switched off. Even having lights in there can probably be considered a pretty crazy idea but ... well, on high-end machines I do get away with it, so why not? ;-)

Apples and Power Ups, Quality Setting: Beautiful

So, as you can see in the following screenshot, the difference between fantastic and beautiful is not that significant ... except that the number of draw calls is just about half as much in the latter than in the former, and the framerate goes up from around 50 FPS to around 70 FPS (this is on a Mac Pro - and look how small that screen is .. but on the other hand: it's the complete level, in the actual game, you usually only see part of it):

New Version of Level 02 - The Square, Quality Setting: Beautiful (Less Lights ;-) )

Around 350 draw calls is still quite a bit, the framerate is still kind of low ... and we still have 58.2k tris and 114.5k verts. So ... maybe having a particle system for each and every pickup item wasn't the wisest decision ever. It looks pretty nice (IMHO, at least) but it'll just make the game unplayable on most machines. So, let's go for something more radical - replace those particle system with simply geometry. We're going to quality setting good now, and a screenshot is not really that great to show this because those little spheres actually rotate (I might update this blog entry later with something that moves ;-) ):

Apples and Power Ups, Quality Setting: Good

And with this, the framerate goes up quite a bit. Well, no surprise - we have much less draw calls, and much less geometry: Only 27.6k tris and 26.1k verts. Getting closer to the iPhone / iPad. Well, not really - 111 draw calls is still way off for those devices. But hey - we started with almost 650, so there still is hope:

New Version of Level 02 - The Square, Quality Setting: Good (Simplified Pickup Items)

200 FPS is pretty nice and we won't get much further here - but 111 draw calls, while being a pretty cool number isn't that great. And neither is 26k tris. The next level of optimization is another simplification, and here we get to simple - as shown above, this replaces the round geometry of the orange tubes with a "square geometry" (pun intended). The pickup items remain the same, but still we get to much better values: 55 draw calls, 12.5k tris, 10k verts. Getting closer.

New Version of Level 02 - The Square, Quality Setting: Simple (Simplified Geometry)

Ok ... so now, for the final step. I have no specific changes for fast, so we move on to faster right away. As you may guess, I like cubes. They are simple and easy to handle. Once more, a static images doesn't really do this justice because these cubes rotate like crazy. It's a bit like that old Commodore C64 music trick: You know, back then, we arpeggiated chords because we only had 3 channels to play with (3 "voices"). They were arpeggiated so quickly that it sounded remotely like an actual chord. No, not really - but it gave the C64-music a really distinct style. So bear with me until I get the animated version up here, for now, we can be happy that we've simplified the geometry pretty much to the limit:

Apples and Power Ups, Quality Setting: Fastest

So let's see where we are with the complete level:

New Version of Level 02 - The Square, Quality Setting: Fastest (Just ... squares ;-) )

That's it for now ... 41 draw calls is still too much for the iPhone / iPad (and Android, of course ... or ... well ... we'll see ;-) ). But with 2.8k tris for the complete level and 4.7k verts I think this should be worth a try.

Another thing worth noting (which you can't really see from the screenshots) is that I'm not using any mesh colliders anymore. Instead, all collision is now handled via box colliders that are adjusted to the level geometry. This also should make Traces of Illumination run much smoother on lower end machines, it'll also be very beneficial on the game servers ... and last but not least mesh colliders are a complete no-no on mobile devices, so this now finally is also out of the way.

I did some play-testing on my MacBook Pro - with just battery power (which does make a huge difference ;-) ), and on the lower quality settings, I can now play in fullscreen (1920x1200) and it's pretty smooth.

The next step from here is optimizing the Tracer geometries. Just like with the levels, when I designed and modeled the cycles and hovercrafts I didn't really pay much attention on polycount or the like. And neither did I pay much attention on draw calls. So this will now change ... stay tuned for more updated. V1.1.2 is getting closer.

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
CAPTCHA image
Enter the code shown above in the box below
Add Comment   Cancel 
 
Copyright 2007-2010 by Jashan Chittesh   Terms Of Use   Privacy Statement