MM_Preloader (layout preloader) (Plugins)

  • Hi

    I've successfully made a preloader with the global layer approach, everything fine, but recently I'm having a problem the very moment I tried to not use the stabilizer.

    If I disable (or delete) the event turning on the stabilizer (stabilizer is off in properties) so that the preloader doesn't use it the first time I switch from Layer 1 to Layer 2 everything works as intended, then if I go back to Layer 1 and switch back to Layer 2 the project hangs without showing progress and it never switches to Layer 2.

    Loader animations keep working though so it doesn't seem a complete "freeze" but just the preloader not starting.

    More info:

    • I have a title layout with just a tap to start function and on that layout is included the preloader "empty" layer and preloader event sheet. The preloader is called by a function with the "tap to start" action.
    • The actual preloader global layer is in a separate layout.
    • The project is lowres very light as for now since I still have to add the majority of the content, so that without preloader switching from title screen to layout is a blink even on mobiles*.
    • Audio is preloaded by C2 on start of the first layout (default C2 option).
    • I've tried disabling the events that show progress, hide layers, wait xx secs, but the only difference is the stabylizer being activated or not.
    • Please note if the stabilizer is on everything works flawlessly even switching repeatedly from one layout to another.

    *Another thing I'm wondering about is indeed the fact that when I use no preload of sorts being the assets very light switching layout is an instant while with the preloader it still gets a couple seconds to reach 100% and move on. While C2 initial preload is so fast you almost can't see in such case. So I thought it could be the stabilizer taking his time but when I tried.. Well nothing worked anymore.

    Any idea on what could cause this?

    EDIT: corrected some typos.

  • Hi CrK

    I suspect that you try to start the preloader while nothing has been added to the preloader's list (stabilizer is counted as an item). The preloader will not start if nothing is added because it simply has nothing to preload. So you may want to check the number of items added to the preloader ("ItemsCount" expression) before you actually start it. This way you are able to decide whether you need to start the preloader or not.

    If I'm right you should see "[Preloader]: Cannot start Preloader, the list is empty." message in console log. Can you check if you see such message in the console or any other message in the moment when it does not start?

    In regards of the Stabilizer itself. Yes by just adding the Stabilizer your layout transition will take at least Check frequency * Confirmations required seconds because it has to be sure it's all stabilized.

    If the above solution won't help then if possible could you please send me the capx for investigation? It obviously doesn't need to be your project but if you could just replicate this issue in separate capx that would help me to investigate the issue.

  • Hi CrK

    I suspect that you try to start the preloader while nothing has been added to the preloader's list (stabilizer is counted as an item). The preloader will not start if nothing is added because it simply has nothing to preload.

    If I'm right you should see "[Preloader]: Cannot start Preloader, the list is empty." message in console log. Can you check if you see such message in the console or any other message in the moment when it does not start?

    Hey thanks for the assistance.

    You are right I just did a quick check and I see that message in the console, so now I wonder why it doesn't get the assets..

    the weird thing is on the first preload it works, its the second time that hangs.. maybe there's something wrong in my logic.

    I tried adding the items check and stabilizer off, same working ok on first cicle layout 1 > preload > layout 2, then on second try the preloader doesn't start cause the list is empty

    Here's a quick screen of the original event sheet

    EDIT: almost forgot, yes I know the global var in the image is empty, that's because I set it with the layout name on the first layout event sheet and I made sure in debug mode the variable still get corretly set every time it goes back to the first layout.

    If you still need a capx let me know, I'll try to make one asap.

  • Hmm... then my guess is that gvr_NextLayout variable is either empty or it's not a valid layout name (a typo maybe?). Please double check this variable just before the issue occurs. Log it to console with Browser.log().

    If the issue still remains, please send me the capx. Otherwise all I can do is guessing :/

  • Hmm... then my guess is that gvr_NextLayout variable is either empty or it's not a valid layout name (a typo maybe?).

    But in that case it shouldn't work at all since I point to that variable to switch layout and If I run the thing as you see in the image everything works perfectly. The problem happens only disabling that highlighted action referred to stabilizer (and only after going back to first layout at least 1 time).

    EDIT: capx sent!

    EDIT 2: I was thinking that maybe the assets aren't purged from memory after leaving Layout 2 and this is why the first time works but the second time since it has all assets already loaded the preload list remains empty?

  • HI ! I am both C2 and C3 user, but v1.3 plugin on store is the old one, no c3 plugin in it ...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • HI ! I am both C2 and C3 user, but v1.3 plugin on store is the old one, no c3 plugin in it ...

    Hi RetroDaddy

    The c3addons are submitted to Scirra Store but they need a manual approval from Scirra employee. Today is a bank holiday in UK so I believe Scirra had a long weekend that's why it's not approved yet. I expect all c3addons to be approved tomorrow so please be patience and check for an update tomorrow.

    Thanks!

  • Hi CrK,

    I've investigated the capx from the JS level step by step and indeed there was an issue in detecting if an object was already preloaded or not in certain cases.

    I've already submitted a fixed version (v1.4) to the Scirra Store. I expect the files to be approved and available to download by tomorrow.

    Please give it a try with new version tomorrow and if you'll find any other issues just let me know.

    Thanks a lot for reporting this one!

  • I've investigated the capx from the JS level step by step and indeed there was an issue in detecting if an object was already preloaded or not in certain cases.

    I've already submitted a fixed version (v1.4) to the Scirra Store. I expect the files to be approved and available to download by tomorrow.

    Great, I'm glad you managed to find and fix the issue. I would love to give it a try too but still no v1.4 on the store..

  • Great, I'm glad you managed to find and fix the issue. I would love to give it a try too but still no v1.4 on the store..

    I know :/. I have no idea why it takes so long. I already wrote an email to Scirra support. Hope they'll approve the files soon. Sorry for the delay, nothing much I can do except "rushing" Scirra guys withan email.

  • I know :/. I have no idea why it takes so long. I already wrote an email to Scirra support. Hope they'll approve the files soon. Sorry for the delay, nothing much I can do except "rushing" Scirra guys withan email.

    Yeah I know it's not up to you don't worry. Funny thing is it took much less for you to do all the stuff and fix it than them to approve the file

    But hey I'm not complaining just wanted to let you know I hadn't the chance to try it yet.

  • MM_Preloader v1.4 is now available to download both for C2 and C3.

  • Some users reported issues with downloading the example capx from Scirra servers so I've uploaded to my Gmail Drive.

    Example capx download

  • Hi ,

    I would like to ask you something, just to be sure I’m using your tool correctly.

    Here’s the context:

    Layout 1 has not the object BG1 on it.

    Layout 2 has not the object BG1 on it either, but BG1 is created in the event sheet, on start of layout.

    What’s the correct way to have BG1 preloaded so that I have a smooth transition from layout 1 to layout 2, and no stop at the start of layout 2?

    • Preload in layout 1? (then maybe BG1 is unloaded when going to layout 2 as it’s not present on that layout)
    • Preload at the start of layout 2? In this case does the plugin make a difference from simply creating the object on start of layout?

    Thanks for your help!

  • - Preload in layout 1? (then maybe BG1 is unloaded when going to layout 2 as it’s not present on that layout)

    Yes it will be unloaded by C2 engine transition system, so this approach will not work as you suspected.

    - Preload at the start of layout 2? In this case does the plugin make a difference from simply creating the object on start of layout?

    One of solutions would be to make not a layout transition preloader but layout initialization preloader. Technically it's the same, the difference is when and how you trigger it.

    Layout transition preloader you start at the end of previous layout and then you jump to the next layout having everything preloaded.

    Layout initialization preloader you start at the beginning of the layout and you preload/initialize anything that does not exist on the layout yet but will be spawned during runtime. In this case you most likely want to enable the Stabilizer to ensure that everything is smooth when you hide the preloading layer.

    The difference from just spawning the objects as you do right now is that by just spawning them, you will notice the lag, while with preloader you can show the progress of loading and you can preload elements further used in this layout (like bullets, etc.).

    You can also combine a Layout transition and layout initialization preloaders.

    BUT

    Spawning the element at "On start of layout" instead of having them on the layout sounds like a not the best solution. I suggest to just put the item on the layout and use regular Layout transition preloader. Otherwise you will probably have to preload both before and after the layout starts.

    Hope that helps, if you have any further questions just let me know

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)