Ikemen-GO
Ikemen-GO copied to clipboard
Loss of frame rate with debug mode
I've read that this would be fixed after 0.98.2, but it's still happening to me after compiling the latest versions, so I guess it's worth mentioning.
Whenever I activate the debug mode, I get a significant loss of frame rate, as shown here:
https://user-images.githubusercontent.com/107247004/174491906-3154612a-5068-4f83-98f5-498a3a404ae5.mp4
As a developer this is currently the most bothersome issue with the engine.
Seems the problem is caused by the debug console log.
POTS if you set DebugConsoleRows
in config.json
to 0 does the slowdown dissapear?
I forgot to mention that the more text there is on screen, the slower it gets. So that change in the config limits the problem but does not solve it.
Made a few more tests that will probably narrow down the problem:
-
Doesn't happen with "vanilla" Ikemen (although I need to disable OpenGL for that to even work)
-
I remembered that you mentioned some font rendering issue, so I tried adding a lot of text to the F1 message in the title screen and that also causes a slowdown.
-
One interesting thing when it happens is I can literally hear the hardware working harder. Like a humming sound that's not coming from the monitor. Also if I open the task manager, I can see that Ikemen Go normally takes up 7-8% of the CPU, but with debug mode on that number doubles. Memory usage seems to stay the same.
-
This should settle it: I tried Ikemen Go in my work laptop which is ironically slower but has a dedicated graphics card, and it does not happen.
So it's probably my Intel HD 3000. I know it's not a gaming laptop but it handles stuff much heavier than Ikemen without these issues.
I have a similar issue where there's a lot of frame rate drop on the character select screen, though in my case, it's only on the character select screen, nowhere else. On the release build, there's no such lag. I can also confirm that it's purely the binary, as I've copied over the externals folder to the release build folder, and there's no issues.
My personal hypothesis is that there's some optimization going on when cross-compiling, as the release build has builds for all operating systems. I'm going to try and get docker working, but it also seems that the image is outdated, as that uses Golang 15.0 instead of the now required 18.0.
Just to clarify, I have this issue with fonts both in 0.98.2 and the latest build.
Lastest build is 0.98.2...
I just noticed a random thing that may or not be useful, in that I don't have this issue with Ikemen GO 0.98.0
EDIT: Actually it's not 0.98 itself but the fact that it uses a SFF font and drawing those seems to be less demanding.
The engine does a draw call (that means, 1 CGO call + 1 GPU call) for every glyph displayed here, and that's quite resource intensive. Only feasible way to optimize this I can think of is to implement batching in the renderer. I'd like to implement that myself, but I still don't have enough knowledge on OpenGL to do that.
I wonder how hard would it be to code a software renderer.
Fixed by assemblaj's changes to font rendering (ikemen-engine/glfont#004).