Gdevelop 5 Ingame Performance

Helloooo i am currently making a minecraft 2d like game and there is a large amount of Objects wich causes the game to lag. I don’t know how i can make it smoother, does anyone know how to do it? In my game there isn’t currently too much object (3000+) but i wanna make the world deeper that meens more objects wich causes the game to lag. Cause every stone is its own object. so you can destroy them.

I also uploaded the game to Itch.io.

This have very factors (Just i know 2):

1- (Your PC) The game performance, is adapted to your computer possibilities… I mean, you have old PC and very bad GPU, wifi and others, don’t mean other players (have better PC) have same problems, probably the performance is normal.
2- (Events) You said Minecraft 2D right? How many distance disappear the items? How many items or events you have “objects” stored or in the background in the same time or in scene?

At the moment these 2 factors are the ones that I am aware of that have a real factor in the performance of your game

I dont have items but the objects dont dissepear in a distance i dont know how to do it. The only behavior all of them have is the “Platform” behavior

can you share the game link?

Do they need a platform behaviour? Because they aren’t really platforms and I think that behaviour has an associated processor cost. I’d suggest that instead just check for a collision between the player and object and move the player away.

In “events”, it has two parts, the Conditions and the Actions. In actions you can write in the search engine “delete” and relevant events of your search appear, search and apply the most comfortable event to your project or adapt them with other events.
And you have a behaviour called “Destroy when exit the screen”

And minecraft use “Entities” to call the Objects you can manipulate.
Behaviours:
“Object move in platforms” Player
“Platform” Physicals items you can’t move or break (Bedrock in minecraft)
“Path finding” Enemies detect player
" Physical motor 2.0" This in concrete isn’t obliged, just you can look like “other form to create the game” (Warning) this behaviour is difficult to understand so please look the tutorials.

And the last thing combinate the events with Extensions and Variable to do the game more faster and easy

Why do you have Gdvelop in Spanish, I find it confusing.

About what behaviour you can use


The number of objects shouldn’t make a difference. If it’s a number of objects that are repeated, and those objects aren’t huge, then it should be OK. GDevelop doesn’t draw all the objects, just the ones on the screen.


The problem with destroying objects when they’re off screen or a distance from the player is that they need to be recreated when the player gets to the location of those objects.

Each object’s position, rotation, colour, animation, frame, scale, opacity etc needs to be recorded and kept. Otherwise the world changes constantly, which is not what MineCraft does.

I’ve made a very simple project that randomly placed 3,000 platform objects in the scene. It runs a tad slower according to the performance profiler, but nothing that’s visibly noticeable (7ms per frame vs 10ms per frame).

There was a notable slowing down when using 30,000 platform objects however (around 50ms per frame, so 5-7 times slower).

So given a few thousand objects don’t really seem to have an impact, the lag could be to do with your events. Can you provide screen snippets of your game events?

And BTW, that link is just to the itch.io web site, and not to your game.

I looked with the Performance profiler and i think it is because of the events. The Events costs 30 ms per frame. I tried making it less but it didnt work because the events that costs 30ms per frame are constant looking for the position of the cursor and if the mouse is clicked. These are events for placing, destroying and Fighting. It doesn’t work without the Platform behavior, cause the player won’t jump on them or the player is always falling. I am using the behaviors that you recommended expect for enemies, i am using the platformer behavior for them. Also there are events that are doing the lightning because i don’t like the normal gdevelop lightning and i made it that it repeats only 0.1 second and every 0.1 second the game is lagging for a millisecond.

Yeah, I kinda figured that one out myself when testing. Sorry for the bad advice :expressionless:


30ms is high. Are you using event groups to pinpoint the events that do take up most of the processing time?

If you want to share your project, I can have a look and see if there are any obvious processor improvements that can be made. Drop a link here or PM me if you’re comfortable with this.

Yeah i am using event groups tell me if i should send you the project