0 votes

Hey,

I am relatively new to Godot and I have search for tutorials regarding this, but I am unsuccessful on finding any, but anyway I am look to create a loading screen with with a slideshow and maybe information displayed and a loading symbol, so the player knows the game is loading and while the game is loading then the player can read what the game has to offer with some snippets of the game displayed on the loading screen and a loading symbol at the bottom right hand corner with the loading percentage.

Is this possible? and if so how would I go about implementing this.

Any help appreciated and thanks in advance.

in Engine by (32 points)

May be a bit far fetched, but did you check the tutorial on background loading? May be the first step towards creating a larger loading screen.

Yeah i have had a look at that document, but it is a bit hard to understand, because it does not tell you how to start creating the loading screen, which nodes to use or even which nodes or where to attach the scripts :/

Yeah I also got error then a black screen when I play the loading screen

2 Answers

+4 votes

Take a look at background loading from the docs.

With that, you could set up a very simple scene, like this:

Control
    ColorRect
        CenterContainer
            VBoxContainer
                Label
                TextureProgress

These are basic ui nodes. The ColorRect is just extended over the whole screen in black. The CenterContainer centers his childrens. The VBoxContainer alignes his childrens in vertical order. Label just showing the text "Loading..." and TextureProgress shows the actual progress of the background loading, mentioned above.


It could look like this:

title screen


So, how to upgrade the progress bar?
First you need to read and understand the background loading chapter, mentioned above.

Then you could just calculate the progress, similar to the background loading tutorial.
This progress could be passed to a reference of your loading screen, which just calls a method to update your progress bar:

func update_progress(progress : float) -> void: 
    textureProgress.set_value(progress)
by (258 points)

I have received an error also how do i add the progress bar because that is not showing up

extends Control

Ref ResourceLoader::loadinteractive(String ppath);
Error ResourceInteractiveLoader::poll();

int ResourceInteractiveLoader::getstagecount() const;
int ResourceInteractiveLoader::get_stage() const;

Ref ResourceInteractiveLoader::get_resource();

var loader
var waitframes
var time
max = 100
var current_scene

func ready():
var root = get
tree().getroot()
current
scene = root.getchild(root.getchild_count() -1)

func gotoscene(path):
loader = ResourceLoader.load
interactive(path)
if loader == null:
showerror()
return
set
process(true)

current_scene.queue_free()

get_node("animation").play("loading")

wait_frames = 1

func process(time):
if loader == null:
set
process(false)
return

if wait_frames >0:
    wait_frames -= 1
    return

var t = OS.get_ticks_msec()
while OS.get_ticks_msec() < t + time_max:

    var err = loader.poll()

    if err == ERR_FILE_EOF:
        var resource = loader.get_resource()
        loader = null
        set_new_scene(resource)
        break
        elif err ==ok:
            update()
        else:
            show_error()
            loader = null
            break

and on that document it tells me to add animation ,but I want it like the image you sent me :/

I have received an error

What error do you received?

also how do i add the progress bar because that is not showing up

A TextureProgress node needs a texture_progress-texture, which could be added in the inspector tab.

and on that document it tells me to add animation ,but I want it like the image you sent me :/

You could also use Tweens instead. Or just set the property value of the TextureProgress.

The error i am receiving is:

0:00:00:0517 - Condition ' debugparseerrline >= 0 ' is true. returned: __null

Type:Error
Description:
Time: 0:00:00:0517
C Error: Condition ' debugparseerrline >= 0 ' is true. returned: __null
C Source: modules/gdscript/gdscripteditor.cpp:287
C Function: debug
getstacklevel_instance

Loading Screen

And where would i put the values and what values would you recommend

Hey, I received the error:

error(22,9)L The method "show_error" isn't declared in the current class

It may be because of an update but I am unsure. Can you help please??

0 votes

So - what people need to understand about the background loading tutorial in the documentation is that is still loads everything in the main thread. It just stops between loading scenes to poll the ResourceLoader. So if you can't divide your game into a bunch of smaller scenes to load, you probably shouldn't follow that tutorial. Actually, don't follow the tutorial at all - it's pretty bad and like half of it is in C++. It's probably better to use multiple threads instead. Unfortunately you can't have load progress and multiple threads at the same time, but you can just slap a fake loading bar on the screen.

by (8,526 points)

Also note that every thing visual is handled in the main thread so you must use a mutex to update them

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.