Asynchonous functions

Started by Moogster, November 07, 2011, 08:49:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Moogster

For the game I'm making I would love to be able to load resources in the background. I was wondering if there is a chance for that to happen in the Bennu language? Ideally it would look along the lines of:



//As a property of the function itself
asynchronous function loadResource()
begin
...
end



Or maybe



//As a property of the instance


//To create it asynchronously
&loadResource();


//Regular function
function loadResource()
begin
...
end



Any chance of this being possible?

SplinterGU

int completion;

fpg_load("file", &completion)

Download Lastest BennuGD Release: http://www.bennugd.org/node/2

gecko

Torres Baldi Studio
http://torresbaldi.com

BlackCurtain

Quote from: SplinterGU on November 07, 2011, 09:38:06 PM
int completion;

fpg_load("file", &completion)
So what values does "completion" return? True/false?

SplinterGU

Download Lastest BennuGD Release: http://www.bennugd.org/node/2

Moogster

That is pretty cool! I have the feeling there is a lot of neat functionality in Bennu that I'll never use because it's not documented anywhere, which is a real shame. Updated the wiki with this at least.

Any chance of functions running asynchroneously?

handsource-dyko

What kind of use do asynchonous functions have?
I've never heard of this feature, it sound interessting.

Moogster

I'm making a top-down game with big sandbox type levels, so I would load the resources like textures, sound and data in the background while the player is moving about to not be limited in level and memory size..

handsource-dyko

Ahh... I see. You must be loading and unloading stuff on the fly. I'll bet it's very efficient in terms of memory footprint. Must be tricky to keep the loading in sync. Or do you buffer resources in advance depending on the player's position?

Moogster

It's not in yet, as I just learned of the functionality, but the idea is to chop up the level in blocks and try to keep the loaded area large enough to not notice and not have restrictions on level size(and data/m2).

BlackCurtain

Quote from: handsource-dyko on November 11, 2011, 02:45:05 PM
What kind of use do asynchonous functions have?
I've never heard of this feature, it sound interessting.
Loading/progress bars springs to mind.