Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / animating load screen

Author
Message
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 25th Sep 2017 18:09
My games typically load some assets when starting up. Sometimes this takes a while.

What are good methods for building a load screen other than showing a static image and starting some music?

I have previously used the static image and another version with a progress bar building up and updated as different assets are loaded. But it gets tricky managing the bar length vs assets, and updating it is quite jerky.

For example, any features for automatically having AppGameKit fade between a few screens? Like "XYZ Games presents" wait 3 seconds, ... "The ABC game" ... ? Then have some command to move forward when assets are loaded?

Or how do you all do this?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 25th Sep 2017 18:47 Edited at: 25th Sep 2017 18:51
if you not know the count you can use % and think in steps, so 10 steps doing something are 100%.
+ make a ProgressTick function to do some animation.
i would make a progress modul (insert file into main), make a start/stop/step/tick/fade command and save progress data (sprites etc.) in a type/struct.
for screen fade maybe use a dynamic array and fill it at start, so the update function can choose after time x and iterate through.
AGK (Steam) V2017.08.16 : Windows 10 Pro 64 Bit : AMD (17.7.2) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 25th Sep 2017 19:32
Thanks Markus. The problem with that is that I would have to time asset loading to have sync() produce a consistent frame rate. Was hoping for something simpler, like tell AppGameKit to show a picture for 3 seconds, then automatically fade to pic 2. Then just load all assets in parallel without worrying about syncing..

I tried to look at tweening since somehow I had a thought that might be something useful. But could not find any tutorials on it, just a long list of commands. Don't even recall what was it that gave me the idea that might be useful..

I do have a working progress bar along the lines you suggest. Maybe I will just use that, just need to litter the code with those updateProgressBar() calls and keep the count right for the max value. Also it tends to get a bit chunky as sometimes some functions load more assets than others. But it works, which is good of course..
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 25th Sep 2017 19:58 Edited at: 25th Sep 2017 20:00
if something have a long loading time i think you have bad luck.

here is a example of using tween:
AGK (Steam) V2017.08.16 : Windows 10 Pro 64 Bit : AMD (17.7.2) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 26th Sep 2017 16:51
Thanks. I found an example also at https://manicmineragk.wordpress.com/2015/02/10/creating-a-splash-screen/

I mostly managed to implement a working system using tweening but it has the exact problem I was expecting. I have to initialize small number of assets in each frame and keep calling sync(). Since the assets are different size and generally have different properties, it is difficult to get a consistent split and time it nicely while keeping the overall time short. Since different devices have different performance it is further more hopeless.

If there was a way to do this by setting some series of animations (a chain..) and have AppGameKit run it in the background, that would have solved it. I could then just load all assets without worrying about sync(), timings, device differences, etc. I guess this is difficult in tier 1 since you cannot assume (unless add new parameters or something) that the tweens would be the only thing on screen, and that modifying them in the background and drawing on screen would not mess with other draw commands.

I will try to see if I can get this to work somewhat reasonably at least, or do I need to go with some jerky progressbar again..

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 26th Sep 2017 18:45
the sync know the time between last call, if you will have 60 fps, each frame have only 16 ms time to do something. impossible to do screen update and asset loading together.
maybe can paul implement an parallel call to sync , a new command like autosync which run beside? (i will make a feature request for it)
in past i developed a game for xbox 360 with xna framework, this split draw and update, so you can do 1000x math calculations for physics and the screen refresh was separated. (concept was good but no fun at development, it was very unhandy)
AGK (Steam) V2017.09.25 : Windows 10 Pro 64 Bit : AMD (17.7.2) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 26th Sep 2017 20:32
Thanks for making the feature request.

I understand how it gets complicated to develop and probably complicates the tier 1 programming model if parallelism was there. Definitely keeping it simple is good. Some simple model would be nice for this type of need. To enable parallel splash screens and the likes (in-game transition screens) etc.

I did manage to make the load and sync work so it is mostly OK but it is laggy on a phone. I have 30FPS sync rate and the tweening is altogether about 10s for the 4 sprites I use, so that gives me about 30*10 = 300 frames to load separate assets and do setup with them.. but as I said it lags on a phone and not so nice.


smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 26th Sep 2017 21:16
if you grab the total file size to load (add all media file sizes together using GetFileSize() ) then use that as 100%, now you can tell how much is loaded by checking the size of the files you loaded already as you go.... of course syncing while loading makes the load times longer so it's something to think about.
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 26th Sep 2017 21:21
a motto "You can't have everything."
multiplatform developing (code once) have pros and cons.

AGK (Steam) V2017.09.25 : Windows 10 Pro 64 Bit : AMD (17.7.2) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 27th Sep 2017 00:58 Edited at: 27th Sep 2017 01:15
The real question is... is it worth all the trouble??

Is a perfectly animated load screen really that important?

I mean, even some of the biggest video game successes didn't bother with.

You can get really nice loading 'animations' without perfectly animated effects.

Markus is a real pro at game design and coding, so I highly respect his advice.

SmallG's advice is solid as well, so don't think I am trying to sell him short or anything.

Quote: "The problem with that is that I would have to time asset loading to have sync() produce a consistent frame rate. Was hoping for something simpler, like tell AppGameKit to show a picture for 3 seconds, then automatically fade to pic 2. Then just load all assets in parallel without worrying about syncing.."


