Load screen first attempt

After a fair amount of tinkering, here’s my first try at putting a loading screen in before the menu, and also my first video showing off the main menu itself:

Apologies for the poor quality – I still need to learn how to grab and convert these properly for uploading online.  This is also grabbed from the Unity3D editor rather than the iPhone, so the loading speed isn’t representative of the real thing just yet – still plenty of fiddling to do with the profiler hooked up to the phone to identify where the spikes are.

I have abandoned the idea of getting the game from tap to playable within 10 seconds.  It’s just not a realistic goal, as it turns out.  (Although amusingly enough, if I had a faster phone like an iPhone 6S, it probably would be that quick or better!)  While in some of my previous efforts this past week, I have been able to get the menu up within 10 seconds, the ensuing lagginess as the game then continued to load assets in the background needed for that menu to be properly interactive, or for the game to be playable, was just too horrendous.  The animations were jerking all over the place, huge stalls in frame rate were happening, and so on.  Hence I decided to add a loading screen after all, to sit between the point where rendering becomes active (what I used to call “tap to black”) and the point where enough assets have loaded that the game can proceed to the menu or gameplay without noticeable lag.

The purpose of the load screen is two-fold.  Firstly, it’s a static image, so there’s no animations happening that can be impacted by lag when any massive frame rate spikes hit.  That means I can pile most of the asset loads on in parallel and let them grind away at the CPU without being visible – and hopefully starting them all sooner means they’ll finish sooner.  (There seems to be some sort of file system deadlocking complexity, however, so it’s not quite that simple and may need some staggering logic… more to figure out there!)  Secondly, by having a percentage bar slider on the load screen, which bumps whenever an asset progresses in its loading stages, users can visibly see that the game hasn’t stalled, and can feel more confident about how long it will be before they can start playing.  This small visual indicator, I think, helps a lot with the perception that the game is not as slow as one might think.  It’s something a person can use to track progress and psychologically helps them to be patient, as opposed to them wondering what’s going on and starting to brood about slow load times.  So now that I’ve got some art in there for the load screen (which I’ll no doubt redo at some point), I can continue on with refining the staggering of when each bundle starts loading, how often it yields, whether it sits and waits for another bundle to finish first, and so on.

Current build takes 10 seconds from tapping the icon on the phone to where the load screen comes up, then another 28 seconds before the menu comes up with all assets available (i.e. the game is fully playable).  So that’s 38 seconds from tap to playable, with all assets in place, and with the new load screen showing percentage complete during much of that, so the user doesn’t feel like the game has stalled.  This is much better than when I started the exercise, but still not quite where I want it to be.  If I can crack the 20-seconds-to-fully-playable boundary, I’ll be really happy.  From my previous post, you might recall, I got an experimental build down to 26 seconds (albeit pared back to just the menu only, with none of the actual game assets being loaded), so I feel like it’s still possible to get the times down even further.

There are definitely some more things I can try.  First there’s further profiling and looking for spikes and trying to pace out the horrible bits to remove those deadlocks and other nasties.  Earlier when profiling on the iPhone, I spotted some spikes that were as bad as 4,000 ms for one humungous frame!  Can’t have that.  I suspect a fair bit of googling and experimenting is going to happen while I try to figure out what’s going on there.

Another thing I want to try, if I can get those spikes down, is moving some of the bundles back out into the “during the menu” stage.  At the moment the 100% loaded is covering every asset bundle, not just the minimum ones needed for the menu – that includes the skybox, all of the in-game music tracks, the grid calculation data, and so on.  Technically, those could be left until later and done in the background before the user taps Play, as long as their loading doesn’t cause subsequent lagginess in the menu, and as long as they can still get loaded in time for a quick-fingered user to still feel like the game is being responsive.  I do have flags already in place to distinguish between just-for-menu loaded managers and fully loaded managers, so this may be a matter of trial and error balancing to see what’s possible here and which sequence of load events consistently feels the smoothest.  There might even need to be some fairly complex tracking added so that the game can be played without all of the bits in place yet (e.g. once one of the songs is loaded, the game becomes playable, with the others loading in the background as you play and before the first one in the playlist finishes), although I’d like to avoid overcomplicating things like that if I can.

Lastly, there’s still a little more potential for moving some of the tinier textures and sounds and so on out to asset bundles to get the tap-to-load-screen time down slightly more by reducing the executable size.  It’s currently at 16.7 MB assets now, well down from the 27.7 MB the last time I posted on this subject, but there’s still perhaps about 1-2 MB more I could scavenge back of assets that don’t strictly need to be present right from the start, such as level editor and social share icons, for example.  It might not achieve much, but even 2 or 3 seconds out of that pre-load-screen time would make it worthwhile.  I should also start working on a better splash screen for that pre-load stage, as currently I just have a distorted copy of the game icon and I’m tired of looking at it.

Anyway, I am feeling optimistic.  I have now halved the load times from what they were, and the new loading screen with the addition of a percentage slider to watch helps to make the wait more palatable.  Even if I don’t succeed in halving those times again to get to my ideal target, these times are now at least competitive when compared to other games, and that’s what matters.

 

Leave a Reply