In-game Loading Bar, Loading Bar for Slow Processes! |
This forum is for clear and concise tutorials and well documented examples. Tutorials and examples posted here must follow the format in the pinned Rules and Guidelines.
All new topics must be approved by a moderator before they appear. Don't post twice!
![]() ![]() |
In-game Loading Bar, Loading Bar for Slow Processes! |
Nov 23 2006, 12:31 AM
Post
#1
|
|
|
Web Designer, Musician Group: GMC Member Posts: 2240 Joined: 19-October 03 From: NSW, Australia Member No.: 370 |
QUOTE (Local Moderators) Replies to topics in this forum are held to a high standard. Reviews must have a critique or suggestion for use to be approved. Read the rules here. In-Game Loading Bar Written by Rhys Andrews The in-game loading bar example shows how lengthy, 1-step processes (such as a loop or for statement that goes on for multiple seconds) can show a bar with the percentage complete (constantly being updated), as a substitute for a frozen screen. File Type - Gm6 (without zip) GameMaker Version - GM6.1 (Registered*) Direct Link - Download here. Filesize - 11.0KB Download Now! * Though this example will not run unregistered, the purpose coding (the coding that draws and functions the in-game loading bar itself) can be used in an unregistered game. Part of the example, such as the particle creating and bursting as part of a process, would not usually be used beneficially by users, as they're simply built-in to show how this example works. So though the gm6 will not run unregistered, in-game loading bars are still possible unregistered and can still be created using this example. |
|
|
|
Nov 24 2006, 11:00 AM
Post
#2
|
|
|
Snake Eater Group: GMC Member Posts: 158 Joined: 18-October 03 Member No.: 357 |
The only problem I have with this, is that it increases the time it takes to load nine-fold.
Though, I do like it. CODE if floor(random(100))=0{screen_redraw(); screen_refresh();} If you replace any "screen_redraw(); screen_refresh();" with this (i.e. inside a for stement), although it'll seem choppy on the loading, its does get it much closer to the speed of what it should be. CODE screen_redraw(); screen_refresh(); Put that at the top of alarm[0] if you'd like to try. |
|
|
|
Nov 26 2006, 01:42 PM
Post
#3
|
|
|
Ying Yang Twinz Group: GMC Member Posts: 1466 Joined: 27-August 06 From: Somewhere in Canada Member No.: 58109 |
QUOTE (Pixofied @ Nov 24 2006, 05:00 AM) The only problem I have with this, is that it increases the time it takes to load nine-fold. Though, I do like it. CODE if floor(random(100))=0{screen_redraw(); screen_refresh();} If you replace any "screen_redraw(); screen_refresh();" with this (i.e. inside a for stement), although it'll seem choppy on the loading, its does get it much closer to the speed of what it should be. CODE screen_redraw(); screen_refresh(); Put that at the top of alarm[0] if you'd like to try. True, but is speed such a concern? Either way, it would not matter what the FPS is, and the Loading screen will be alot more effiecent and substantially less choppy then, also, why not just increase the loading game room speed? Wouldn't that be alot better and less of a pain to do? Well, why is room speed so important anyway? |
|
|
|
Nov 26 2006, 10:41 PM
Post
#4
|
|
|
GMC Member Group: GMC Member Posts: 1472 Joined: 2-June 06 From: ownin all your base Member No.: 51352 |
i dont understand what the ponit of it is. form what i understand everytime your game freezes it shows you how much longer you have to wait? thats what i got out of your descriptin, if thats what it does than thats jsut kind of annoying, otherwise be a bit more specific
|
|
|
|
Nov 27 2006, 12:16 AM
Post
#5
|
|
|
Web Designer, Musician Group: GMC Member Posts: 2240 Joined: 19-October 03 From: NSW, Australia Member No.: 370 |
Room Speed will do nothing for an in-game loading bar... as the whole bar progresses in one step. I understand what you're talking about, pixofied, as screen redraw and refresh does slow down the process further. However, I feel that a small amount of extra waiting time is worth the appearance value that is added to your game.
syth184, Whenever a game freezes (as it's trying to work a process), it is stuck on one step until that process is complete. The game freezes, and people think it has crashed. This happens commonly when you're trying to connect to a server, for example. The in-game loading bar example simply shows how you can fill that 1 step (thats frozen) with a bar showing how much of that process is complete. It assures the user that the game isn't frozen, but loading a difficult process. Regards Rhys Andrews |
|
|
|
Nov 27 2006, 11:04 AM
Post
#6
|
|
|
Snake Eater Group: GMC Member Posts: 158 Joined: 18-October 03 Member No.: 357 |
QUOTE True, but is speed such a concern? Yes. Whether you noticed or not, not everyone has a high-end PC. The load-time increases significantly when redrawing, and refreshing every step (in the loop). The ONLY reason it increases is because of the drawing. Chop down the amount of times it has to redraw, & refresh and you'll have a much faster (closer) time for the actual load. @syth184: RhysAndrews has explained this very well. His/her description is fine; and its not annoying. Its shows the user that the game has NOT frozen, its actually doing something, and the user doesn't need to end the game via the Task Manager. |
|
|
|
Nov 27 2006, 03:54 PM
Post
#7
|
|
|
GMC Member Group: GMC Member Posts: 5293 Joined: 19-October 05 From: Denmark Member No.: 37269 |
If you have to do a lot of calculations in one single step, the FPS would drop down to 0 and the game would freeze untill the event was over (also, the CPU tops to 100%). And it can indeed be very useful, I've made a DT game (and example). But due to the long loading (where it created 64 surfaces and slow image GML functions) I had to make a loading screen.
It's simple! Just make a variable increase for each time you've done a piece of the calculation, then draw a rectangle with a x% length of the total length, or draw the %. In that way the user won't think it has frozen, and he/she would know just about when it was done. |
|
|
|
Nov 29 2006, 05:39 AM
Post
#8
|
|
|
GMC Member Group: GMC Member Posts: 872 Joined: 21-March 05 Member No.: 24363 |
If you got rid of the redrawing and loading crap completely, the loading would hardly even be noticeable (unless it was a MAJOR process.) And to slow down the process but prevent the CPU from giving the game its all, use a sleep(1000/room_speed) to make the game perform the loop at room speed, in case anyone doesn't like the CPU usage.
|
|
|
|
Dec 5 2006, 08:33 PM
Post
#9
|
|
|
GMC Member Group: GMC Member Posts: 92 Joined: 4-December 06 Member No.: 65414 |
is there a way to make that loading bar appear when ur loading your game..Like have it say "loading sprites,backgrounds,sound files ect...
|
|
|
|
Dec 16 2006, 11:55 PM
Post
#10
|
|
|
Web Designer, Musician Group: GMC Member Posts: 2240 Joined: 19-October 03 From: NSW, Australia Member No.: 370 |
QUOTE is there a way to make that loading bar appear when ur loading your game..Like have it say "loading sprites,backgrounds,sound files ect... Not before/during the standard GM loading bar - after your game has run, sure. You could have all sprites/resources external, then load them all after the game has begun, using that loading bar.-Rhys |
|
|
|
Apr 3 2007, 03:35 PM
Post
#11
|
|
|
AI Programmer Group: GMC Member Posts: 1972 Joined: 1-April 07 From: Denmark, Europe Member No.: 75076 |
How do i make it so it loads 3D models instead?
EDIT: Never mind! I found another way to do it. This post has been edited by fede-lasse: Jul 22 2007, 09:03 PM |
|
|
|
Apr 15 2007, 11:53 PM
Post
#12
|
|
|
Eight Star Group: GMC Member Posts: 932 Joined: 17-September 06 From: Right here. Heh Heh... Member No.: 59704 |
very nice I used it in my game when writing terrain. Must I give credit?
|
|
|
|
Oct 17 2007, 03:30 AM
Post
#13
|
|
|
Web Designer, Musician Group: GMC Member Posts: 2240 Joined: 19-October 03 From: NSW, Australia Member No.: 370 |
It's up to you, but that would be nice.
Tehsamplez, it is quite common for a game to have a 'MAJOR process' - especially for online games or games that explore GM's boundaries (external file loading, DLLs, etc). This example I've created was only developed because of a slow process that dimmed the professionalism of my work. Regards Rhys Andrews |
|
|
|
Mar 11 2008, 10:37 PM
Post
#14
|
|
|
Revel Entertainment Group: GMC Member Posts: 4186 Joined: 3-February 07 From: Canada. GM: 7.0 Pro Member No.: 69882 |
I tried this out, and it works, but it freezes the window, and you can move it or minimize it etc. Is there anyway to fix this?
|
|
|
|
Mar 16 2008, 04:02 AM
Post
#15
|
|
|
Web Designer, Musician Group: GMC Member Posts: 2240 Joined: 19-October 03 From: NSW, Australia Member No.: 370 |
QUOTE I tried this out, and it works, but it freezes the window, and you can move it or minimize it etc. Is there anyway to fix this? Not without using a completely different method. This method actually puts the game into a loop, which keeps looping until everything is loaded. Loops actually freeze the game, and usually it appears like your game isn't responding. The only difference here is that the loop manually refreshes the game screen. However, the OS is still going to consider it not responding.Regards Rhys Andrews |
|
|
|
Mar 17 2008, 11:32 AM
Post
#16
|
|
|
Dog Warrior Group: GMC Member Posts: 833 Joined: 26-July 05 From: Australia Member No.: 32114 |
|
|
|
|
Mar 22 2008, 06:21 AM
Post
#17
|
|
|
GMC Member Group: GMC Member Posts: 101 Joined: 24-January 08 From: Australia - GTS +10 Member No.: 98176 |
All done in 2 steps!!! i thought about making a loader where u use the texture_preload() function and then + the loading bar, but this beats all
(Mods: sorry if i double posted but im not sure if my last post was here or in another topic) |
|
|
|
Mar 25 2008, 12:40 PM
Post
#18
|
|
|
Web Designer, Musician Group: GMC Member Posts: 2240 Joined: 19-October 03 From: NSW, Australia Member No.: 370 |
QUOTE If you add io_handle() after the screen_redraw and screen_refresh functions then you WILL be able to minimize and move it etc. That's a really good point. I don't know how I missed that function. Thanks very much - I may update the example soon, then, with this fix. Thanks again.Regards Rhys |
|
|
|
Mar 28 2008, 03:59 PM
Post
#19
|
|
|
Revel Entertainment Group: GMC Member Posts: 4186 Joined: 3-February 07 From: Canada. GM: 7.0 Pro Member No.: 69882 |
But This system is just as slow as if i put it in the step event instead of a for loop.
|
|
|
|
Apr 8 2008, 10:22 PM
Post
#20
|
|
|
GMC Member Group: GMC Member Posts: 211 Joined: 27-August 07 Member No.: 87081 |
Something i did with my progress bar for my games map maker is that i used draw_clear. It saved pretty slow aswell so i used
Step: draw_clear(c_black) //Then I used rectangles to draw whatever i needed |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 22nd November 2009 - 12:47 PM |