SuperTux / supertux

SuperTux source code
https://supertux.org
GNU General Public License v3.0
2.5k stars 476 forks source link

SuperTux is very very slow #1051

Open communist1917 opened 5 years ago

communist1917 commented 5 years ago

Always, especially in levels with rain. OS: Manjaro Linux Supertux version: 0.6.0, installed from official repos.

qwertychouskie commented 5 years ago

What hardware are you on? Also there is a command line option to change the renderer, try the two options.

communist1917 commented 5 years ago

opengl — very slow sdl — much faster

qwertychouskie commented 5 years ago

Can you post the output of glxinfo | grep "OpenGL version" and glxinfo | grep Core?

communist1917 commented 5 years ago
$ glxinfo | grep "OpenGL version"
OpenGL version string: 4.3 (Compatibility Profile) Mesa 18.3.1
$ glxinfo | grep Core
OpenGL core profile version string: 4.3 (Core Profile) Mesa 18.3.1
qwertychouskie commented 5 years ago

What graphics card do you have?

communist1917 commented 5 years ago

NVIDIA Corporation GK208B [GeForce GT 730]

qwertychouskie commented 5 years ago

You probably need to use the official Nvidia driver, seems that reclocking support on that card is still WIP (see NVE0 on https://nouveau.freedesktop.org/wiki/PowerManagement/).

communist1917 commented 5 years ago

I have installed nouveau. Do you recommend to install proprietary video driver?

HybridDog commented 5 years ago

Maybe qwertychouskie meant the proprietary driver when he/she wrote "official".

qwertychouskie commented 5 years ago

Yes, sorry, that's what I meant. Unfortunately Nvidia cards and open drivers don't go well together.

HybridDog commented 5 years ago

I've tried to find out why rain reduces the framerate. I first thought that rain drop collision calculation is bad for performance, but when I disabled it, I still had low FPS. Then I changed the code so that the raindrops do not move. When the drops are drawn on the screen I have low FPS, and when I walked right so that the drops are not drawn, the framerate increases significantly.

The raindrop drawing works like this in each frame: Firstly, for each particle the draw_surface function is called. https://github.com/SuperTux/supertux/blob/ff4eff8b10b5ad80962689d427555a8b497d95f5/src/object/particlesystem_interactive.cpp#L65-L67 This function enqueues the texture, position, etc. in the drawing requests queue. https://github.com/SuperTux/supertux/blob/ff4eff8b10b5ad80962689d427555a8b497d95f5/src/video/canvas.cpp#L136 Then the requests are sorted and the drops are drawn one by one with the draw_texture function. https://github.com/SuperTux/supertux/blob/ff4eff8b10b5ad80962689d427555a8b497d95f5/src/video/canvas.cpp#L54

HybridDog commented 4 years ago

The tower_of_ghosts.stl level in the current ghost forest is so slow that I cannot play it: I get less than 10 fps. In the Editor I noticed that this is caused by the lava tilemap. @serano01, do you have the same problem? tower_of_ghosts_slow.stl.zip

serano01 commented 4 years ago

Weird, I do. This comes from the lava tilemap? Last time I played it, it worked.

HybridDog commented 4 years ago

After I have disabled the fire property of the two lava body tiles id 1700 and id 1705 in tiles.strf, I get a lot more frames per second. In the code I noticed that a PulsingLight game object is added for every lava tile; disabling its draw function or reducing the window resolution did not increase the framerate, so the lag is not caused by rendering. In this level, when the lava tilemap is not removed, there are ca. 2400 game objects (probably mostly PulsingLights); in another level there are only 240 game objects. Maybe SuperTux is very slow when there are many game objects.

Wuzzy2 commented 4 years ago

I can confirm that Tower of Ghosts is extremely slow in 0.6.1 beta 1. It's so slow it's almost unplayable. I estimate 5-10 FPS.

I noticed something is written into my console:

[WARNING] ~/supertux/src/supertux/sector.cpp:221 [/levels/world2/tower_of_ghosts.stl] Tried spawning Tux in solid matter. Compensating.
[WARNING] ~/supertux/src/supertux/sector.cpp:221 [/levels/world2/tower_of_ghosts.stl] Tried spawning Tux in solid matter. Compensating.
Ordoviz commented 4 years ago

@Wuzzy2 The warning is unrelated. It occurs when the spawnpoint is directly next to solid matter. I already fixed it: #1288

HybridDog commented 4 years ago

1301 #1300

HybridDog commented 4 years ago

I don't know if this is related: There seems to exist a bug with SDL_PollEvent(): https://stackoverflow.com/questions/53644628/sdl-pollevent-stuttering-while-idle (SDL_PollEvent in SuperTux)

tobbi commented 2 years ago

I've improved the rain speed in the latest nightly. Please re-test.

romulasry commented 2 months ago

Still having a problem on the latest:

supertux2 --version supertux2 v0.6.3

tobbi commented 2 months ago

Try downloding a version from here: https://download.supertux.org/

romulasry commented 2 months ago

That fixes it. By chance are you going to make a v0.6.4 so distros fix it earlier than 0.7.0?