0 votes

So I have a simple 2D game that procedurally generates its maps. As of right now I only have a very basic terrain and trees generation.

Now, each one of these trees are created as scenes. This way the player can interact with them and it allows me to customize them more easily.
The thing is, with the world size I want (1024 by 1024 tiles), there are quite a lot of trees per world. Think thousands of individuals scenes (probably even tens of thousands).
This creates a lot of lag. Making the trees tiles allows the game to run at 60FPS, but with the way I'm doing it, it runs at around 24FPS.

How do I optimize my game to make it smoother? My guess is to only load the objects that are around the player, but I am not sure how to do that.
Also, I want to keep them as scenes if possible.

Godot version 3.4.4
in Engine by (17 points)

Thank you for that!

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.