use dynamic loading?

what is the best method to use a dynamic loading to avoids the game from loading everything at once in scene start

So far as far as i know is that there are 3 systems or should i say mechanics that has been created already by few devs on the Community:
(So far we got …)

  • Lib Load
  • Lib Free

I think i remember on Tutorials for blender they were some scripts for loading each individual object with its physics in a Scene i dont really remember where i put it i’ll go have a Look again.

Im working on a system called a Preload System its a System that loads everything from the start of the exe game !!! Its a script designed to touch all the scenes and read all assets be4 you actually transition to those scenes so it works like this: as soon as you start the exe … You obviously should have intro scenes with animations and videos be4 u can get to the main menu scene. Now in the console window when the exe is open you will see that blender is reading every single file in every scene in your game and going through every asset and object but not loading textures or any physics or any scripts. It will only load textures, Scripts, Animations and physics once you literally transition to those scenes…
Making it quicker for blender to LibLoad or Lib Free or even load things at the same time but systematically with out you seeying it…
Its a Works in progress i haben’t mentioned anything abt it but when time comes i will provide the link to the script its abit unstable at the moment !!!


One other way you could do dynamic loading is creating a scene where all in game assets/objects will be and then link scene objects to your main scene.

Now after linking the assets from your asset scene add your asset scene add a loading screen as an overlay scene and as soon as you transition to your main scene the same assets would have been already loaded so blender wont waste time reloading everything at once especially if you are using alot of textures its only the physics due to the collision bounds of your objects that will take performance. So another way would be to use a blend file and blender could load all your assets that make up your scene but adding objects 1by 1 while in a Loading screen.

If you wanna go the Hardcore 100% way of things you can store everything and create a dynamic library where you store all your assets in a python script. the script will then create the asset and then take the texture and add it to the asset in realtime in the actual scene, just add a timer to your overlay scene which will have a loading bar. So as soon as everything has been loaded the overlay scene must end. And you’ll have your scene set up fully as u expect it.


LibLoad, ImageFFMPEG and AUD factories are systems that allow loading resources off the hard drive and merging them into a blender scene.

To use LibLoad to load whole blend files into the current scene (simplest example):

import bge

path_to_other_blend = bge.logic.expandPath('//Relative/path.blend')
bge.logic.LibLoad(path_to_other_blend, 'Scene')

And to use ImageFFMPEG to load textures:

def show_picture(obj, path, mat_id=0, tex_id=0):
    '''Loads a picture into a texture'''
    # The texture has to be stored in a place associated with other game data
    # so we store it in a game property. This name inlucdes the mat ID's and
    # tex ID's so that a single object with a complex setup does not have the
    # textures overwrite each other.
    # If a bge.texture object already exists for this object/mat_id/tex_id, then
    # we retrieve that.
    prop_name = 'SHOW_PICTURE{}:{}'.format(mat_id, tex_id)
    if prop_name not in obj:
        tex = bge.texture.Texture(obj, mat_id, tex_id)
        obj[prop_name] = tex
        tex = obj[prop_name]

    # Load the image from the path
    raw = bge.texture.ImageFFmpeg(os.path.join(path))

    # Check to see that it loaded
    if raw.status == bge.texture.SOURCE_ERROR:
        # Error in loading image
        raise ValueError("Unable to load image at {}".format(path))

    # Assign the new image to the texture and update the texture.
    tex.source = raw

To use AUD to load sounds:

import aud

device = aud.device()
factory = aud.Factory('music.ogg')
factory.buffer()  # Loads into RAM. May use lots and lots of memory. I suggest it only for sound effects which need to be able to play repeatedly.

handle = # Starts playing the file

Be aware that anything reading data from the hard drive will be relatively slow.

If I remember correctly, the BFBGE Libload.progress would return 0, 0.8, 1 but UPBGE only returns 0, 1. You can split your blends apart and libload each blend into one with async.

Where can I find these scripts or bookstores?

  • Lib Load - Lib Free Where can I read about this? Do you know any video or tutorial?

you are redfrost games ? mmm you have a lot of tutorials with links to download files broken, is not funny, you never answer a question if it does not suit you on your YouTube channel…!
you never answer a question if it does not suit you on your YouTube channel
this should answer 99% of questions, if you take time to search on it.

and then try things for yourself.