Jump to content

Advanced scene loading


AggrorJorn
 Share

Recommended Posts

So basically I am wondering how people are handling their advanced scene loading. I can load a scene and remove the old one but it is not really looking all that nice. When I load a scene the game sort of 'freezes' during loading the new scene and deleting the old one. A loading screen is a way to blend out this freezing of the game but currently all I am able to is displaying that loading screen for a fixed couple of seconds. What I want to achieve is some kind of progress counter and display the loading screen during this loading the scene progress counter.

How would I make such a progress tracker? The first thing I am thinking of is checking whether the previous level isn't nil. But then how would I check that every object of the new scene is loaded?

Link to comment
Share on other sites

I would say:

  • Draw a loading image (texture w/e) all over the screen
  • oldScene.Free()
  • Scene.Load(...)
  • Stop displaying picture

 

This is what I have at the moment. But at the moment the load scene command doesn't tell me when the scene is done loading. Therefor I don't know were to stop displaying the loading images.

Link to comment
Share on other sites

This is what I have at the moment. But at the moment the load scene command doesn't tell me when the scene is done loading. Therefor I don't know were to stop displaying the loading images.

 

From what I have read, when people can see that progress is being made via a progress bar, most of them report the time they imagine they must wait is shorter.

 

If such a thing isn't in the engine, perhaps it could be a feature request for Josh?

Win 7 Pro 64 bit

AMD Phenom II X3 720 2.8GHz

GeForce 9800 GTX/9800 GTX+

4 GB RAM

Link to comment
Share on other sites

I just don't use LoadScene.

 

I have a file containing a list of standard items that are found on every level, which I will cache up front (Like weapons, characters, etc). Then for each individual level, I just the read the sandbox (editor) scene files manually, and load every item in it, with my own version of ProcessScene, which loads entities acting as geometry and items unique to a specific level. I know it's not called sandbox in 2.3 onwards, but because of the sbx file extension I will still think of it as the sandbox.

 

To do a progress bar, I cheat slightly. My custom level description file, holds key information: Like which sbx is the one associated for each level - it also says how many entities are stored in the sbx file. This means that I have to update that file every time I update the sandbox scene, and if I get the number wrong, two things can happen: 1, number too low, the final entities are not loaded. 2, number too high, the engine tries to load a null object - and crashes.

 

But it also means I know up front how many entities there are to load, so I can use a for loop, with the last lines of the loop being used to render a progress bar, but only if its been at least 50 milliseconds since the last render. This way, I have an accurate progress bar, and one that doesn't refresh at 500 fps when 20 fps is smooth enough for a progress bar.

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

@Rick: When the Loadscene command is being called it starts to load all the scene assets but in the meanwhile the program itself continues.

 

Have you verified? I am writing my game in C++ and have not done any explicit testing for this but as far as I can tell, LoadScene blocks the entire update/render loop and continues when it is done loading. I was planning on implementing a loading screen as Lazlo suggested earlier in this thread.

Link to comment
Share on other sites

@Rick: When the Loadscene command is being called it starts to load all the scene assets but in the meanwhile the program itself continues.

 

It does? And this is the normal LoadScene() that comes with LE? That would mean it's async and I didn't think it was.

Link to comment
Share on other sites

It does? And this is the normal LoadScene() that comes with LE? That would mean it's async and I didn't think it was.

 

I know certainly 2.0 that wait wait until it's finished load all child entities of the scene before continuing. So yes a static loading image would suffice. But when you have no idea how much longer it's going to take to load, and it already seems to have taken a while - as a player, I find that very irritating.

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

Could one just multi-thread the LoadScene() function? That would allow for one to do other things whilst the loading is happening provided one doesn't do anything that requires the scene to be loaded already.

Programmer, Modeller

Intel Core i7 930 @ 3.5GHz | GeForce 480 GTX | 6GB DDR3 RAM | Windows 7 Premium x64

Visual Studio 2008 | Photoshop CS3 | Maya 2009

Website: http://srichnet.info

Link to comment
Share on other sites

Could one just multi-thread the LoadScene() function? That would allow for one to do other things whilst the loading is happening provided one doesn't do anything that requires the scene to be loaded already.

 

There were a few threads about trying to do this, but no luck so far. It could be simulated with a custom LoadScene() however.

Link to comment
Share on other sites

I have no idea how to make advanced loading like mumbles discibes. I just want to get rid of that freeze before the level loads. It is not really a big deal atm, because the level is fairly small.

 

I've got a thread in the general programming board. A series of tutorials that I'm writing along side my first game, so that when it's finished. Any bits people like, they will know how to do them. Chapter 6 is the next next one to go up, and if it all works, it should show you how to load a scene with an accurate progress bar. The only problem is, it will be in C...

 

The biggest clue is to avoid LoadScene. Really, all that does is load an entity scene "container", and then models in the scene are loaded as children. But you could just load the entities one at a time with a for-loop since the sbx file is just plain text, it's easy read it manually.

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

The biggest clue is to avoid LoadScene. Really, all that does is load an entity scene "container", and then models in the scene are loaded as children. But you could just load the entities one at a time with a for-loop since the sbx file is just plain text, it's easy read it manually.

How would you set up the vegetation layers?

Intel Core i7 975 @ 3.33GHz, 6GB ram, GTX 560 Super OC, Windows 7 Pro 64bit

Link to comment
Share on other sites

How would you set up the vegetation layers?

 

The game I'm building doesn't use vegetation layers, so I had not even thought about that (which means it won't be covered in the tutorial chapter). But if that's normally done during LoadScene, then it should be stored in the sbx file somewhere. If can you see how it's stored, you should be able to adapt it to include those as well

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

In code you could pull out the vegetation layer and terrain from the sbx, and make a new sbx file with just those 2 things, then call LoadScene() on the new sbx file to just load those 2 things. Then do the normal looping through the original sbx for all the models.

Link to comment
Share on other sites

Doesn't Gamelib have its own ProcessScene() that handles veg. layers?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

Doesn't Gamelib have its own ProcessScene() that handles veg. layers?

I didn't find anything about vegetation management there, it has TScene::LoadMap which however calls the engine's LoadScene function and then processes with its own ProcessSceneInfo and ProcessScene methods for internal processing.

 

And I neither found no engine functions to load or set vegetation layers, so it seems that Rick's solution fits better (creating on the fly a new sbx file with only terrain and vegetation stuff).

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

So gamelib does not handle vegetation layers then?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

Sure it does, I'm working on a game with gamelib and the level artist is using vegetation layers only for vegetation.

 

 

So it handles the veg layers and iterates through the .sbx loading the entities in?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...