How to load part of the map or objects when you reach at a certain point? for performance reasons

have you set the behavior “destroy when off screen” ?

no, let me try that…

That behavior “destroy when off screen” is another way of optimizing I will use that later, but why is “external layout” slowing my game that much rather than make it fast

I don’t know how your events are structured but you may need to limit the loading of the external layout.

For example, if the layout loads on collision with a character, and your character is in collision for 2-3 seconds, Gdevelop could be trying to load the layout every frame. You may need to add a way to limit the loading, with trigger once or a variable.

Maybe, i was thinking of that too

I have added when scene variable score is greater than 5 create objects from external layout

Yes! got it it was loading it every frame, as soon as i set to create external layout when equal to variable 5 it loads once now, problem solved, thanks for your time

1 Like

Just a precision which can help you: it’s not because the size of your scene is about 3000x3000 or more that you are in the obligation to do a 3000x3000 background! You can divide the size of your background (in external layout or not) in smaller objects size you can then manipulate with your events.
Thus, GD will react more quickly.
I used this method for my Canabalt game.

2 Likes

You know how to remove external layout?

You can delete the external layout in the start page

No Im saying how to remove during gameplay, for better performance

For example to load we use “Create objects from external layout” so what’s the command to delete or unload it

1 Like

I don’t know if there is a action like that because I did not see that. But, you could use the destroy when outside of screen function or something like that.

The problem with “destroy when outside of screen” is does not load back again when i go back to that place which is destroyed.

So is there any way to reload it?

I will test and play with loading and saving parts of the scene because I am also looking for this and let you know when I am done. :wink:

1 Like

Tell if you find a command to which destroys & reloads objects. If there is not we should request to add the feature in the update of Gdevelop. Because it will allow to create larger levels without thinking about gameplay performance

1 Like

You can add a variable to each object on the external layout to mark it as being on the external layout. Then simply add a condition to check or that variable.

2 Likes

Sorry that I haven’t responded in a while. The thing is I did not get the time to fully play with it as I was switching to another OS and was busy setting up things. but, I promise I will be giving you a answer ASAP. Sorry for the delay.:slightly_smiling_face:

Read my newer whole post to fully understand what It is needed it for

Where? Did you post it here?

I though u replied after seeing the new one Here