How do I preload next layout?

Get help using Construct 2

Post » Mon Aug 31, 2015 8:37 am

did u tried what i told u ? ... i think if u made it, it will make the layout faster, but the only problem is that the layout wont be loaded in the first time u open the layout because, the layout is only saved when the player entered it in the first time....
Simple : in the first time the player enters the layout it will not be preloaded, but in the second time it will be preloaded.
C2 Intermediate Developer
Feel free to contact me
B
7
S
2
Posts: 111
Reputation: 908

Post » Mon Aug 31, 2015 3:30 pm

You cannot use directories/subdirectories to organize layers in C2, so putting everything in one layout is not a good idea - I totally agree with that and discourage to do this. That is simply not a good development practice. Another discouraging fact is that if you ever think of moving this game to mobile devices, too many objects in one layout would kill the mobile probably on the start.

One of the most important thing in development is to correctly (also sematically if possible) organize your project elements. C2 gives us layout and layers for that and I recomment to use it.

There is a delay while switching the layout - that is true - but this is totally normal, because all layout objects have to be loaded. It's not a C2 flaw - this is simply how it works everywhere. Check out other games, even the big ones like Diablo etc., everytime you swich between some distinct "screens" there is a loading screen and you have to wait. The faster PC/mobile you have the faster loading is, but it is there anyway.

So don't try to workaround loading game elements by loading all of them at once because this is a bad practice and can kill weaker devices. Instead you should do the same thing as "the best devs" do for decades - use loading screens. Loading screen is not frustrating or anything like that. Players used to wait for game/screen to get loaded.
ImageImage
B
27
S
16
G
68
Posts: 946
Reputation: 38,601

Post » Tue Sep 01, 2015 1:43 pm

@BackendFreak
what u r saying is true but i already told him to make a loading screen between layout the other idea was optional to him.
C2 Intermediate Developer
Feel free to contact me
B
7
S
2
Posts: 111
Reputation: 908

Post » Tue Sep 01, 2015 1:51 pm

@Ihab7 I know, that's why I wrote that I agree with that. Just wanted to clarify that it is not only one of the options but it is the right one :).
ImageImage
B
27
S
16
G
68
Posts: 946
Reputation: 38,601

Post » Tue Sep 01, 2015 2:08 pm

oh yea :lol:, i didnt read ur full post, sorry :D
C2 Intermediate Developer
Feel free to contact me
B
7
S
2
Posts: 111
Reputation: 908

Post » Tue Sep 01, 2015 2:25 pm

Ihab7 wrote:u can make a loading screen that shows up when going from layout to another, i think this is the only way, or maybe u can save all the object in the layout to the local storage or webstorage, example: So when the layout go to (layout2) then returns to layout 1 the object will be saved and ready for loading quickly :D


This is not going to work as you think when dealing with lots of objects, especially more so if lots of objects have behaviors.


C-7 wrote:There isn't a way to preload it like you're asking, but I have a fade in/out to black to hide and smooth out the transition.


This is by far one of the best approaches.

I call it camouflage :)
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Tue Sep 01, 2015 2:45 pm

i think that the loading screen will work, ..... can u please tell me why it wont work as you say?
C2 Intermediate Developer
Feel free to contact me
B
7
S
2
Posts: 111
Reputation: 908

Post » Tue Sep 01, 2015 3:04 pm

Don't get me wrong, the loading screen you mention will likely work, but it is far from optimal.

Most of the frame drops happen after the load, also due to objects initializing their states, where behaviors obviously require more performance.

Not to mention it taking longer to save/load the more objects your layouts has, which also requires a sophisticated loader mechanism to make it viable for the game matriax mentions.

The key is layouts with not to many objects on them, and careful with addressing them all. (the objects)

And switching between layouts smoothly can be done as easily as have a global black none transparent layer on top, lerping its opacity to 100% before switching to the next layout, which lerps the black layer back to 0% on layout start.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Tue Sep 01, 2015 3:10 pm

ok thx for the info
C2 Intermediate Developer
Feel free to contact me
B
7
S
2
Posts: 111
Reputation: 908

Post » Tue Sep 01, 2015 3:29 pm

That is basically the same solution as with loading screen, but you use a black layer instead of loading screen sprite in it. However I haven't tried lerping the opacity. I need to check it out :). Thanks for sharing!
ImageImage
B
27
S
16
G
68
Posts: 946
Reputation: 38,601

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Ryan Kocourek and 2 guests