Is this when testing locally? The problem at the moment is that even if you preload all resources on boot (game startup), upon map loading the plugin still checks to see if all resources on said map are in the cache / ready to be used. If so, it marks the map and all its assets as loaded internally and it starts running it. This can take a few hundred ms or more depending on how many resources are used on the map in its events and their pages. The next time you load that same map, it should be significantly quicker than the first time. This is something I will rectify with folder loading.
I'm going to use the space below to elaborate a bit on the challenges with preloading and why further development has taken as much time has it has.
Nerdy details follow, so be warned!
There are a few pitfalls with preloading in MV and this is also why the expanded options of folder loading are taking some time to make. It is important to understand that when you run a game in MV locally, either through a .exe or a .app for Mac, or on iOS or Android, it runs a HTML5 "website" in a closed environment that is, speaking simply, a mini-browser. Additionally you can publish your games on the web and have them playable in most modern browsers, too. But what this means is that whereas in Ace you had one singular environment where loading and caching were uniform, now there's variations depending on platform, and each browser is its own platform.
I made the plugin for the launch of MV and decided to -- as far as possible -- not alter the internal loading functionality for the engine in case they were changed shortly before or after launch. The biggest challenge for the default behavior is that sound files (bgm, se and me) all have to be requested for loading to be able to check if they're cached. The problem comes from the fact that HTML5 Audio doesn't actually support caching at all; it always streams the resource anew, but many browsers will still let it stream from cache luckily. Chrome and Safari (running WebKit) support the WebAudio API, which is far more substantial, but it's also Google's own project and it's not something you can rely on for all platforms.
So currently, using MV's default *Manager objects, caching works as follows:
- For pictures, it loads the bitmap into memory and stores it in a cache. When said bitmap is asked for again, it checks the cache first to see if it's available, cutting down subsequent loading times.
- For audio it requests the audio to be loaded (but not played), and once completely loaded it lets the browser decide whether the audio file should be cached or not.
Audio is therefore the big problem right now, because some browsers (or any browser depending on free user disk space, ram and how many tabs they have open) can decide to free the audio object from its cache when going unused, preferring to just stream if it's requested again in the future. The preload manager will do the following with audio files: it will ask the browser to load the audio file, and once the audio file is asserted to be playable, it considers it preloaded. Of course this means that if the browser didn't cache said audio file, it must be loaded all over again.
Obviously this is not good enough, so I'm trying to figure out what I can do. The solution would preferably work in all environments but I might actually have to develop unique solutions for Windows/Mac, iOS, Android and web, with web being the wildcard where there might just not be much I can do. But I'm working on it, it's just a bigger challenge than I'd thought it'd be
:)