Mittwoch, 21. Juni 2023

It's 2:19 am

It's 2:19 am. And I am sitting here. 

For the last 6 hours I have been trying to figure out why the framerate dropped by 20 FPS after I finished the rook fight.

The Rook's Playground was probably the biggest and most complex thing I ever accomplished. And it looks amazing. And the framerate was stable yesterday. And now it's not. And I don't know why.

It's 2:22 am.

I load UE4 for the thousandth time. On a clear map, without any assets. With the editor open, my regular background BPs for atmosphere and weather running in the back I get 45 FPS. It's not great, but it's OK. The problem is, at the beginning of this year I used to get 60 FPS.

I open section 06, which isn't complete yet, it's mostly empty terrain with light foliage. 43 FPS.

I place the Rook's Playground. 22 FPS.

I remove the Rook's Playground, save, rebuild lighting and test it. 22 FPS.

It makes no sense. Something that is no longer there, can't hurt the framerate.

It's 2:26 am. I load the maps again, but forget to pre-load them before testing. The maps won't load. I force quit UE4 and reload it again. 

A fly is in my room and it's huge. I want to catch it in a glass to put it outside, but it resists all attempts.

I check GPU usage after loading the map. GPU is at 54%. The framerate is suddenly 34 FPS. Stat Unit shows that GPU is the bottleneck. How can the GPU be the bottleneck if it's at 54% usage.

I remove all blueprints from the environment. Everything, loading zones, Yama's store, hideouts, items everything.

It's 2:36 am. There is no peace, there is no rest.

After removing it all the framerate is 35 FPS. Marginal improvement.

I close UE4 again.

There is no peace. There is no rest.

The room is hot and humid from the recent weather. I can't open the windows or thousands of insects will come inside.

I know I won't sleep. There is no sleep.

I open UE4 again and load the maps. FPS suddenly changed to 39 - 40 FPS average. I didn't change anything. It makes no sense.

Over the last 2 months FPS has steadily decreased, but very slowly. Then the FPS drop after the Rook's Playground. It makes no sense. Why did the FPS decrease in the first place?

I figured the size of the session must have played a role in this. It grew with each model library I added and implemented. But if the size of the session and the number of assets were the main factor, Task manager wouldn't show just 10GB of Ram usage in the editor.

There is only one explanation and it's not pretty. The code is bloated across hundreds of actors. The Rook's Playground is also the biggest code I ever wrote. The FPS dropped after I added trees and foliage around it. There's a chance it already put a strain on performance, but I only noticed after adding environmental assets.

I have the compulsive need to do something. But the problem is too complex to fix right away. So I clean up the session, put assets in named folders and make the folder structure look neat.

It's 2:58 am.

Waves of desperation are hitting me. I know them well. The key is to just ignore it and try to get a good grasp of the original problem. Testing, testing, testing .....

If the issue is caused due to bloated blueprints, then they need to be slimmed down wherever possible and it can also be solved by spawning and destroying individual blueprints based on player proximity. But each blueprints state needs to be preserved, so that items can't be picked up twice in short succession. More loading zones would also help. But that means I'd have to rework the level loading structure again. Without having the certainty that this will actually fix the issue.

I used the debug camera to check loading distances and culling and it's textbook perfect. Everything disappears in viewing range and in many cases even earlier (which is not a good thing and should be fixed, but increasing those values costs performance).

It's 3:04 am.

I wait for UE4 to clean the old references of the files I just moved into folders.

A thought occurs ... I often created copies of old blueprints and left unused variables in there. I should clean those up as well. But then again if they were the main cause, I'd see improvements after removing those blueprints. And improvements have been marginal.

I don't know. I fucking don't know. Can't afford to delay. Can't afford to sleep. I can't betray my schedule on the development again. I've done it so many times. My only excuse is that I didn't know the engine well enough and that's why I made so many mistakes. But now I do. And I still don't get it.  

UE4 is done clearing the files and registering all the references. I test the scene again.

No fucking way. 50 FPS.

Again, it makes no sense. Clearing files and references that are NOT PART OF THE LEVEL I'M TESTING SHOULD NOT AFFECT FPS.

I test a weird blueprint system that replaces large complex BPs with a simple copy of the same BP that is just a mesh and spawns in the complex one if the player approaches it.

Map with complex original BP: 37 FPS

Map with fake spawner BP: 42 FPS

Hmmmm ....

It's 3:32 am.















Keine Kommentare:

Kommentar veröffentlichen