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.

DarkBASIC Professional Discussion / Pro Tip: Speed Up Level Loading...

Author
Message
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 4th Sep 2012 23:08
Here's a small tip that can give you a big boost on game load times:

Let's say you have a game where there's a load screen, and some sort of indicator for progress, like a progress bar. Maybe you have 10,000 items to load and you can literally process about 100 a second, or whatever.

If you update the screen after each item, you are limited by frame rate. So if you are running around 30, 60, whatever fps, you can at best load that many items a second.

The trick is to update the screen based on time, not after each load, so you can really put things into high gear. The easiest way is to have the program simply skip updating the screen if too little time passed since the last screen update.

Example:



I did this and on a large level immediately cut 40% of the load time. Just 3 lines of code added, removed that much time.


TLDR: Don't let frame rate limit level loading speeds.

Sergey K
20
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 4th Sep 2012 23:45
no. i belive to make load faster if you are in loop mode, you better use "sync rate 0" on top. AND FASTSYNC command instead of SYNC.

sync rate 0
do
//your progress while loading..
fastsync
loop

Advanced Updater for your games!
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 5th Sep 2012 00:40 Edited at: 5th Sep 2012 00:44
Quote: "no. i belive to make load faster if you are in loop mode, you better use "sync rate 0" on top. AND FASTSYNC command instead of SYNC.

sync rate 0
do
//your progress while loading..
fastsync
loop"


You have a good idea using Sync Rate 0 and fastsync. However you are wrong on the general idea.

Off Topic: I should also warn you that I noticed a while back that fastsync wasn't updating the sound system properly. The listener positions i think. So you might need to throw a regular sync in there and save fastsync for secondary cameras. Not sure if this was changed. See Link: http://forum.thegamecreators.com/?m=forum_view&t=177326&b=1

Anyway the reason is this... you have that loop and each time you load an item and you update the screen. The screen can only update so fast. So it slows everything down. You have to load an item, then draw the screen to show it got loaded. So the item might take 1ms to load and the screen could take 10ms to draw. So effectively each item takes 11ms instead of 1 ms. That becomes a huge difference when you have thousands of items to load. That loop can only go as fast as your frame rate allows. So if your frame rate is only 70 fps then that's at best 70 items a second.

However, if you update the screen instead based on how long it's been since the last update... you might be able to load 10,000 items real quick between screen updates. This is easy to do just skip updates until enough time passed.

This all assumes you're actually using a proper loading screen instead of making the gamer wait with zero feedback.

TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th Sep 2012 21:33
sync rate 0 and fastsync won't cut it. Check this out:



TheComet

"if you don't understand recursion than you probably don't understand recursion." ~Jerico2day

Login to post a reply

Server time is: 2024-04-19 00:22:54
Your offset time is: 2024-04-19 00:22:54