Loading screen

Started by Ryex, June 10, 2009, 01:17:36 am

Previous topic - Next topic

Ryex

June 10, 2009, 01:17:36 am Last Edit: June 10, 2009, 01:19:33 am by Ryexander
I noticed that when you open any rmxp game the screen stays black for a while (like 10 - 20 seconds depending on you comp and how many scripts you have ect.) and i got to thinking "hey what if you put a script at the top of the editor that drew a loading text that stayed there until all the scripts had be loaded and what ever else it dose had happened so I made this. all i did was make a new script at the top of the editer and pot this in it


$loadingsprite = Sprite.new(Viewport.new(0, 0, 640, 480))
$loadingsprite.bitmap = Bitmap.new(640, 480)
$loadingsprite.bitmap.font.size, $loadingsprite.z, $loadingsprite.bitmap.font.color = 40, 5000, Color.new(255, 255, 255)
$loadingsprite.bitmap.draw_text(0, 0, 640, 32, 'LOADING...')
Graphics.update



it hardly advanced but the effect is interesting try it out, mess with it and enjoy!



I also played around with Graphics.frame_rate I set it to 120 frames per second and my cpu spiked to over 60% and the fps still didn't go over 58 frames per second. lol!
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

G_G

You can even use a picture too which is pretty cool. Just replace this line
$loadingsprite.bitmap.draw_text(0, 0, 640, 32, 'LOADING...')

with this
$loadingsprite.bitmap = RPG::Cache.picture("picture name here")

Just import the picture into the Pictures folder

Blizzard

10-20 seconds? O_o "Script is hanging" appears after 8 seconds of not calling Graphics.update. ._.
Check out our game brands:

Daygames
Game Night Games
Chugnar Games

Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G


Ryex

Quote from: Blizzard on June 10, 2009, 05:30:53 am
10-20 seconds? O_o "Script is hanging" appears after 8 seconds of not calling Graphics.update. ._.

ya ok I exaggerated it take about three seconds for scene title to pop up
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

fugibo

Quote from: game_guy on June 10, 2009, 01:48:23 am
You can even use a picture too which is pretty cool. Just replace this line
$loadingsprite.bitmap.draw_text(0, 0, 640, 32, 'LOADING...')

with this
$loadingsprite.bitmap = RPG::Cache.picture("picture name here")

Just import the picture into the Pictures folder


NO! NO CACHE! You're only gonna load this image once, so there is absolutely no need to add the extra loading time and space of caching it. Just use

$loadingsprite.bitmap = Bitmap.new("Graphics/Pictures/<name_here>")


Also, don't forget to call $loadingsprite.dispose when you get to Main.

@Blizz: Not when you're loading it, since the engine is parsing the scripts, not loading running ruby (similar but separate; ruby_run() and rb_require_script("<name>"))

Zeriab

When coming to main I would suggest using:
$loadingsprite.dispose
$loadingsprite = nil

That way the garbage cleaner will eat the disposed sprite when it feels like it.

@WcW: During that time the picture won't be displayed. It will only displayed while the "Script is hanging" error can occur.

Ryex

June 10, 2009, 12:05:49 pm #7 Last Edit: June 10, 2009, 12:07:47 pm by Ryexander
Quote from: Ryexander on June 10, 2009, 01:17:36 am

Graphics.update


that's why you put this right under creating the loading sprite otherwise it wont show until you reach main.

and ya i disposed the loading sprite when I got to main but I forgot to say that
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Seox

Nice idea! Mind if I use it, with creds?

Thanks WcW and Zeriab, for preventing computer explosion.

^_^
... (<<<<<<<<<<<<<<< TEH DOTS OF DOOM. Hey, kinda catchy. :naughty:)

fugibo

lol, I forgot to say the "= nil" part, even though that's not really as important as dispose (mainly just good for memory)

Ryex

Quote from: Seox on June 10, 2009, 12:50:17 pm
Nice idea! Mind if I use it, with creds?

Thanks WcW and Zeriab, for preventing computer explosion.

^_^


no need for credits this is hardly something work giving credit for.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Zeriab

The dispose ensures that the memory is freed pretty much immediately. (If you don't dispose your sprites you can easily get huge memory spikes)
Loosing the reference to the disposed sprite is good style so you don't accidentally mess around with a disposed sprite. (A huge number of errors can occur from messing around with a disposed sprite)

And no need for thanks ^_^

Blizzard

I agree on the last one. You don't have to ever combine "sprite != nil && sprite.disposed?" because it's never disposed. When it's not there, it's nil, end of story. xD
Check out our game brands:

Daygames
Game Night Games
Chugnar Games

Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.