I think you got it. using a timer to check periodically during the loading can combine the two methods to get a very good result.

I personally don't think that loading screens are that important, other than splashing the production logos, and maybe some basic instructions or helpful tips.

It seems those could be handled every few seconds as you suggest using the % idea, especially if a timer for the sync() made sure that varying load times on different machines was kept in check.

It's not like you can't check every X% to see if enough time has elapsed for a sync() and screen update.

Just load the loading screen assets first, then use the timer to step through them incrementally, and check the timer every X%.

The timer will keep everything from being "jerky", and the frequent checks will keep it sync()'ed with the asset loading. (still only sync()'ing once every few seconds so shouldn't slow down that much)

My Apps are small for obvious reasons, so I usually have to use timers for the load screens to slow them down in order to even have enough time to read them because the assets load so fast.

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 27th Sep 2017 08:47 Edited at: 27th Sep 2017 08:56
Why not push asset loading into a function, called once per cycle. Load files my hand by reading the data into a memblock, then call createXFromMemblock.
That way, you can stream assets in without affecting the render time. To speed things up, you could load assets in blocks, so instead of loading 1 byte per iteration, load 100. Or time how long your load cycle is taking and dedicate say 10ms to asset streaming. (If it's simply a loading screen, I'm sure the remaining 6ms will be enough to display an animated loading screen.)
Click here for VR Legend of Zelda stuff
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 27th Sep 2017 13:42 Edited at: 27th Sep 2017 13:43
Depending on the requirements you can stream the data and run a full screen update, sort of. I posted a thread exploring that very thing.

https://forum.thegamecreators.com/thread/219750
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 27th Sep 2017 21:19
Thanks all for your very good inputs. I will go with the tweening and loading random parts in files for now. Maybe next time I will just stick a progress bar in again, it is so much simpler. At least this is a good experiment so next time I know if I can do this or not

So some points on the suggestions.

@markus (and others): You are right, this is just very minor feature so I will rather keep the simple and good abstraction for multi-platform support AppGameKit offers than all the little features. But exploring options and limits is good .

@smallg: Images are quite different size and sometimes there are loops where I just create sprites from text so it still requires lots of coordination, measurements, etc. to measure all load sizes and times. Somewhat doing something like this for now as I measure time for each load section, log it, and then make the section smaller if it seems to take long. But yes, the syncing does make the process slower but I hope it is still not too long.

@conjured: You have some good points there, setting up a loading architecture where assets are loaded one at a time while checking for time passed would optimize for shortest load times regardless of device and also give a good frame rate in most cases. Unless I would hit a large asset at the end of a frame. But then maybe I should mark such assets somehow. Anyhow, this would need quite a bit of redoing my code as now I just have each .agc file load its relevant assets and litter some updateProgress() calls in between. Good point to consider though if I redo this sometime, it should be possible to make quite reusable if it can be made usable first..

@mobius and @santman: memblocks look promising there. I will stick with just LoadImage() for now but also this would be good to explore. Also, timing each asset load exactly is difficult since its for mobile so everyone has a different performance.

I am trying to get a small proto done, including this, for gdwc so maybe I can post some video later this week to show how it looks..
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 28th Sep 2017 09:09 Edited at: 28th Sep 2017 09:09
Quote: "Also, timing each asset load exactly is difficult since its for mobile so everyone has a different performance."

Not really.

Click here for VR Legend of Zelda stuff
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 29th Sep 2017 05:51
@Mobiius I was referring more to difficulty of knowing how much time loading a big asset would take on different devices.

But I see what you propose can be very useful.

With a framerate of 30FPS I have about 1/30=0.0333 seconds per frame. So If litter updateProgress() calls after most asset inits, I can do something like this:



By further tuning the time (0.03) to be smaller just before loading larger assets I could have higher assurance over not causing extra lag.

I will have to experiment with the memblock loading approach to further have assets load faster and be less likely to jump over the threshold in frame.

Altogether this should give a result of newer devices finishing loading faster and older ones taking same time as before but with less update lag. Brilliant. Thanks all

Jerry McGuire
7
Years of Service
User Offline
Joined: 25th Mar 2017
Location:
Posted: 6th Oct 2017 16:35 Edited at: 6th Oct 2017 16:36
Super useful thread guys. I had also thought of parallel processing, using C++ new features, but I could not make it work. This thread will make it easier for me to understand the available options. Thanks!!
iMac Book Pro, MacOS 10.12.4, Xcode 8.3.3;
iPhone 6, iOS 9.35; iPhone 5s, iOS 9.35; iPad (3rd gen), iOS 9.35;

Dell Precision T7400, Windows 7 Professional 64bit, Visual Studio Community 2015;
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 16th Nov 2017 08:10
To resurrect an oldie, here is a link to a thread with the video I was supposed to post long time ago:

https://forum.thegamecreators.com/thread/220910

It is the intro video. As the first two logos fade in and out the resources are loaded. Once the loading is finished the rest of the logo sequences can be skipped by tapping the screen. You can also load the game from the app stores to see in practice..

Login to post a reply

Server time is: 2024-11-24 05:55:25
Your offset time is: 2024-11-24 05:55:25