Jump to content

Progress Bar


Gandi
 Share

Recommended Posts

Hi!

I'm trying to implement some kind of progress bar for loading my scene.

My first attemt: Parsing the .sbx file and loading all the models/textures in the main thread separately und updating the image in between.

seems to work.. but as soon as i call LoadScene (after loading all the models/textures) there still comes a huge "lag".

Is there another way for something like that (i read multithreading doesnt work :-/ ) or any way of reducing this lag??

Link to comment
Share on other sites

Not really, LoadScene will block until it's done. Pretty much the only way around it is to save out two versions of your .sbx. One that includes only the terrain and terrain and vegetation, the other that includes all the models. Use LoadScene to load the terrain one since we don't have access to the commands to create the vegetation layers in code. This should load pretty fast. Then manually parse the model sbx and place everything in code, updating the progress bar in between.

Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX

ZBrush - Blender

Link to comment
Share on other sites

Just to clarify, you load all the models in the .sbx then call loadscene on the same .sbx? then reload all the models you have just loaded again? by lag do you mean the length of time it takes Loadscene .. to load the scene after you have already loaded the models from it? :)

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

Multithreading works fine with LE, you just need to keep all engine commands in one core.

You can still do OpenGL commands on another core, like drawing a progress bar.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Ah reading Nios reply I think I know what you meant ... sheesh I need more coffee ... :)

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

Multithreading works fine with LE, you just need to keep all engine commands in one core.

You can still do OpenGL commands on another core, like drawing a progress bar.

 

that sounds good ^^ problem is just: where do i know from how much i have loaded yet/how much is to be loaded, so i get the progressbar from 0%-100%....

Link to comment
Share on other sites

I thought there were issues with M/Threading ?

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

Do what Niosop said. And after you are finished share it with the rest of us ;)

 

It's kind of a pain, but take the sbx file and in code break it into 2 separate sbx files. One with the terrain and terrain vegetation and the other with all the other models. The call LoadScene() on the new sbx file that has the terrain and vegetation in it and then manually parse out the other sbx file that has the models in it.

 

I think that is the best we can do now, even though it sucks, once someone writes it we should all be able to use it. Then you would be a hero. Just allow a callback method that gets called after each model is loaded passing in the % done.

 

I'll eventually have to do this anyway so I might tackle it this weekend. I hate parsing files with C/C++ though.

Link to comment
Share on other sites

that sounds good ^^ problem is just: where do i know from how much i have loaded yet/how much is to be loaded, so i get the progressbar from 0%-100%....

As if progress bars ever progress correctly from 0% to 100% ;)

 

Write into a config file a precalculated loading time for the scene.

Based on that time, let the progress bar raise smoothly from 0 to 100%.

 

Once the scene is loaded, let the program write the new time it took to load the scene into the config file.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

You just want an sbx file?

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

What about this one:

 

SBX_ASCII_1.0

cameraposition=-996.086853,173.793823,1088.42566
camerarotation=28.3060379,-140.716492,-1.84892826e-007

Model {
path="light_directional.gmf"
position=-1849.46313,11.2851753,-717.718933
rotation=44.9999847,0.000000000,0.000000000
scale=0.999999762,0.999999881,0.999999881
id=52848904
"aligntoground"="0"
"class"="Model"
"color"="255,226,187,255"
"hidden"="0"
"intensity"="1.2000000000000000"
"linearoffset"="0.310000002,0.400000006,0.699999988"
"name"="directional_2"
"occlusionculling"="0"
"order"="0"
"range"="500.00000000000000"
"reloadafterscript"="1"
"resolution"="2"
"shadowdistance"="6.00000000,20.0000000,100.000000"
"viewdistance"="0.000000000,0.000000000"
}

Model {
path="light_ambient.gmf"
position=-1845.57458,11.3476744,-721.328125
rotation=39.9999847,0.000000000,0.000000000
scale=0.999999821,0.999999940,0.999999940
id=52854088
"aligntoground"="0"
"class"="Model"
"color"="0,64,128,255"
"hidden"="0"
"intensity"="0.22000000000000000"
"name"="ambient_1"
"occlusionculling"="0"
"order"="0"
"reloadafterscript"="1"
"viewdistance"="0.000000000,0.000000000"
}

