How do layouts load?

0 favourites
  • 3 posts
From the Asset Store
Progress\Loading Bar. Now Load you game like a Professional.
  • Hey Guys

    I've got a question on how layouts load. My game works quite well on pc and smartphone devices with more or less a steady 60 fps rate. However, what slows it down a bit is when switching layouts.

    For some reason whenever I switch layouts the loading times go way up. By loading times I mean the time specifically needed before showing the viewport and starting to load objects. I've covered this by using loading screens (to preload images also), but I was wondering how exactly a Layout is loaded before the viewport is shown. I've been removing objects and behaviours but don't see notable effects, while other layouts often load quite fast so I'm at a loss.

    The debugger also just shows nothing, it just hangs until objects are loaded. Because of that I tought I'd just ask how it works in order to find the culprit.

    Thanks in advance!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's probably the layout-by-layout memory management. See this manual guide on memory usage for details. Basically it's loading all the images used on the next layout. Usually it's fast, but if you have loads of images and animation frames, it can be a lot of content.

    The system memory management actions provide more control over this, such as letting you pre-load the next layout. However you should use these with care, since you can end up with two entire layouts loaded in to memory at once, which may spike the memory usage high enough to crash some devices as they run out of memory. You can do other techniques like switching to a loading screen to preload the next layout to avoid this.

  • Thanks, Ashley!

    I've actually gone through the blogs, very enlightning. I had already applied most of those tips and tricks in there, also using a pre-loader here and the amount of objects is acceptable, the game runs nice and smooth so I had to look further.

    I did find the problem a few seconds ago (after a long search...), weirdly there was one object that the "slow loading layouts" had in common, it uses pathfinding and the cell size was set to 1 because I wanted to the object to have a constant y position while randomly moving around.

    Changing this to a higher number solved it, I had to wait 10+ seconds for the preloader (Loading...) to just show, now it appears in 2 seconds.

    The thing is, I knew this setting was intense for the CPU, but testing it at the time didn't show any frame drops and I mustn't have payed attention to the loading time then.

    Anyway, mark it as solved, maybe this information is useful for someone. :)

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