Load in background

Blitz3D Forums/Blitz3D Beginners Area/Load in background

AJ00200(Posted 2009) [#1]
Is therea way to load images/meshes in the background with out freezing the game


xlsior(Posted 2009) [#2]
Not really.... You can fake your way around it to some extend by splitting up your loading routines and load one image at a time / run your game / load another image / run the game etc. until they're all loaded, but that's about it.

You can use that in a loading screen where you want to update a progress bar to indicate the status of the loading process, but actually loading new data in the background while your game is already in progress will likely be choppy.


AJ00200(Posted 2009) [#3]
What about scripts (never used them before)


Matty(Posted 2009) [#4]
What about scripts? I see no reason why they would behave any differently, the PC has to process the 'loading' from file irrespective of whether it is loaded directly in the code or by calling the 'load' routine from a script.


Kryzon(Posted 2009) [#5]
Perhaps with extensive C++ knowledge someone could accomplish level-streaming or something like that. I believe that's what happens with Dungeon Siege.


Nate the Great(Posted 2009) [#6]
you cant multithread in b3d if thats what your asking. but a workaround may be to load your images byte by byte and continue to update the screen... then update the image buffers pixel by pixel while you still display a loading screen at 60 fps.


Matty(Posted 2009) [#7]
Accessing a file 1 byte at a time is extremely slow and will still cause lag.


_PJ_(Posted 2009) [#8]
It sounds like you really just need to manage your resources a bit more efficiently. Be aware of what you MUST load and unload (free) at specific points, and be economical with memory in terms of whether or not to maintain some resources in memory'perantently' (or at elast, for an extended period).

The ability to free textures once applied (provided they are unchanging) is pretty handy here, as they are then all handled by the GPU.

Even the latest and alledgedly "no loading times' games have periods where disk access/memory writing affects gameplay though it's just minimised as efficiently as the developers were able.

If your application is divided into parts, such as levels of a game, then use these divisions (or sub-divisions) to make the necessary changes, whilst more prominent and slower loading can be done at 'game start' etc.



What about scripts (never used them before)


I don't understand the question, what do you mean specifically?


Ross C(Posted 2009) [#9]
You just split the mesh into smaller parts and load them bit my bit. If the file isn't too big, then it shouldn't freeze too much. I had a streaming texture loader of sorts. Firstly i had an app to split textures into smaller chunks, then load them, directly on top of a texture already being used.


Andy(Posted 2009) [#10]
http://www.blitzbasic.com/codearcs/codearcs.php?code=1531


AJ00200(Posted 2009) [#11]
Thanks everyone.
Thar should help.


Bobysait(Posted 2009) [#12]
You can try FastPointer ( mikailv stuff , available on his website @ fastlibs.com )

Then you 'll be able to use threads in blitz3d.


AJ00200(Posted 2009) [#13]
Great