Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DisplayLoadInfo slows down loading. #70

Open
Mia75owo opened this issue Dec 20, 2023 · 4 comments · May be fixed by #72
Open

DisplayLoadInfo slows down loading. #70

Mia75owo opened this issue Dec 20, 2023 · 4 comments · May be fixed by #72

Comments

@Mia75owo
Copy link
Contributor

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
Copy link
Member

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

Timer.wait(1);

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

Timer.wait(1000);

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
Copy link
Member

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
Copy link
Contributor Author

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 😄)

@drfiemost
Copy link
Member

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

@Mia75owo Mia75owo linked a pull request Dec 22, 2023 that will close this issue
@drfiemost drfiemost linked a pull request Sep 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants