How do you test whether a layout has completely loaded?

This forum is currently in read-only mode.
From the Asset Store
Soldier Test
$9.99 USD
A Construct version 2 & 3 "Stand-alone" RPG game with "In-Game Module" (IGM) integration.
  • I've run into a bit of a snag, and it's probably not one that comes up often. I've got a layout with, quite frankly, a whole ton of objects on it (predominantly low-resolution sprites). Accordingly, it takes a long time to load (roughly 4 seconds on my machine, probably worse on others).

    When the player starts the level, obviously it would be handy to know when they're actually going to be able to see what's going on in the first few seconds. For whatever reason, the script's still running even though the visible display hasn't actually switched over.

    I've got a little countdown timer at the beginning of the level, presently set to 5 seconds, during which time the main loop in my script is disabled. But, of course, 4 seconds of that are already gone by the time I can see what's happening, and I'd like for it only to be 3 seconds (and visible!) anyway.

    Yes, the objects are strictly necessary.

    What I'd like to do, ideally, is to make an opaque layer visible while all the objects are loading, with a standard little "Loading..." message in the middle of it. But, since I don't know of a way to test for that, I was hoping someone here might give me some advice on the best way to accomplish it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What I think is actually going on is that time delta continues while things are loading (i.e, the time delta for the first frame of a layout includes the time it takes to load the layout as well as the time it takes to execute the events and draw the screen) but the event sheet isn't running extra times. That's what happens with my game. How I solved that was in the application properties/runtime properties/advanced, set the minimum frames per second there to something like 30. That way the time delta won't keep racking up while it's loading.

    Instead of using a countdown timer based on time delta, what you should use (again, what I'm using) is a tick timer. Basically, if value is greater than zero, subtract one from that value. Every time the event sheet runs, you'll know it by watching that value.

    As for a loading screen, you can do that too. Before going to the layout that takes a long time to load, put a black sprite or box across the whole screen and your loading image somewhere as well in the previous layout. There is a trick, however; you have to display that one frame before going to the other layout (let the layout finish running its events), or it won't draw the loading graphics before going to the other layout.

  • What I think is actually going on is that time delta continues while things are loading (i.e, the time delta for the first frame of a layout includes the time it takes to load the layout as well as the time it takes to execute the events and draw the screen) but the event sheet isn't running extra times. That's what happens with my game. How I solved that was in the application properties/runtime properties/advanced, set the minimum frames per second there to something like 30. That way the time delta won't keep racking up while it's loading.

    Instead of using a countdown timer based on time delta, what you should use (again, what I'm using) is a tick timer. Basically, if value is greater than zero, subtract one from that value. Every time the event sheet runs, you'll know it by watching that value.

    As for a loading screen, you can do that too. Before going to the layout that takes a long time to load, put a black sprite or box across the whole screen and your loading image somewhere as well in the previous layout. There is a trick, however; you have to display that one frame before going to the other layout (let the layout finish running its events), or it won't draw the loading graphics before going to the other layout.

    I tested the idea of it being based on TimeDelta, and no luck. I've already got minimum FPS, etc, set up. When I ran a simple once-per-loop increment counter, it seems that there are multiple ticks (between about 165 and 750, depending on the machine I've tested it on) of actual game logic going before the layout is visible.

    As for implementing a loading screen, I should have specified that it's not an issue of getting something like that working, but rather of overcoming this particular hurdle in order to make it work. I've got a nearly feature-complete game here, and this is one of the biggest obstacles it's still facing. The suggestion is appreciated, though, as a month or so ago when I first picked up Construct I was trying to do everything like I would do it the hard way in C++ (old habits are hard to break!)

    Any other thoughts on this one?

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