Model {
path="environment_atmosphere.gmf"
position=-1733.76306,29.4907398,-663.747009
rotation=0.000000000,0.000000000,0.000000000
scale=1.00000000,1.00000000,1.00000000
id=52901704
"backgroundcolor"="127,127,127,255"
"brightness"="1.0"
"camerarange"="0.100000001,4000.00000"
"class"="Model"
"contrast"="1.0"
"fogangle"="0.000000000,15.0000000"
"fogcolor"="255,255,255,128"
"fogmode"="1"
"fogrange"="0.000000000,1000.00000"
"gravityforce"="0.000000000,-20.0000000,0.000000000"
"intensity"="1"
"name"="atmosphere_1"
"range"="10"
"reloadafterscript"="1"
"saturation"="1.0"
"skymaterial"="FullskiesBlueClear0016_2_L.mat"
"volume"="1"
}

Model {
path="firepit.gmf"
position=-982.700012,147.000000,1071.50000
rotation=0.000000000,0.000000000,0.000000000
scale=1.00000000,1.00000000,1.00000000
id=52856392
"class"="Model"
"intensity"="1.0"
"name"="firepit_1"
}

Model {
path="firepit.gmf"
position=-974.000000,145.100006,1072.59998
rotation=0.000000000,0.000000000,0.000000000
scale=1.00000000,1.00000000,1.00000000
id=52853512
"class"="Model"
"intensity"="1.0"
"name"="firepit_2"
}

Model {
path="firepit.gmf"
position=-960.400024,141.900009,1068.20007
rotation=0.000000000,0.000000000,0.000000000
scale=1.00000000,1.00000000,1.00000000
id=52855240
"class"="Model"
"intensity"="1.0"
"name"="firepit_3"
}

Model {
path="vehicle_monstertruck.gmf"
position=-987.200012,148.100006,1068.00000
rotation=0.000000000,0.000000000,0.000000000
scale=1.00000000,1.00000000,1.00000000
id=52856968
"class"="Model"
"collisiontype"="1"
"intensity"="1.0"
"mass"="1"
"name"="monstertruck_1"
}

Model {
path="vehicle_viperscout.gmf"
position=-984.600037,147.800003,1081.40002
rotation=0.000000000,0.000000000,0.000000000
scale=1.00000000,1.00000000,1.00000000
id=52855816
"class"="Model"
"collisiontype"="1"
"intensity"="1.0"
"mass"="1"
"name"="viperscout_1"
}

Model {
path="vendingmachine.gmf"
position=-985.200012,147.699997,1069.59998
rotation=0.000000000,0.000000000,0.000000000
scale=1.00000000,1.00000000,1.00000000
id=52852360
"class"="Model"
"intensity"="1.0"
"name"="vendingmachine_1"
}

Model {
path="windmill.gmf"
position=-978.700012,146.400009,1074.30005
rotation=0.000000000,0.000000000,0.000000000
scale=1.00000000,1.00000000,1.00000000
id=52852936
"class"="Model"
"intensity"="1.0"
"name"="windmill_1"
}

Terrain {
altitude=500.000000
resolution=2048
meterspertile=2.00000000
hiddentiles=0

texture0="terrain_mountain_grass.dds"
bumpmap0="terrain_mountain_grassdot3.dds"
texturefit0=0
texturescale0=2.00000000
texturerotation0=0.000000000
triplanarmapping0=0
layercolor0=1.00000000,1.00000000,1.00000000,1.00000000
constraints0=0.000000000,8388610.00,0.000000000,90.0000000

texture1="terrain_mountain_snow.dds"
bumpmap1="terrain_mountain_snowdot3.dds"
texturefit1=0
texturescale1=2.00000000
texturerotation1=0.000000000
triplanarmapping1=0
layercolor1=1.00000000,1.00000000,1.00000000,1.00000000
constraints1=0.000000000,1000.00000,0.000000000,34.7999992

texture2="terrain_mountain_ice.dds"
bumpmap2="terrain_mountain_icedot3.dds"
texturefit2=0
texturescale2=2.00000000
texturerotation2=0.000000000
triplanarmapping2=0
layercolor2=1.00000000,1.00000000,1.00000000,1.00000000
constraints2=0.000000000,8388610.00,3.09999990,90.0000000

texture3="terrain_mountain_rockwallsnow.dds"
bumpmap3="terrain_mountain_rockwallsnowdot3.dds"
texturefit3=0
texturescale3=32.0000000
texturerotation3=0.000000000
triplanarmapping3=0
layercolor3=1.00000000,1.00000000,1.00000000,1.00000000
constraints3=0.000000000,8388610.00,30.0000000,90.0000000

texture4="terrain_mountain_rockwall.dds"
bumpmap4="terrain_mountain_rockwalldot3.dds"
texturefit4=0
texturescale4=64.0000000
texturerotation4=0.000000000
triplanarmapping4=1
layercolor4=1.00000000,1.00000000,1.00000000,1.00000000
constraints4=0.000000000,8388610.00,35.0000000,90.0000000

vegetationmodel0="vegetation_tree_spruce_2.gmf"
vegetationaligntoterrain0=0
vegetationrandrotation0=1
vegetationrandtilt0=0.000000000
vegetationrandscale0=0.000000000
vegetationdensity0=8.00000000
vegetationcastshadows0=2
vegetationloddistance0=100.000000
vegetationviewrange0=2000.00000
vegetationminslope0=0.000000000
vegetationmaxslope0=30.0000000
vegetationminheight0=0.000000000
vegetationmaxheight0=1000.00000
vegetationbillboards0=1
}

 

 

