HurricanGame / Hurrican

Freeware jump and shoot game created by Poke53280, based on the Turrican game series by Manfred Trenz
61 stars 22 forks source link

DisplayLoadInfo slows down loading. #70

Open Mia75owo opened 6 months ago

Mia75owo commented 6 months ago

I am currently working on a small level editor for Hurrican. I noticed that it loads a level within ~0.5 seconds so i tried to find the cause of Hurrican taking so long to load. Hurrican takes ~8 seconds for me to load on startup, but when i placed an early return at the top of the DisplayLoadInfo function (Gameplay.cpp:902), this time got cut down to ~1 second. I will maybe try to fix this issue when I have time for the Game again.

drfiemost commented 6 months ago

Hmmm, I see a timer.wait call there, it's just one msec but it may add up:

https://github.com/HurricanGame/Hurrican/blob/780878cad348c09c335af331fc3cd6c67ab5df87/Hurrican/src/Gameplay.cpp#L961

Another pause is in the InitNewGameLevel function, I wonder if it's really useful:

https://github.com/HurricanGame/Hurrican/blob/780878cad348c09c335af331fc3cd6c67ab5df87/Hurrican/src/Gameplay.cpp#L179

BTW, there is already a level editor in the sources, it just need to be ported to SDL2: https://github.com/HurricanGame/Hurrican/tree/master/Editor

thrimbor commented 6 months ago

It was probably done to make the loading feel more uniform and to give people a chance to read the loading screen tips. I guess it could be replaced by just keeping the loading screen displayed until a key is pressed, maybe with some text like "Press when ready"

Mia75owo commented 6 months ago

The problem is that for every loaded item a new frame gets displayed. This is affected by VSync. On 60 FPS the game can only load a maximum of 60 items per second. And i know about the level editor but it's very outdated and hard to port as it is based on the Win32 lib, so i think it would be easier to just rewrite it from scratch (also it's way more fun this way :smile:)

drfiemost commented 6 months ago

Ah, nice catch! If you use --novsync it's much faster. Maybe it is worth disabling vsync when loading a level?