Libload trouble

Depends on the issue, No one reads the whole topic so i bet the issue you had is just a flipping blender, or as i stated later that you needed to save first then try the new changes to the libload, or you where adding at the same time of libloading.

i found out (in this topic)that adding and libloading does not work together.

But atm my problem exist out of libload that loads assets that are not even mentioned in the blend.

I do not want to llink, i’m not using libload for nothing.

it’s pretty simple (my setup)

libload is the main blend,
directory levels contains blends that libloads blends from the assets folder.

so libload loads in level and level loads in assets, libload will put up a loading screen that waits till all assets are loaded.

in every level file you find an libload script(slightly other script then in libload blend), this goes trough a list with preset blends/assets to load.

but at this point i can open libload, and load a level, and anylevel will just load in the same blends/assets. and that is strange due to every blend has it own assets list to load.

I need to look at it again when i get home, but i bet nothing changed.

Lots of problems with libload. One big one is if you have any objects, meshes, materials or textures with the same name. Blender can get mixed up about which data belongs to which entity.

Another thing that can cause a problem is loading and freeing data on the same tic. Always add a little countdown timer (maybe 5 tics) between each operation.

Lastly there’s the problem of render texture being applied to loaded data. If you use render to texture or video texture or any thing like that on a loaded asset and then don’t unload that texture, blender will crash on exit.

It’s good practice to have a terminate() function in your code which goes through and manually ends objects, unlinks textures and frees libloaded data when you exit the game or switch to a different level. If you do that then the game should run smoothly no matter how many times you switch levels.

Well my problem is none of those, i got the strange thing that it doesn’t libload the allocated blends per level blend.

libload.blend → loads level.blend from //levels/
level.blend → loads assets.blend(s) from //assets/

libload waits till all assets are loaded.

But skipping to an other level, will not load the right data that is defined per level.blend.

edit:

Blender Game Engine Started
- Level load time: 0.014848625753074884
- Asset load time: 0.014269746257923543
loading done
freed: D:\_blender\__Fps project\levels\level_0.Blend
freed: D:\_blender\__Fps project\assets\asset_1.Blend
libList(): []
- Level load time: 0.015623984974808991
- Asset load time: 0.01552254508715123
loading done
freed: D:\_blender\__Fps project\levels\level_1.Blend
freed: D:\_blender\__Fps project\assets\asset_1.Blend
libList(): []
- Level load time: 0.015836144797503948
- Asset load time: 0.015411505242809653
loading done
freed: D:\_blender\__Fps project\levels\level_2.Blend
freed: D:\_blender\__Fps project\assets\asset_1.Blend
libList(): []
- Level load time: 0.015124785481020808
- Asset load time: 0.015382705139927566
loading done
freed: D:\_blender\__Fps project\levels\level_1.Blend
freed: D:\_blender\__Fps project\assets\asset_1.Blend
libList(): []
- Level load time: 0.01500318560283631
- Asset load time: 0.015572145115584135
loading done
Blender Game Engine Finished

level_0 should load asset_1
level_1 should load asset_2
level_2 should load asset_3

As defined per level blend like this:
blend_files = ['asset_1']

So you run it in True pulse then? Because i run in in single pulse mode(just once)

Hmm, i think the whole problem exist because it just don’t load in the new scripts, i added the load_scripts option but still nothing.

I’m an idiot lol, after hours of trying to get it fixed, i fixed it.
the solution was so simple, it didn’t even come up to me. The libload scripts in the level blends had the same name, this caused an issue (scripts don’t get freed???). So giving every load script an unique name per blend solved my issue.

1 Like

Yes, it’s important that everything has a unique name, even materials, textures and scripts.
I usually handle my scripts externally to avoid problem like these… since I know they are all in the same place.

I do as well, but not when i build something and testing it, easier to make adjustments on the fly.
Once done i save it in the scripts directory and blender can load it from there.

But Libload stays strange, atm i builded a house.
Libload the house all is good, libload next level, and next, perfect, load previous, and again to get back to the house level, then everything seems to choke up, from 60+ fps it drops to a steady 12 fps and stays there, can take forever(chocking movement/mouse look etc.) or like 10 seconds before it becomes free and act normal again, very strange, no idea what causes this either. At this point everything is unique and no errors reported to console), strange it is for sure