[RGSS3] Loading System?

Hey, I'm looking for script that replace the black screen delay before most of scene such as map, title screen,save,.. I want player to know the loading and stuff so they don't thing that the game is crashed or something when they get transfer to new map, especially parallax mapping map, which take ton of time to load it up. I have check out MOG Hunter's script, but it is only for save, and it seem like a fake loading bar.


P/s: Sorry for my bad English!
It is a fake loading bar, yes, but I haven't heard of any script (for any maker) that provides an actual loading screen.
I think you should take a step back and check something else:


On a regular game, switching maps takes less than one second - are you concerned that people take that second as a possible crash, or does your game take more than one second for switching maps?


If it's the second case, you should try to find out why your project is so slow before trying to cover that up...
It is a fake loading bar, yes, but I haven't heard of any script (for any maker) that provides an actual loading screen.



The reason for that is very simple actually.


The sole purpose of loading screens is to show the progress of loading the required files into your RAM.


Since no RPG Maker games use pre-cache systems for some reason (or at least I haven't heard about any), no script was made for this, because it is pointless without such a system.


If a game would pre-load the assets needed for the next map / menus / etc between transitioning, it would be very easy to show a real progress bar for it if the pre-load method is written well.


Showing a fake loading screen is more annoying than not showing anything at all, in my opinion.


But Andar is right, a map load should not take long at all, parallax or not, shouldn't matter, unless you use over-sized maps with tons of layers and if the image files for these layers are huge (in Bytes). That could take a while to load, but I can't even imagine how big your images could be to really feel the loading times between map changes. 😳


The loading speed also depends on your RAM type (and possibly CPU speed), so if you got old ones, your loading times will be slower naturally.
The reason for that is very simple actually.


The sole purpose of loading screens is to show the progress of loading the required files into your RAM.


Since no RPG Maker games use pre-cache systems for some reason (or at least I haven't heard about any), no script was made for this, because it is pointless without such a system.


If a game would pre-load the assets needed for the next map / menus / etc between transitioning, it would be very easy to show a real progress bar for it if the pre-load method is written well.



While I'm sure that's part of it, there are actually plugins for MV to ease loading assets (I'm working on one myself, actually). Another reason it isn't implemented in VX Ace and below is that loading resources is synchronous, meaning nothing else happens while the file is being loaded. This is inefficient because if you're loading an enormous file, the game will noticeably hang while it's loaded in.


The only possible way VX Ace and below could get an actual loading screen (which should be unnecessary to begin with) would be using the Thread class to try and update the screen while the main thread loads resources, but I'm not even sure that the Thread class is available in RM (since it's so stupidly restricted), nor that a thread would be capable of updating the screen.


As a side note for anyone that might be asking why it's unnecessary for VX Ace and below to have a loading screen, while MV comes with one (albeit basic) out of the box is simple: RMMV is based around the web and being able to be run anywhere from laptops, desktops, mobile devices, and web browsers. Now, while each device might be able to run quickly enough to process the game at a good enough speed, network speed is often a very limiting factor. As a result, RMMV displays its loading screen while doing any level of loading because it's a very real possibility we could be waiting for a while for a resource to load over the internet, thereby making it necessary that we have a loading screen.
Some systems, such as animated image systems which work by loading several images and cycling them, can benefit from pre-loading these images.


Whenever an image is loaded into the cache, a small freeze will happen. This is barely noticeable on higher end PCs, but on older ones, it is pretty obvious.


If these animated images need to be animated during gameplay, the first few frames of the animation will lower the FPS quite a bit and cause small lag spikes until the full animation cycle is loaded (all images are loaded). The amount of FPS loss depends on the size of the images loaded and the specs of the PC the game runs on.


Pre-loading these images would eliminate the FPS loss on the first animation cycle for them, not to mention that these animated images could potentially start at a later point too (so not during the transition), so it would be especially helpful to pre-load those images to preserve a smooth FPS during the whole gameplay.


Pre-loading the needed animations from the database would also majorly help in games where they are often used. Displaying these animations will always cause a small lag spike when they trigger. Doing this is especially helpful for real-time battle systems which often use animations such as an ABS or some hybrid systems.


Aside from animations, a project without custom scripts would not benefit more from pre-loading assets, but even than, pre-loading the often used animations and keeping them in the cache would make a huge difference in the performance of the game.


Here is an example of writing a loading bar code for images:

Spoiler
class LoadBar

def initialize
@sp = Sprite.new
@sp.bitmap = Bitmap.new(200,40)
@sp.x = (Graphics.width - @sp.bitmap.width) / 2
@sp.y = (Graphics.height - @sp.bitmap.height) / 2
@folder = "Graphics/ParallaxMaps/"
@files = Dir.glob("#{@folder}*.jpg") + Dir.glob("#{@folder}*.png")
@max = @files.size
@loaded = 0
@rate = 0.0
@color = Color.new(255,10,10,255)
update
Graphics.update
p Time.now
@files.each do |fl|
file = fl.sub(@folder,"")
Cache.load_bitmap(@folder,file)
@loaded += 1
update
Graphics.update
end
Graphics.wait(30)
p Time.now
end

def update
@rate = @loaded.to_f / @max
@sp.bitmap.clear
@sp.bitmap.fill_rect(0,30,@rate*200,10,@color)
@sp.bitmap.draw_text(0,0,200,24,sprintf("%1.2f%",@rate*100),1)
end

def dispose
@sp.bitmap.dispose
@sp.dispose
end

end

lbar = LoadBar.new
lbar.dispose



It's really a basic one, but it works well. Shows the progress of loading the specified images to the cache.


I couldn't be bothered to make it dynamic, just threw it together, but add a few arguments here and there, and you can make it load any image from any folder whenever you want, and show it to the user as well.


One thing to note though...


In the case of small image files, doing this will actually slow down the loading process a bit because of the progress bar drawing.


In the case of big files, it still slows it down a bit, but because the load time for bigger files is already kinda long, the slowdown here is barely noticeable.

Original thread: https://forums.rpgmakerweb.com/threads/rgss3-loading-system.71510/