We-the-People-civ4col-mod / Mod

This is the repository where the mod resides.
90 stars 37 forks source link

Cleanup art to make the game start faster #211

Open Nightinggale opened 6 years ago

Nightinggale commented 6 years ago

There is an issue with the civ4 engine where it waits forever before even opening a window when starting. For some reason it starts much faster if you quit and start again. It's not mod specific and applies to BTS as well as Colonization.

Based on information from the BTS modders and personal experimentation, it turns out that the exe is doing something with Art, more specifically nif and dds files. (kfm too?). Whatever is causing this, it's directly related to the number of files and it's slower than O(n).

If we do all of this, the game will start noteworthy faster, but it will likely also reduce memory usage, which is great considering we are stuck with 32 bit address space.

I propose

Remove unused files

This one is obvious. Do some scripting to locate files not used by any xml file.

Remove duplicates

If two units use the same animation, make them use the same animation file in the art xml file. Moving as many units as possible into using the vanilla free colonist animation should help a lot.

Group buttons

Vanilla group button art into one dds file with multiple buttons and then add x,y coordinates to xml. We should figure out how to do the same. Example vanilla file Assets\Art\Interface\Buttons\BaseTerrain_TerrainFeatures_Atlas.dds

orlanth commented 6 years ago

Would it help to pack art into a single FPK file with PakBuild?

https://forums.civfanatics.com/threads/civ4-pakbuild.136023/

Nightinggale commented 6 years ago

It would help, but it's a tradeoff. First of all, packing files conflicts big time with git and results in huge repositories, meaning it can be considered for releases, not a development versions. Secondly packed files does something memory related, meaning there are crashes, which only happen with packed files. Last packed files copies everything into memory, even the files, which are read from the disk when needed, meaning it wastes memory. Wasting memory is no good in a 32 bit game as we have limited amount of memory addresses.

This sums up why RaR never packed the files and I'm not too happy about packing either. Even if we do end up packing for releases, it would be good to speed up the development version.