Why my game is running slowly at the beginning of the scene ?

0 favourites
  • 9 posts
From the Asset Store
3D Rendered, High Resolution elements to create an apocalytic scene or war zone
  • When the scene is beginning, my game runs slowly for 2-3 seconds and then it runs fluidly. I'd like to know the reason of this. Is there a way to optimize Construct properly?

  • are you just talking about running it in preview?

    there are a number of things that could be causing a start-up jank. Are all your objects in the layout on startup or are you creating object at runtime that are not present in that particular layout?

  • I'm runnig the game on an Android Phone, it's an apk release.

    I'm creating objects that are not present in the layout.

    -> After the layout has been loaded, there is 2-3 seconds where the game is running slowly. After this the game runs fluidly.

    Maybe I should change some settings in the render of Construct.

  • Try adding an instance of each the objects you are creating in the layout editor. You can delete these placeholder objects on start of layout.

    As long as there is a single instance of an object on any given layout, I believe that object's textures will be preloaded into memory before the layout starts. If you create an object via events that was originally not on the layout, then it has to load it into memory then and there.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Alright, also is it a good thing to load all images by using an event before opening the layout ? I saw that the game ran more fluidly when the layout start.

  • Based on my understanding, the actions in that event is exactly what the Construct does regardless of if you have the load layout images action there or not.

    When changing layouts, the engine will load all images on that layout into memory.

    The key is, if there are no instances of a particular object placed on that layout in the layout editor, it will not load (I think), even if you have the loat layout images into memory action. If that object is then created later, it needs to be loaded at that time.

    So if you create a lot of objects on a layout that you didn't place in the editor, the engine did not know to load those ahead of time when switching layouts.

  • yeah put all the object you are going to use in your layout. On Start of Layout add the action: Destroy for any object you don't need right away

  • the only issue I ever had with this is if I use the On Destroy trigger. If you have code in a trigger like that, you should set a bool that ignores the first run through of the sheet, that way you can destroy objects in your Start of Layout without that trigger code running.

    so you would add

    On Destroy AND !runOnce(this is a boolean)

    then at the end of the sheet do:

    Trigger Once While True

    runOnce = true

  • Well I put all the objects in the layout and the game is not slow at the start of the layout anymore.

    The loading time of the layout is just a bit more longer because Construct is loading all the images of the layout.

    Thanks it helped alot.

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