Andrettin / Wyrmsun

Strategy game based on history, mythology and fiction
http://andrettin.github.io/
GNU General Public License v2.0
301 stars 47 forks source link

Improving atrocious loading times #166

Closed yac closed 2 years ago

yac commented 6 years ago

It's great that wyrmsun is pretty small, it downloads fast and doesn't take much space. It would also be nice if it loaded appropriately to its size.

However, a subset of 350 MB of its assets loads for a minute from SSD disk!?

Few suggestions to address this issue:

1) There should be a mechanism to pack assets files into a single (or few) resource file(s) during release and load assets from that(these) file(s) as opposed to calling system open() and close() thousands of times each level load.

2) Assets should be kept in memory during level resets as opposed to reloading everything file by file for no particular reason.

3) Loading screen doesn't need to refresh on every single file. I suspect it further slows down the process, not to mention there is no time to actually read the text as it changes very fast. Assets loading should run in a separate thread/process and loading screen should only seldom query its state and display currently loaded asset.

Andrettin commented 6 years ago

Assets are already kept in memory during level resets, they are only cleaned when the game exits (or when exiting the map editor). I cannot reproduce assets being wrongly cleaned from memory after a level reset, either (in my Windows build).

I agree that changing the displayed for every single file is not ideal, as often it goes by too fast and there's no time to read what is being loaded. I've changed that now with this commit: https://github.com/Andrettin/Wyrmgus/commit/f731bbaa58157ad4643abbd57466b1f04a0395f0

Packing assets wouldn't work well, because they are indexed to different palettes.

Andrettin commented 2 years ago

Loading times have improved a lot with version 5.0.0, so I'm closing this issue. Please feel free to reopen it if you disagree though!