Armory: Please add game level progress bar example

Created on 9 Dec 2017  路  9Comments  路  Source: armory3d/armory

Is it possible to display progress bar when the game level or scenes is loading or changing ?

If it is possible, can you add an example? If not possible currently , can it be implemented ?

Most helpful comment

Added an example on custom loading screen:
https://github.com/armory3d/armory_examples/tree/master/load_screen

Armory hands you info on assets and a graphics object for drawing onto screen:
public static function render(g:kha.graphics2.Graphics, assetsLoaded:Int, assetsTotal:Int) {}
https://github.com/armory3d/armory_examples/blob/master/load_screen/Sources/arm/LoadingScreen.hx

All 9 comments

A progress bar could be achieved in several different ways.

You could have a 2d sprite or a 3d object which is scaled from 0 -> 1 on one axis based on the progress in the game. Or you could use Zui with a slider, see example ui_script2d.

@guzzard , sure!. But how do you make it updated in realtime. I mean how do you update the value of the progressbar while the scene is loading. Since you need to get the total of assets in that scene and also the total of assets that is already loaded by the engine.

Unless of course you are talking about fake progress bar? It is okay but I would rather just put "Please wait" with an animated sprites for that.

Hi @takhimi, sorry I meant an in game progress bar which you have control over since you know the winning condition and how progress is made etc.

Regarding a loading progress bar I think @luboslenco can let us know how it works, since there is a loading bar present when starting HTML5 builds in the browser. If the connection is slow, or the project is big you can see it.

bar_slow

@guzzard , thanks for your help man. Yeah I meant the loading progress bar for the scene. Hopefully at least we can have some condition or status that we can check and know if the level is completely loaded and ready. Maybe not important for small game or levels but It would be useful for large or big projects.

When a new scene is loaded the Scene.active.notifyOnInit() function is always run once the scene has finished being constructed. See under trait events here.

Wow! Didnt know about that though. That is really interesting. Right now I should start doing some game prototype instead of just playing or testing the engine. :)

I guess I could use the "please wait" with rotating circle animation currently.

Thanks

@takhimi here is how the progress bar is calculated: https://github.com/armory3d/armory/blob/master/Sources/armory/trait/internal/LoadBar.hx#L12

Main.projectAssets - number of assets to load
iron.data.Data.assetsLoaded - number of assets which has been loaded

Thanks @guzzard . Awesome job. WIll need to dissect the examples and codes more.

Added an example on custom loading screen:
https://github.com/armory3d/armory_examples/tree/master/load_screen

Armory hands you info on assets and a graphics object for drawing onto screen:
public static function render(g:kha.graphics2.Graphics, assetsLoaded:Int, assetsTotal:Int) {}
https://github.com/armory3d/armory_examples/blob/master/load_screen/Sources/arm/LoadingScreen.hx

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mushroomeo picture mushroomeo  路  4Comments

donalffons picture donalffons  路  4Comments

luboslenco picture luboslenco  路  3Comments

donalffons picture donalffons  路  3Comments

SeleDreams picture SeleDreams  路  3Comments