re4_tweaks icon indicating copy to clipboard operation
re4_tweaks copied to clipboard

Load textures faster

Open Mister-Curious opened this issue 3 years ago • 17 comments

Describe the feature you'd like to see added

It seems many of the rooms that have huge pack files take much longer to load. I'd love to see a way to optimize the loading times somehow. I really don't know much about how to engine processes the unpacking (other than to say I know that .lfs pack files take a little longer). Even without the .lfs compression it still can take a while to load bigger pack files. Here is an example:

It takes 15 seconds to load a room with 192MB pack file with an 8MB UDAS. Reducing the pack file size to 2MB makes the room load in about 1-2 seconds. So its obvious there is just a really slow moving process of unpacking, and loading those textures into memory.

Do you think there is a way to make this faster somehow?

Mister-Curious avatar Jul 09 '22 04:07 Mister-Curious

i've seen Qingsheng do this before, his dll would make the game load in less than a second even with HD Project textures/models. Maybe he can be of some help in this matter.

kTeo-0 avatar Jul 09 '22 06:07 kTeo-0

I don't think it is a texture problem. I use your transport room MOD. The 4400022c.pack file has 300MB. It is indeed very large. But I use the original R22c.udas file, the game's loading speed changes are not big. But I used your R22c.udas file. It has 18MB. This makes the game loading takes about 6 seconds. But no more than ten seconds

qingsheng8848 avatar Jul 09 '22 09:07 qingsheng8848

For example, we use Master ETM files. Its texture has 240MB. In fact, we don't need much time to load this file.

qingsheng8848 avatar Jul 09 '22 09:07 qingsheng8848

so I think this is a lot of time. Many pictures are loaded into the model at the same time, rather than reading the texture into memory.

qingsheng8848 avatar Jul 09 '22 09:07 qingsheng8848

qingsheng8848 avatar Jul 09 '22 10:07 qingsheng8848

https://youtu.be/DKnc387yFm4

qingsheng8848 avatar Jul 09 '22 10:07 qingsheng8848

I am very interested in how we are getting different results. All my tests show that it is the textures that make the rooms load slower. For example, I just loaded:

7.67MB udas with a 195mb pack file = 15 seconds to load 1.8MB udas with same 195mb pack file = 19 seconds to load

So yes there is obviously some extra loading time for the bigger udas, but not much, and not always either. Lets have a look at the difference now with the pack file (same scenario):

7.67MBudas with a 4.25 kb pack file = 5 seconds to load 1.8MB udas with same 4.25 kb pack file= 5 seconds to load

And you mentioned using Master files (like the ones we sidechain) Correct me if I am wrong, but arent these are loaded at game start, and not reloaded each time we launch the room? It least my idea of using 0f000001.pack does this (and this master ETM of Kteo created uses 0f000001.pack as well) This way, like 07000000.pack, the textures for master items are only loaded once, and stays in memory.

I would like to explore this further with you, and learn a bit about what you did in that video. Can you explain what is going on there? It looks like you loaded the Teleporter Room in a very fast way.

Mister-Curious avatar Jul 10 '22 10:07 Mister-Curious

@Mister-Curious, just to make sure: are you testing with or without raz0r's dll? His dll makes my game loading times slow down to a crawl for some reason.

nipkownix avatar Jul 10 '22 13:07 nipkownix

Bio4.exe + 2b051f. The hook of RAZ0R in this place caused the game loading time. We need to skip this hook

qingsheng8848 avatar Jul 10 '22 13:07 qingsheng8848

@Mister-Curious, just to make sure: are you testing with or without raz0r's dll? His dll makes my game loading times slow down to a crawl for some reason.

with the Companion DLL

Mister-Curious avatar Jul 10 '22 17:07 Mister-Curious

Bio4.exe + 2b051f. The hook of RAZ0R in this place caused the game loading time. We need to skip this hook

What are the side effects of skipping this hook? Does it prevent any functionality to avoid this hook? Is this the code for that?


------------------------------------
0F B6 C2 8D 14 40 8B 44 91 04 85 C0 74 02 FF D0 5B 8B E5 5D
Change To:
0F B6 C2 8D 14 40 8B 44 91 04 85 C0 74 02 FF D0 5B EB 1A 5D
------------------------------------
Find: 002AF938
Paste:
8B E5 5D C2 04 00 CC CC
--------------------------------------------------------------------

Mister-Curious avatar Jul 10 '22 17:07 Mister-Curious

You need to use ce to view this address. You will find that Raz0r wrote this at this address, Call dinput8.dll+xxx. We need to skip this call

qingsheng8848 avatar Jul 10 '22 18:07 qingsheng8848

@qingsheng8848 thanks, but I would really still like to understand what this call actually does, and what the side-effects of skipping this call would be in relation to the DLL's game functions. Like if we skip this call, does it break any functions?

Mister-Curious avatar Jul 10 '22 18:07 Mister-Curious

I think there is no impact. No strange things happen

qingsheng8848 avatar Jul 10 '22 18:07 qingsheng8848

I think there is no impact. No strange things happen

That sounds promising! I will test this out. Can do me a favor and confirm that the code I provided above (to be edited into the binary) is skipping that call? You could simply edit your exe with that code and then run your CE and compare I think.

Mister-Curious avatar Jul 10 '22 18:07 Mister-Curious

Im not sure that code I provided is helping at all as the load times for that room are exactly the same. Let me know what you find if you have the time. thanks

Mister-Curious avatar Jul 10 '22 18:07 Mister-Curious

@Mister-Curious, just to make sure: are you testing with or without raz0r's dll? His dll makes my game loading times slow down to a crawl for some reason.

I just tested the loading times without the Companion DLL (just for testing, as I am going to need this DLL for my mod no matter what), but found no significant change in loading time for the room I am testing.

So this leaves me to ask, are there any other options we can explore to make textures load faster?

Mister-Curious avatar Jul 10 '22 21:07 Mister-Curious