[suggestion] load the necessary images of layout

Discussion and feedback on Construct 2

Post » Thu Jan 09, 2014 3:38 am

As we know, C2 engine will load all images from website when open the index.html.
But the loading-time might not be acceptable. For example, there has a background image for each layout.
So my request is, the engine might have an option to load the necessary image when go to the layout. It means, there are some AJAX requests for each layout begin, of course.
B
108
S
26
G
272
Posts: 4,472
Reputation: 152,279

Post » Thu Jan 09, 2014 5:11 am

I second this idea so much!
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Thu Jan 09, 2014 5:35 am

I agreed..

this will be great for big project.. like RPG.farieh2014-01-09 05:36:17
B
12
S
2
G
1
Posts: 25
Reputation: 986

Post » Thu Jan 09, 2014 5:56 am

I thought the Layout by Layout loading already did this. Am I missing something?
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Post » Thu Jan 09, 2014 6:04 am

@jayderyu

You could create 2 layouts, put 2 sprite for each layout. Export and run it at browser, see the loading info at console, these 2 images will be loaded (AJAX request) in the beginning.rexrainbow2014-01-09 06:04:44
B
108
S
26
G
272
Posts: 4,472
Reputation: 152,279

Post » Thu Jan 09, 2014 7:01 am

hmm. That's interesting.

When watching the memory of the game play and especially our larger game. I notice that per layout the memory usage is different. In our highest animated room the memory usage is 250mb and in our first room which has the least our memory usage is closer to 100mb. So memory usage is different. If all the sprites were loaded then our game would likely use about 1000mb at all times. So that's not the case.

Maybe what is happening is that C2 downloads ALL the assets, but stores them in the offline cache. This would account for for the AJAX to download all the images.

Also aren't the sprites on export on sprite sheets anyways. So it seems all the sprites have to be downloaded anyways. C2 on spritesheet can't really be selective to what parts of a sprite sheet are transfered. So it seems all the assets are going to get downloaded due to lack of selection. So if you can examine the AJAX call on the sprite image then it sounds like your monitoring a preview.

While I like the idea of only downloading the assets between layouts when needed and having a loader screen. It just doesn't soudn like it's feasible with the graphics being packed onto a sprite sheet. it sounds like al the sprite sheets need to be downloaded at the beggining. Which does add a lot of download overhead. :|
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Post » Thu Jan 09, 2014 9:57 am

I think this should be taken one step further - I think we should be able to have some manual control over the way the assets are loaded.

It could be kept simple with two actions and two triggers:

Action 1: 'load layout assets' - used to download the images of a layout. Works in the background while current layout plays, same as how the loader layout does.
Action 2: 'preload layout' - used to load images in a layout to the gpu (like the action CC has).
Trigger 1: 'layout assets loaded'
Trigger 2: 'layout preloaded' (both triggers take a string so you can tell which layout has been loaded)

With these actions/triggers, virtually all loading and pauses when switching layouts could be eliminated. Level 2 could download/load images to the gpu when level 1 is playing, or when the player gets to the edge of a level, make a 'loading' layer appear that could be animated, and go to the next layout when it's done.

I would really like to have this because it would help speed up previewing and initial start up times for players. 99% of the time I'm previewing, it's on one layout. If I could control it so the preview loads that one layout instead of the entire game and manually load the others when I want them, it would be quite a lot faster.

Similarly, it would also be useful to have 'load object assets'/'preload object'/'object assets loaded'/'object preloaded' to help stop stutters when an object is created for the first time and the game pauses as the images are sent to the gpu. But I think that's not as important as the layout ones.Arima2014-01-09 10:27:42
Moderator
B
95
S
34
G
33
Posts: 3,006
Reputation: 27,874

Post » Thu Jan 09, 2014 12:38 pm

Due to the offline cache, the browser gets to work downloading the entire game right away. If this was disabled, offline support would stop working (which I think is a pretty significant feature, especially for webapp-based platforms like iOS and Android's 'Add to home screen', Firefox OS, the Chrome Web Store, Amazon web apps, etc). So there's no point directing the browser to only download assets half-way through the game - it's already working on that.

Perhaps the loader layout system could be extended though. If the assets were downloaded in sequential order for each layout, then rather than having just one loader layout, you could go to any layout that has been loaded so far. So for example you could play up to level 3 if it's downloaded that far, but you'd have to wait before playing level 4 if it hasn't downloaded its assets yet.

Not sure how easy that would be to implement...
Scirra Founder
B
398
S
236
G
88
Posts: 24,433
Reputation: 194,635

Post » Thu Jan 09, 2014 1:54 pm

I've noticed quite a few flash games use a loading animation like the circular gradient. It can be annoying, but at least you get an idea of whats going on.
Perhaps if there was an option to say what assets get loaded when needed?
Image ImageImage
B
169
S
50
G
174
Posts: 8,328
Reputation: 110,800

Post » Thu Jan 09, 2014 4:13 pm

Just as a feeling from the system. I feel that C2 is awesome, but it's still geared towards smaller games. Our Point and Click game had 250mb usage for one room/layout. On our PC this had apx a 3second load time. Sure this is small; but the game isn't finished. To even get that we had to cut 1/3 of animations. And due to the audio glitch from the load time we had to cut the animations down to 1/2 of the original which had our load time to 2 second.

because of all of this we had to implemented a fade in/out to hide the fact the game pauses. Now when our game get's bigger this won't be so hidable. Having more input and control would be great. But I do understand Ashley's point of view. C2 isn't an open API it's an entire language environment.

Though would be really nice to to have a between layout loader.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 19 guests