Possible to do multitasking in Blitz?

Blitz3D Forums/Blitz3D Programming/Possible to do multitasking in Blitz?

ChrML(Posted 2003) [#1]
Is it possible to make blitz do multitasking?
I was thinking about stuff like make slow commands like LoadMesh in the background, while for example constant animate an object. There are soo much stuff I need multitasking for in Blitz. Are threads possible?

I was thinking something like this:

Graphics3D 800,600,32
SetBuffer BackBuffer()

Do Continue While
  ...loading stuff...
  loadfinished=1
  Exit
Wend

While loadfinished=0
  ...Code for something to do while loading...
Wend




Genexi2(Posted 2003) [#2]
Afaik, you cant do threads (I believe thats what they're called) in Blitz.....and it never has been able to do...maybe with DLL's you could. :-/


Almo(Posted 2003) [#3]
Yeah you should be able to get a dll to spawn a threaded task. I think you'd then have the query the dll periodically to find out when the task was done.


Sweenie(Posted 2003) [#4]
With a DLL you could load a mesh in a separate thread.

1. Call a dllfunction that starts loading a mesh into memory using a separate thread.
2. In your "while loading" loop, call the dll and check if the fileloading has finished.
3. When the loading has finished, start reconstructing (using blitzcommands) the mesh using meshdata from memory.
If the mesh is large you may have to do the reconstruction in small pieces a time,(to let blitz do some rendering and stuff in between)

This is just a theory, but I believe it could be done.
At least for meshes and textures/images.

Sounds will be harder, as you can't create sounds using code in blitz.


The question is if it's worth all the work.

[Edit]
Sorry Almo!
I saw your post after I posted mine. :)


Almo(Posted 2003) [#5]
Hehehe... yours is more informative anyway!


Genexi2(Posted 2003) [#6]
> This is just a theory, but I believe it could be done.

Yeah, but with usin a DLL and all, wouldnt it be quicker and all to just load the file itself?

Like, unless this becomes a natvie thing to Blitz, I cant picture usin' a DLL to load 100+ image in the background while the program is runnin'.....as I dont think it'd be the fastest thingto do...


Almo(Posted 2003) [#7]
Well, if you want streaming to have no load screens like Jak and Daxter, then it's the thing to do, assuming you're having memory problems. But memory on PCs is cheap, so it's not as likely to be an issue. PS2 has only 32 Meg!


ChrML(Posted 2003) [#8]
Lol, the reconstructing of the mesh loaded into memory would take more process than the loading itself :P. Ofcourse threads can be running in DLL's, but I was thinking about stuff that must be done in blitz :(. I hope Blitz will support threads soon.