Preload Manager

● ARCHIVED · READ-ONLY
Started by Galenmereth 289 posts Page 3 of 15 View original ↗
  1. @MikeMakes: This will preload the parallax image specified on a map automatically on map preload, yes. It preloads any and all resources used on a map when it loads the map. You can also make it preload specified parallax images (and other resources) on game startup if you want using the advanced configuration.

    @Fernyfer775: This could be because the resource is not found. In the update I'm working on it will print an error message to the screen if such a thing happens. You might want to try the maps this happens in while test playing and opening the console using F8 to see if any errors are printed out.
  2. (removed)
  3. @blubberblubb: Is this when your game is played in a web browser, or when running the game from the .exe or in local testplay? And if local, what OS are you on and is it 64 bit?

    To answer what is going on (regardless of platform, but when played non-locally in a web browser it becomes an actual problem): The HTML5 audio object doesn't support caching audio. Neither does the alternative WebAudio object. In both instances it's up to the browser which it's run in to get the file to cache it and load the file when requested again from cache.

    When playing your game locally using the compiled .exe / .app or in test play, the game is run in a dedicated self-contained webkit browser instance that usually does the caching right. But when playing games on the web this cache is in an unknown flux, and depending on the user's environment, browser and amount of open tabs / other running websites or webapps, audio is often "forgotten" once played. Right now I know of no good way to solve this for web play except trickery like encoding audio into an image format and tricking the browser, and then decoding it again. Or similarly exotic solutions. But to do things like that you need to know the host platform, and I'm unsure about performance when it comes to larger and multiple audio tracks.

    In short preloading audio should help in web play but it appears to not always work as it should. If it doesn't work in local test play I'm a bit more confused, as that runs fine from my tests. This is still an issue I'm looking into, but it's sadly a bigger problem than I thought it would be :|
  4. (removed)
  5. (removed)
  6. blubberblubb said:
    Edit: at least it doesn't work for me when I'm testing it, since you said it worked locally for you. Even when running in nwjs-win and not in a browser, BGM appears to be always re-requested despite a preloading attempt, at least as far as the title screen piece is concerned

    Edit 2: I have an idea: is WebAudio capable of streaming? Right now, I get the feeling the entire song is downloaded. Maybe a code change could convince RPG Maker MV to stream it? While that wouldn't solve the lack of caching, it might considerably lower the delay for many people
    You are correct, it does get re-requested. But when I test it, a re-request is significantly faster than the original request: https://tdscreenshots.s3.amazonaws.com/random/audio_rerequest_preload.PNG Do note that it does not say it fetches it from cache, yet it's much faster. Since there is no official cache functionality for audio in webkit I'm not entirely sure why this works the way it does. I really wish I did, but audio is a problematic area for html5 development still. 

    Streaming audio is how the engine does it by default, which causes a longer delay in playback locally, while saving some time on the web. In both instances it causes an unknown wait time before audio starts playing, usually.

    Is your OS 64 bit or 32 bit? This is relevant to some reports I've had.
  7. (removed)
  8. I've taken another detailed gander at how MV handles this and I see that we can solve this, but it requires me to rewrite how MV handles audio. Right now it requests a new WebAudio object (except for Android, where it uses HTML5 audio for bgm) for every se, me, bgm and bgs. With no caching whatsoever. Not only is this obviously bad for audio playback, it's even worse for performant. WebAudio is a "heavyweight" object for the browser. If you were to make MV play a few too many sfx at once, most people running a 32bit OS would have it crash, for instance.

    I am going to implement audio caching in this plugin asap :) Watch this space.
  9. (removed)
  10. Sweet stuff @blubberblubb. I'm going to take a look at this tomorrow :)
  11. (removed)
  12. That is a good point, but the tradeoff is that map loads will always take long, even if the map has been loaded previously and recently in your session, as you point out. Perhaps implementing an age check on the ImageManager's cache functionality is a better solution; any image that hasn't been requested for a specific period of time is cleared on map change. I'll look into this too.

    It is disappointing that the core MV code is so lacking in these areas.
  13. (removed)
  14. An option wouldn't be problematic at all and the best solution, so absolutely :)
  15. Hi! I have a request to make: is it possible to preload just certain files?

    You don't have to make it a clean and hard-to-make update, if you can just nudge me in the right direction I can add the stuff to the plugin myself without having to use commands etc. =)
  16. Advanced configuration is on the plugin file itself. Just search for "BOOT PRELOAD CONFIG -- ADVANCED USERS".


    Regarding this a small suggestion: Users usually don't like to edit the plugin file itself, but are used to notetags and since you are already waiting for DataManager.isDatabaseLoaded, you could (ab)use a common event to store all files to be loaded as notetags, like "<preload animation myAnimation>".
  17. Oh, nice let me check it out! Thanks.

    Is that second comment directed at me? Because I have no idea what DataManager.isDatabaseLoaded is and I have no problem editing plugins. I actually prefer it. x)
  18. Ah, no sorry, that was for Galenmereth ^^ Not everyone likes handling with source files, so i thought it might be a nice idea.
  19. Gotcha! No problem. ^_^  

    EDIT

    2 issues.

    1) There's an incompatibility with "Yami_SkipTitle". By skipping the title screen, I get this error:

    Uncaught TypeError: Cannot read property 'note' of null

    2) Is there a way to JUST load on BOOT the stuff I defined? Because this giant "Loading" lag at the start of each map is too big. I just want to preload a couple of sprites for cutscenes, that's it.

    Thank you! ^_^ 

    Yami_SkipTitle:

    Code:
    /*: * @plugindesc Skip the title scene for testing purpose. * @version 1.0 */(function() {    Scene_Boot.prototype.start = function() {        Scene_Base.prototype.start.call(this);        SoundManager.preloadImportantSounds();        if (DataManager.isBattleTest()) {            DataManager.setupBattleTest();            SceneManager.goto(Scene_Battle);        } else {            this.checkPlayerLocation();            DataManager.setupNewGame();            SceneManager.goto(Scene_Map);        }        this.updateDocumentTitle();    };})();
  20. (removed)