Platform Masters Title
Platform Masters - Will you be the world's next platform master?

Ronnis frame rate test - all visible

Date: Jan 26, 2012
Screenshot #261: With the baseline set, let's get the other baseline, where everything is visible at once. With that setup, even my i7-2600K processor overclocked to 4 GHz cannot keep up at 60 fps. If even that high end processor can't handle it, then I've got a serious problem to address.

Ground decals: all. Buildings: all.
Draw count: 5585. Frame rate: about 53 fps.

Ronnis frame rate test - all decals

Date: Jan 26, 2012
Screenshot #262: With both baselines set, the main experiment can now begin. First, let's bring in just the ground decals, all of the ground decals, and see what effect they have. Compared to the control, I get another 1486 draws per frame, rather high. The culprit stands out in my Excel spreadsheet - the repeat width I've set makes it so that only 256 pixels are drawn at the minimum, of which almost always requires 5 draws. That is way too many. The fix for this is quite simple though and fairly quick - adjust the shape so that the ground decals use a greater repeat width. The repeat width should be set so that the minimum is 512 pixels. With that, I should cut the draw count down by about 40%. Against 1486, 40% is quite significant as that's nearly 600 draws. In fact, about 3/4 of the total draws comes from the clouds.

Ground decals: all. Buildings: none.
Draw count: 2314. Frame rate: about 128 fps.

Ronnis frame rate test - all buildings

Date: Jan 26, 2012
Screenshot #263: However, before I rush to conclusions, let's remove the ground decals and have just the buildings drawn, all of them (out to 128). Here, the draw count gets so high that even the Core 2 Duo E8500 can't get 60 fps any more. This points to the buildings being the culprit and then some. They alone contribute 3271 extra draws, already enough to max out the E8500. That's more than double the effect the poorly-done ground decals have (the texture is good, but the repeat width and thus shape is not). Given this, I have no choice but to redo the buildings, big time! Question is, how much of a redo do I need? Where do I start the redo?

Ground decals: none. Buildings: all.
Draw count: 4099. Frame rate: about 72 fps.

Ronnis frame rate test - buildings to 32

Date: Jan 26, 2012
Screenshot #264: To find out, let's find the point where the buildings contribute an excessive number of draws. A scaling of 32 is a good point to consider. At that distance, each city block, of which is 2048 CU, is 64 pixels. This means up to 17 draws are needed for the buildings at that distance. This only adds 194 draws, quite a few.

Ground decals: none. Buildings: to 32 only.
Draw count: 1022. Frame rate: about 291 fps.

Ronnis frame rate test - buildings to 62

Date: Jan 26, 2012
Screenshot #265: Just to be sure, let's consider how the draw count changes when all buildings out to 62 are left unchecked. This is a good threshold as this is also the point where the buildings split into 2 within each city block. The buildings at 62 have only one building per city block. Those beyond have 2. Those beyond are also very small. At a scaling of 62, I'm getting 31 city blocks into the view so that's up to 32 total draws, quite a bit. The next layer beyond can get 33 city blocks into the view which means potentially 68 total draws due to the smaller buildings. For another 410 extra draws from that of the 32, it seems more like the 32 is the best point to start.

Ground decals: none. Buildings: to 62 only.
Draw count: 1432. Frame rate: about 207 fps.

Ronnis frame rate test - buildings to 20

Date: Jan 26, 2012
Screenshot #266: With the buildings at 32 already using a high number of draws, what about the buildings beyond 20? If I went with 14, I'd have memory problems due to the buildings using up too much memory and needing to be segmented anyway. At a scaling of 20, I get up to 11 city blocks in the scene so that's only 12 draws which isn't all that much. The closest buildings, with a scaling of 14, have up to 7 city blocks visible and thus only 8 draws. Going out to only 20 adds 72 draws. 72 with only an 8, 10, and 9? Something doesn't make sense! An investigation into the drawing of the buildings yielded 3 well-hidden bugs with that part of the drawing function.

Ground decals: none. Buildings: to 20 only.
Draw count: 900. Frame rate: about 330 fps.

Ronnis frame rate test - after fixing drawing bug

Date: Jan 26, 2012
Screenshot #267: After having fixed those bugs found in the drawing for the buildings (of which also affects the houses in Jeremy's House, the air taxis, and the cars, among a few others) and fixing any new bugs introduced from this, I've managed to partially solve the high draw count problem. From 5585 draws based on the all-visible setup, I took away 846 of those draws. I'm now just barely able to get smooth motion with this scene. This experiment is one of the methods I use to hunt for bugs in not only my projects, but other games and programs too. This is also a great example on how I make use of the debug panel. Even though I got that bug fixed, I still must redo the ground decals' scale shape and also the buildings, especially the buildings. I've decided on fusing the buildings into a single image for all layers beyond the 32. The far buildings repeat every 1/2 Kbl (16,384 CU) so, at a scaling of 128, the most distant buildings visible will drop from 130 draws to a mere 9 draws (5 if I spend more work and use a repeat width of 1 Kbl instead). The buildings at 65 go from needing 66 draws to only 5 (rarely 6, becoming just 3, rarely 4, with a 1 Kbl repeat width). Making that change alone will severely cut back on the total draws to a more meaningful 2500 or less (at least, that's my target). If your system cannot handle that, I do strongly intend on having a configuration setting to hide some elements.

Ground decals: all. Buildings: all.
Draw count: 4739. Frame rate: about 63 fps.

Ronnis frame rate test - after updating decals

Date: Jan 28, 2012
Screenshot #268: Under the identical conditions of my previous cases, except with the ground decals updated to address the frame rate problem, I'm now using 590 fewer draws each frame. This means ground decals are only contributing 896 draws, a pretty decent 39.7% reduction. This now means that the only thing left to do is update the buildings, a task that is expected to take a few days to complete. I'm leaning very strongly on replacing all buildings beyond the 32 for the scaling (2/3 Kbl).

Ground decals: all. Buildings: all.
Draw count: 4149. Frame rate: about 72 fps.

Ronnis - redoing the buildings 1

Date: Feb 1, 2012
Screenshot #269: It took several days, but the effort was well worth it. The process for making the buildings is almost the same as it was, only more efficient and streamlined. The first part, preparation, is nothing new, though only adjusted to account for the streamlining. The streamlining is done by doing not 1 building at a time, but 2 whole city blocks' worth (2 buildings here, 4 for the far ones). The next part is getting the random colors, and that's what this screenshot shows. This is done the same way as before as well, except each building has a different color. Here, I'm using my color randomizer layer and the eyedropper tool to get colors. Like before, I memorize the first two values I get (making use out of "luck points" while at it, a method of self-entertainment), set the color based on those random values, and bucket fill the specified part of the building.

Ronnis - redoing the buildings 2

Date: Feb 1, 2012
Screenshot #270: Stage 3 is where I set random heights. Earlier, I used a random number generator for this and only 1 building at a time. Here, I just pick the values myself and do all 4 buildings within each set at once. This is where the streamlining really comes in handy, speeding this part of the process up by almost double.