How do I preload next layout?

0 favourites
  • When the layout starts, for a second there is a drop on the frame rate and after that runs perfect. If i enter in the previous zone(layout) and go to the layout again not happens, i guess the layout was loaded in the memory and after that always access fast without framerate drops. (I'm using NW.js)

    So, is there anyway to load the next layouts to avoid this framerates drops when the player access to a new zone/layout for the first time?.

  • i don't understand ur question, can u please simplify?

  • PreLoad a layout when you are in other. So when you go to the big layout he is already in memory and avoid frame drops when starts.

  • ooh let me see, i will replay when i get any result

  • oh yea ...... i remembered this... i got the same problem on my game too, i fixed it by making the layout bigger and make the layout 2 in layout 1

  • Thanks but this not work for me, i will have a lots of maps in the rpg and i will have various layouts that will have diferent layers and things, i can't do it all in the same layout.


    One of my ideas is put a black sprite at top of each layer in the layout and when the app starts run all the layouts, i mean "When layout loading is complete= Next Layout" and in the last layout set "Loading=1" and go to first layout. Then if loading is 1 the black layer will off and will deactivate the group "loading" that skip the layouts when are loaded.

    With that all the layouts will load to memory and next time when the player plays will load fast without framerate drops "theorically!" . I test one of the big layouts wth 300 objects and the RAM charged was 500-600KB, so i guess this may work.

    Is there any other solution already that C2 can do?

  • 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.

  • I'm just curious, but what if you make everything in the big layout invisible, just to test if it loads quicker. Does it have any effect?

  • 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

  • Prominent I will have a lots of big layouts for the maps of each zone, do all in one layout.... i guess will be a chaos with all layers, tilesets and events,etc... to say what ones are visible and what others no and also will have indoor/outdoor maps when you enter on a house, cave or something.

    So then the unique way seems will be create the main map, (outdoor) all in one layout like this: ... rldmap.png

    And create new layouts only for indoor zones(houses, caves...) like this: ... ening/maps

    Also i'm using the C2 tilemap editor actually, and for big things maybe will be better use the Tiled one and use the plugin of .TMX to parse it all.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

  • 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 .

  • oh yea

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