Game vs. Editor performance

I’ve found that the Terrain example is quite slow in my old computer*: about 3-10FPS. The weird thing is that inside the editor it runs way faster (I don’t know how much but it is playable). Anybody can explain why?


[*] I have two computers: the new one runs the example in 60-90 FPS but I’m interested in why the example runs slower than in the editor, specially since it has almost no code in the view controller!

Hm, this difference is weird.

Editor and run-time should generally have the same performance, esp. since (as you also mentioned) in this example, the code of GameViewMain unit in examples/terrain/ does pretty much nothing. Editor and game should also initialize the same OpenGL context with the same parameters (though the initialization goes through a bit of different code, TCastleWindow in one case, TCastleControl in another; but the parameters and end result should be the same).

Note: You can use F8 in editor (menu item “Edit → Show Statistics”) to see FPS (and some other info, if a viewport is selected / hovered over) in editor.

Test you can do:

  1. In game (e.g. in GameInitialize initialization section) set LogGLInformationVerbose:=true (this is global variable in CastleGLUtils unit). Run it, look at OpenGL report in the log ( Logging | Manual | Castle Game Engine ).
  2. In editor, look at OpenGL report in “Help → System Information”.

Compare them. If they are not equal, we’ll have to understand why :slight_smile: If they are equal, then I really don’t understand why the FPS is different.

Oh, another test: run game in “release” mode. This can change drastically the speed of CPU (Pascal) code… though it should not really matter for examples/terrain/ , that is mostly just rendering a mesh of GPU.

Note: I know of one drawback of current examples/terrain/ that I want to address soon, by accident current approach with Triangulate = true can produce a lot of draw calls. With Triangulate = false it is always one draw call, much better. That said, for my systems, this difference doesn’t matter with default terrain settings in examples/terrain/, they all render with 60 FPS.

In my case it makes a big difference if the editor is open in full size or is minimized during running the game. OS is Windows11.

Thanks for the answers. I think I’ve found the reason.

It runs in the editor exactly at double FPS. So the problem is that I’m running them at the same time. When running the example with the editor closed it runs at 7.5 FPS most of the time. Still slow but much faster.

So mystery solved. And I’m a bit ashamed for the silly question. :sweat_smile:

1 Like