Preload Manager

● ARCHIVED · READ-ONLY
Started by Galenmereth 289 posts Page 2 of 15 View original ↗
  1. Found a small bug. If you try to run any events to test so Ctrl R on even a text event while in the event editor you will always get an error.

    cQYA4i0.png

    Pretty much means you have to disable this plugin while testing.
  2. @Kane Hart: Oops. I've fixed it now; it disables preloading when you're doing event tests since they'll always be local anyway. That solves it the easy way for now :)
     
     
    Updates to 1.0.3

    Changelog:

    • Fixed bug where the plugin would crash when running in event test mode.
  3. Galenmereth said:
    @Kane Hart: Oops. I've fixed it now; it disables preloading when you're doing event tests since they'll always be local anyway. That solves it the easy way for now :)

    Updates to 1.0.3

    Changelog:

    • Fixed bug where the plugin would crash when running in event test mode.
    Confirmed seems to be working just fine now thank you :)
  4. Does the plugin loads resources on a map by map basis?

    For example, if I start the game on map 3, then only resources used on map 3 gets loaded.

    I tried testing this out just now and from the console it seems like it loaded all the resources across all maps? I had set the preload option to false.
  5. The plugin only preloads resources on the current map, but it will load any and all resources found in that map, whether they are in event pages that will never be activated or not. The reason is that it's impossible to determine when the switches or variables or any other conditions for an event page might be turned on by the player :)
  6. Great, Galenmereth, thank you! :)

    Please, consider this:

    Jenza said:
    Would it also be possible to add some kind of loading bar or text to show what is being loaded just to show that the game hasn't frozen or something :p
    It would be very useful, specially on mobile that takes more time to load things plus "now loading" that doesn't even show up.
  7. I have a couple of questions.

    1. Is there a quick and easy way to load ALL the resources in the project folder upon game start? Without having to enter each file individually in the code?

    2. When a resource is preloaded, does it stay loaded, or will it have to be preloaded again the next time you enter a map that uses that resource?

    The answer to the second question may render the first question obsolete. I'm just wondering if there's any way to eliminate wait times upon loading maps (which are already present even when not using the Preload Manager).
  8. 1. With the new feature I'm adding where you can tell it to preload everything in a folder at boot, that will get significantly easier to do. I could easily make an option to just auto-preload all the default folders then, too.

    2. It stays preloaded until the browser cache allotted is cleared automatically or manually, something we sadly have no control over in web published projects. For local and native applications it should stay preloaded until the game is closed from what I understand.
  9. Thanks! That was a more promising response than I was expecting.

    I'm not seeing any improvement in the wait times upon loading maps, however. You'd think that once the resources were loaded, the next time the map was loaded, it would be pretty much instantaneous, but it's not. I'm trying to produce seamless transitions between maps by using a transfer without fade, which I was able to accomplish in VX Ace, but so far not in MV.
  10. 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:

    1. 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.
    2. 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 :)
  11. Yes, testing locally.

    I'm not familiar with all the technical details involved, but I do appreciate your detailed explanation of the problem - it sounds fairly complicated. I greatly appreciate your work, and the work of all who are developing plugins to enhance the functionality of the program.

    I suppose I am going through some growing pains, as a result of switching over to MV. I really liked how VX Ace worked, and now I'm finding that I have to get used to certain differences in the way MV functions, in order to take advantage of its added abilities. I guess cross-platform compatibility has its downsides, too.
  12. I just saw this.

    I've been working on an audio preloader myself (strictly only audio) and didn't think of all of the issues you've raised in the recent post, so I'm thinking maybe just going with this as I'm not too interested in providing support for every platform available.

    I'm having some issues with BGM though.

    This is what I would like to happen: nice, delay-less audio playing when I enter the map.



    However, I can't reproduce this with the preload manager and am not sure if it's because I'm doing something wrong.

    I'm simply inserting it into my project and turning it ON. I also enabled debug printing.

    But I have not touched any of the advanced configuration.

    Here's my console when I start a new game:

    PreloadManager.js:297 Map 27 (MAP027) preload starting.PreloadManager.js:364 Loaded file: (face) chimgFace1(1/5)PreloadManager.js:364 Loaded file: (face) Package2(2/5)PreloadManager.js:364 Loaded file: (bgm) Ship3(3/5)PreloadManager.js:364 Loaded file: (bgm) Battle1(4/5)PreloadManager.js:364 Loaded file: (bgm) Battle1(5/5)PreloadManager.js:375 All files loaded (5/5)My map automatically plays Battle1 when it starts (not the one in the video), but there's still the 1-2 second delay for me even though the console says it's completed.I am testing locally.
  13. Are you testing in the default nwjs wrapper, or using a local web server and browser? For me the audio starts markedly faster when using the preloader, and sometimes instantly. Which is weird and annoying.
  14. Galenmereth said:
    Are you testing in the default nwjs wrapper, or using a local web server and browser? For me the audio starts markedly faster when using the preloader, and sometimes instantly. Which is weird and annoying.
    Default wrapper. Whichever the editor chooses to run with.
  15. @Tsukihime: If you try changing line 547 in the PreloadManager.js plugin (just to test something):

    From this:

    this._audioElement.addEventListener("canplaythrough", this._onLoadedData.bind(this));To this:

    this._audioElement.addEventListener("loaddata", this._onLoadedData.bind(this));How goes it then?
  16. Doesn't seem to have made a difference. Still a delay before the music begins.


    I'm not sure if it's an html5 audio or WebAudio object though, since it's running in WebGL mode.


    Should I force the game to use HTML5 audio?
  17. Ah no, nvm, I've managed to confuse myself now. The html5 audio bit was added for Android due to AndroidChrome, so we can ignore that. I have to examine WebAudio closer, specifically, to see what's up here.
  18. Thanks! Now i really waiting for folder preloading function, because i using many script call images and they dont preload unless i add them in preload list, but i have too many pictures to add...
  19. Does this work for parallaxes or for only the resources specified?
  20. While this plugin was active, I had some players reporting that when they would go from Map A to Map B, it would just get caught up in the "Now Loading..." screen and not budge.

    I removed it, and the problem seems to have gone away. Any idea what might be causing this?