My 3D game lags a lot

Godot Version

4.3

Question

Im making a 3D horror game, the graphics are normal, and it lags a lot, it goes like in 10 FPS or less wich isn’t good, i optimized my game by ussing oclussion culling advanced frustum culling, the texture resolution getting lower when you go further away, godot jolt, advanced LOD, superscaling and still lags

I’ve had this happen to me once, and I can say that you can solve this problem by reducing the size of the files you’ve used in the game.

While building my game, I noticed that there was a 2GB sprite in the game, and when I deleted that sprite, the game’s lag went away.

they are all some kilobytes(KB) so that’s not the case

You’ve got the visual profiler up, looks like there are ~ 5 distinct contributors, can you scroll through and look for any high-value sections? Are you using baked lighting?

Good, you will only need to bake one Occlusion culling node

This is called mipmaps, it’s pretty important for reducing grainy textures but actually slightly increases VRam usage. Not really an optimization, should be automatic so i hope you did not write your own version of mipmaps.

Shouldn’t have impact on the visual profiler

This will make your game run worse, use a 1:1 render resolution or lower to improve framerate.


You can also use the “Perspective” menu to check a wireframe view, this will help you find high-density models see where your polygon budge is going. And check the overdraw view to see if your occlusion culling is working correctly.

One thing you might consider is dropping the quality of some of your assets. It’s good to have a game that looks really realistic, but for most people suspension of disbelief kicks in fast. In most games, once the player has been in the game for a few minutes, they care a lot more about a decent frame rate and control responsiveness than visual fidelity.

Ideally you can have visual fidelity and a good frame rate, but if you have to make a tradeoff, an uglier game with a solid frame rate is preferable to a pretty slide show.

All that said, there’s a variety of stuff that could be going on. How big is the scene you’re rendering? Are you doing anything with transparency which might be forcing the game to render a lot of stuff that doesn’t actually make it to the screen? What resolution are your textures? In terms of orders of magnitude, how many vertices are you throwing at the screen in your meshes? Are you doing anything complicated (or expensive) in shaders?

1 Like

I recently watched this video Optimizing my Game so it Runs on a Potato

It’s more of a devlog than a detailed tutorial, but it might give you some ideas for optimising your game.

Do the lags happen both in fullscreen and windowed mode?

Did you import a mesh from a modelling software and make a collision shape from it? Over detailed collisions might impact the frame rate.

still the same, btw i made a new project, with better graphics and it runs better, its really weird