0
$\begingroup$

Is there an option to load objects/scenes I want to memory to prevent lags? I don't want to let all objects spawn to buffer them or other tricks. How can I do this? And is it possible to remove them from memory? Thanks for every answer!

$\endgroup$
0
$\begingroup$

You want to prevent lag when changing scenes? Add them all in the first frame (so you get a massive lag spike), and have each scene pause itself. Then you can resume them as needed.

To remove it from memory, end the scene.

I don't feel that I actually understand what problem you are having.

$\endgroup$
  • $\begingroup$ This doesnt work because you need a camera for each scene which flies through the world to buffer all objects. Just adding the scene is useless. Objects are just loaded to memory if they're on the screen. $\endgroup$ – Frostie May 14 '17 at 19:43
  • $\begingroup$ I have not come across that issue. How big is your scene (both in blender units and in MB) $\endgroup$ – sdfgeoff May 14 '17 at 19:43
  • $\begingroup$ 980 objects. But that's not important. I just want to know how I can load things to memory. $\endgroup$ – Frostie May 14 '17 at 19:45
  • $\begingroup$ BGE tries to avoid you having to manually load things in and out of memory to make your life simpler. You can do it with libload, (loading an external blend file into the current one) but 99.999% of the time you shouldn't have to. $\endgroup$ – sdfgeoff May 14 '17 at 20:00
  • $\begingroup$ The BGE loads the COMPLETE scene into memory when switching to a scene (including start up). It does not matter where the camera is. $\endgroup$ – Monster May 16 '17 at 4:02
0
$\begingroup$

To load objects and scene into memory you need LibLoad

usage:

from bge import logic

logic.LibLoad('file.blend','scene', load_actions = False, load_scripts = True, async = False)
$\endgroup$
  • $\begingroup$ Thanks! But does this work internal? In case if I have this blend as an exported exe file. There I want to load objects to memory? Is this possible? $\endgroup$ – Frostie May 14 '17 at 19:55
  • $\begingroup$ you can only load .blend files. or you mind your game is exe and want to load from there? if that. you can load blend files. $\endgroup$ – Strapicarus May 14 '17 at 20:00
  • $\begingroup$ The purpose of LibLoad is to load objects on-demand. LibFree removes the data from buffer. It does not sound this is what the question is aiming for. $\endgroup$ – Monster May 16 '17 at 4:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.