sinbad / SPUD

Steve's Persistent Unreal Data library
MIT License
308 stars 45 forks source link

Hide preloader after restore #27

Closed shoooxz closed 2 years ago

shoooxz commented 2 years ago

So this is basically a question. How I can handle in a good way a preloader for streaming levels. Idea is to hide the preloader after all levels that are loaded with volumes (AddRequestForStreamingLevel) are restored . I am doing this by incrementing int variable on PreLoadStreamingLevel and decrementing on PostLevelRestore. Wondering is this safe approach.

sinbad commented 2 years ago

Perhaps you should explain exactly what you mean by a preloader, because it sounds like you mean just some visual indicator that loading is happening?

shoooxz commented 2 years ago

I hit load button, screen turns whole black, after loading is done, black screen is hidden and all sublevels (overlapped by character) are loaded with their state. Maybe I am approaching this in a wierd way :D

sinbad commented 2 years ago

OK so I do this in PostLoadGame right now, but I guess your point is when you have streaming levels they could still be loading because there's a delay? I see what you're getting at, although I'm not sure this way is reliable, since depending on timing you could get in before AddRequestForStreamingLevel is even called? Although a short delay would probably eliminate that. In which case your system of counting the streaming requests made in the first frame or so and waiting until they all finish loading is probably the correct one.

I have another system for handling the delay in streaming to prevent my character falling through the level (a ground probe) and I'd originally planned to do something simple like a fade-in time after that that's guaranteed to be long enough to handle streaming time. But your way is probably better.

shoooxz commented 2 years ago

Exactly, when the streaming level is still trying to restore the object there is still a window to interact with the not-restored-object. I believe if you are fast enough you can still see how items populate in a crate.

Thank you and regards.