Bennu Game Development

English Forums => Suggestions => Topic started by: Moogster on November 07, 2011, 08:49:10 PM

Title: Asynchonous functions
Post by: Moogster on November 07, 2011, 08:49:10 PM
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?
Title: Re: Asynchonous functions
Post by: SplinterGU on November 07, 2011, 09:38:06 PM
int completion;

fpg_load("file", &completion)

Title: Re: Asynchonous functions
Post by: gecko on November 07, 2011, 10:13:23 PM
I didn't know that! GREAT!
Title: Re: Asynchonous functions
Post by: BlackCurtain on November 07, 2011, 11:41:53 PM
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?
Title: Re: Asynchonous functions
Post by: SplinterGU on November 07, 2011, 11:55:27 PM
fpg_id when it is loaded.
Title: Re: Asynchonous functions
Post by: Moogster on November 11, 2011, 02:12:36 PM
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?
Title: Re: Asynchonous functions
Post by: 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.
Title: Re: Asynchonous functions
Post by: Moogster on November 12, 2011, 07:17:45 PM
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..
Title: Re: Asynchonous functions
Post by: handsource-dyko on November 12, 2011, 08:32:31 PM
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?
Title: Re: Asynchonous functions
Post by: Moogster on November 13, 2011, 04:14:19 PM
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).
Title: Re: Asynchonous functions
Post by: BlackCurtain on November 17, 2011, 06:16:21 PM
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.