Autor Tema: Asynchonous functions  (Leído 3370 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado Moogster

  • Newbie
  • *
  • Mensajes: 29
  • Karma: 0
    • Ver Perfil
Asynchonous functions
« en: Noviembre 07, 2011, 12: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:


Código: [Seleccionar]
//As a property of the function itself
asynchronous function loadResource()
begin
...
end


Or maybe


Código: [Seleccionar]
//As a property of the instance


//To create it asynchronously
&loadResource();


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


Any chance of this being possible?

Conectado SplinterGU

  • Hero Member
  • *****
  • Mensajes: 12373
  • Karma: 365
  • Sexo: Masculino
    • Ver Perfil
Re: Asynchonous functions
« Respuesta #1 en: Noviembre 07, 2011, 01:38:06 pm »
int completion;

fpg_load("file", &completion)

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

Conectado gecko

  • Hero Member
  • *****
  • Mensajes: 722
  • Karma: 45
  • Sexo: Masculino
    • Ver Perfil
    • Torres Baldi Studio
Re: Asynchonous functions
« Respuesta #2 en: Noviembre 07, 2011, 02:13:23 pm »
I didn't know that! GREAT!
Torres Baldi Studio
http://torresbaldi.com

Desconectado BlackCurtain

  • Full Member
  • ***
  • Mensajes: 187
  • Karma: 9
  • Sexo: Masculino
    • Ver Perfil
    • Black Curtain Studio
Re: Asynchonous functions
« Respuesta #3 en: Noviembre 07, 2011, 03:41:53 pm »
int completion;

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

Conectado SplinterGU

  • Hero Member
  • *****
  • Mensajes: 12373
  • Karma: 365
  • Sexo: Masculino
    • Ver Perfil
Re: Asynchonous functions
« Respuesta #4 en: Noviembre 07, 2011, 03:55:27 pm »
fpg_id when it is loaded.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

Desconectado Moogster

  • Newbie
  • *
  • Mensajes: 29
  • Karma: 0
    • Ver Perfil
Re: Asynchonous functions
« Respuesta #5 en: Noviembre 11, 2011, 06:12:36 am »
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?

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re: Asynchonous functions
« Respuesta #6 en: Noviembre 11, 2011, 06:45:05 am »
What kind of use do asynchonous functions have?
I've never heard of this feature, it sound interessting.

Desconectado Moogster

  • Newbie
  • *
  • Mensajes: 29
  • Karma: 0
    • Ver Perfil
Re: Asynchonous functions
« Respuesta #7 en: Noviembre 12, 2011, 11:17:45 am »
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..

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re: Asynchonous functions
« Respuesta #8 en: Noviembre 12, 2011, 12: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?

Desconectado Moogster

  • Newbie
  • *
  • Mensajes: 29
  • Karma: 0
    • Ver Perfil
Re: Asynchonous functions
« Respuesta #9 en: Noviembre 13, 2011, 08:14:19 am »
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).

Desconectado BlackCurtain

  • Full Member
  • ***
  • Mensajes: 187
  • Karma: 9
  • Sexo: Masculino
    • Ver Perfil
    • Black Curtain Studio
Re: Asynchonous functions
« Respuesta #10 en: Noviembre 17, 2011, 10:16:21 am »
What kind of use do asynchonous functions have?
I've never heard of this feature, it sound interessting.
Loading/progress bars springs to mind.