Just the Artic scene with a few models added for good measure?

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

Perfect, thanks. I can work on parsing it out into 2 separate files at work over lunch.

 

You know looking at this, I think I might even just break out each section into it's own file and call LoadScene() on that file. It would just be 1 file that keeps getting overwritten, but it's nice and easy because then I don't have to write the loading code for the models. LoadScene() will handle that but each sbx file I sent it will just have 1 model/terrain at a time.

Link to comment
Share on other sites

Well good luck ... try and avoid Indigestion lol

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

I'm able to live with that. I don't think the Terrain takes all that long. Plus it can be viewed as a model like any other. I don't think the goal here is to make it multi-threaded so there is no freeze, instead we make it so between model loading (freezing) we can update the screen with a progress bar. So yeah, there will still be freezes when loading a model but because we are able to just load 1 model at a time we can update the screen in between.

Link to comment
Share on other sites

I don't think the Terrain takes all that long.

 

 

What about the 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

Even still. Each model can be loaded individually first so you see the progress bar moving, then load the terrain last. At that point the user is at least seeing a visual update of each loaded model. Then load the terrain last. Even if it takes slightly longer it's not a big deal at that point. The user knows the load is almost finished.

 

The only startup delay would be parsing the original sbx file and that should only be a few seconds.

 

I so wish the sbx file was in xml format btw. Would be so much easier to parse.

Link to comment
Share on other sites

I have always found that heavy veg layers even just a single distributed grass layer takes alot long to load than all the models .. mind you... so do fonts lol

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

If you get it working, it could be used also to read a scene from a SQLite database, and also used to write it back. Then you are quite close to streaming of huge scenes also.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

I have always found that heavy veg layers even just a single distributed grass layer takes alot long to load than all the models .. mind you... so do fonts lol

 

And that's ok. Progress bars aren't always smooth moving. In fact very few of them are. Think of each model & terrain as 1% of the total. You put up a splash screen with a 2D picture on it and then after each model/terrain gets loaded a callback is called and after that the screen is rendered & flipped so it shows the updated progress bar after each model/terrain is loaded. For things that take longer to load there will be a longer delay.

 

I'm aware this approach won't allow you to have a constantly moving thing on the loading screen because it will still freeze while it loads a model, but it does give a break after each model is loaded which is far better than what we currently have. Right now you put up a picture and it sits for 4 mins while the user thinks his game froze.

Link to comment
Share on other sites

I understand what it is you are trying to do, I was just thinking what if the models load in a few secs .. and the terain with veg layers takes 20 ... isnt this dependent on there being enough models ? or would you have to artificially slow down the load to make it "viewable"?

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

isnt this dependent on there being enough models

 

As long as you have 1 model in your scene and we do the terrain loading last you'd see your progress bar go to 50% complete after it loads the first model. Then it would sit there for maybe 30 seconds to load the terrain. You would still get a visual right away, but a small one in this scenario.

 

But honestly if you only have 0-1 models and a terrain in your scene then you wouldn't be worrying about load times in the first place ;)

 

 

 

or would you have to artificially slow down the load to make it "viewable"?

 

Are you thinking the progress bar would constantly be moving? I guess I don't know why you would need to slow it down. If you have so little of stuff that it loads fast enough then you wouldn't worry about a loading screen.

Link to comment
Share on other sites

ok, my question only being that BMX supports function overloading..

 

Why not ask josh to put in an overload function for the LoadScene() where you can pass a blank variable, and it will return what is being loaded to that variable, and then just run check on what that variable is at any given time, then update your load bar accordingly?

 

 

Maybe its stupid, I don't know, but just a thought.

 

Could even ask how many objects are in the SBX, and then do a count down?

AMD Phenom II x6 1100T - 16GB RAM - ATI 5870 HD - OCZ Vertex 2 60GB SSD

76561197984667096.png

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...