I'm trying to optimise my game but I don't really understand the profiler.

In this image Frame Time is 136ms but even if I add up all the times beneath the result is much much lower, so what does Frame Time actually mean?

  • xyz replied to this.

    ainc You didn't show the complete breakdown. There's more items on that list. What's your script functions time?

    • ainc replied to this.

      xyz It was a few ms at most. I tried it again, got 180ms Frame Time and 1.28ms on Script Functions. I can see something is wrong with Physics Time but it shouldn't be that bad

      • xyz replied to this.

        ainc Make a project copy and start removing parts from it until you hit the thing that's causing it.

        • ainc replied to this.

          xyz Well, I hoped I wouldn't have to do that if I use the profiler. It did point me in the right direction at least, the problem was physics related. I use a somewhat complex mesh for the world and I had to check if an enemy is on the floor using test_move() instead of is_on_floor()(for reasons). Instead of doing that I added an Area3D and check if it has overlapping bodies, which seems to work just fine and the lag spikes are pretty much completely gone. Now I just need to figure out how I can make the world collision mesh simpler or split it into multiple parts, not sure if that will actually help though.

          7 months later

          I have similar issue on Godot 4.3. Profiler shows lik 80ms on process time but all the other are like 0.02. Someone knows why this happens?

          • xyz replied to this.

            xyz like on each script that has _process()? I assumed profiler existed to directly tell you the script. I have like a lot of script that use process() hhahh

            • xyz replied to this.

              That's my issue. The scripts listed there don't sum up to even 2ms. and process says 30ms

              • xyz replied to this.

                6monkey9 Then the native code is using a lot of processing time. Check your total node count, look for types of nodes that may need to handle a lot of data per frame. Hard to tell precisely without seeing the overall structure of the project and what the scripts are doing. Looking at the Monitors in the debugger may also give you some clues.

                  xyz Checked the monitor... are those numbers normal? Thanks for the help btw.

                    6monkey9 I just deleted like two viewports with a camera inside, and gained like 60fps... ridiculous hahha idk exactly why