Horde3D

Next-Generation Graphics Engine
It is currently 21.04.2025, 03:48

All times are UTC + 1 hour




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Update callbacks
PostPosted: 09.09.2009, 00:19 
Offline

Joined: 09.09.2009, 00:13
Posts: 12
I looked at the documentation and in the forum but did not found a way to create an update callback when doing the update traverse of the scenegraph ( SceneNode::update() ).

Are you planning for future versions to add this mechanism or a similar one ?

Thanks!

_________________
r3D^rgba


Top
 Profile  
Reply with quote  
 Post subject: Re: Update callbacks
PostPosted: 09.09.2009, 06:16 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
Does the h3dCheckNodeTransFlag help you? Or what exactly are you planing to do?


Top
 Profile  
Reply with quote  
 Post subject: Re: Update callbacks
PostPosted: 09.09.2009, 10:33 
Offline

Joined: 09.09.2009, 00:13
Posts: 12
I meant a callback mechanism similar to the one Openscenegraph has.
I think callbacks provide an interface easier than changing things directly in a main update loop

I saw SceneNode has an onPostUpdate and onPreUpdate. Wouldn't be nice to have access to those without having to inherit?

Thanks!

_________________
r3D^rgba


Top
 Profile  
Reply with quote  
 Post subject: Re: Update callbacks
PostPosted: 09.09.2009, 10:54 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
I think the reason for not offering callback methods is that it is less portable to other languages than C/C++. On the other side, one could just ignore this functionality on language bindings that do not support function pointers. But I guess that's something marciano has to decide. In principal I agree, that callbacks could become handy in some cases (especially in case of physics).
But marciano told me a couple of times, that he wish to outsource the scenegraph from Horde3d anyway (although I haven't fully understood yet how the animation system then should work without making it far more complicated).


Top
 Profile  
Reply with quote  
 Post subject: Re: Update callbacks
PostPosted: 09.09.2009, 12:27 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
Volker wrote:
I think the reason for not offering callback methods is that it is less portable to other languages than C/C++. On the other side, one could just ignore this functionality on language bindings that do not support function pointers.
With Horde exporting a C API, we wouldn't be able to offer support for C++ functors, which rules out using member functions as callbacks - pretty much essential for this sort of functionality.
Quote:
In principal I agree, that callbacks could become handy in some cases (especially in case of physics).
It works in principle, but once you move to a more robust architecture (i.e. independent time-steps for physics and rendering), your callbacks need to carry around a lot of state, and the advantages of callbacks pretty much go down the drain.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
 Post subject: Re: Update callbacks
PostPosted: 10.09.2009, 01:14 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
swiftcoder wrote:
Volker wrote:
I think the reason for not offering callback methods is that it is less portable to other languages than C/C++. On the other side, one could just ignore this functionality on language bindings that do not support function pointers.
With Horde exporting a C API, we wouldn't be able to offer support for C++ functors, which rules out using member functions as callbacks - pretty much essential for this sort of functionality.
As long as the call-backs take a user-supplied void* you can always implement C++ pointer-to-member callbacks yourself, though :wink:


@r3d - what would you like to use these hypothetical update callbacks for?


Top
 Profile  
Reply with quote  
 Post subject: Re: Update callbacks
PostPosted: 10.09.2009, 16:28 
Offline

Joined: 09.09.2009, 00:13
Posts: 12
DarkAngel wrote:
@r3d - what would you like to use these hypothetical update callbacks for?


For example to allow a client - that doesn't have access to the update loop - to implement a custom animation controller ( like a lookat) or a custom deformation.

_________________
r3D^rgba


Top
 Profile  
Reply with quote  
 Post subject: Re: Update callbacks
PostPosted: 10.09.2009, 17:01 
Offline

Joined: 22.11.2007, 17:05
Posts: 707
Location: Boston, MA
r3d wrote:
DarkAngel wrote:
@r3d - what would you like to use these hypothetical update callbacks for?
For example to allow a client - that doesn't have access to the update loop - to implement a custom animation controller ( like a lookat) or a custom deformation.
You can implement this sort of callbacks from your own main loop - no need for the scene graph to provide this.

_________________
Tristam MacDonald - [swiftcoding]


Top
 Profile  
Reply with quote  
 Post subject: Re: Update callbacks
PostPosted: 13.10.2009, 03:42 
Offline

Joined: 09.09.2009, 18:58
Posts: 107
I was gonna say, I would think that an update callback would be implimented based on what is needed. IE: if entity is moving forward, then play walk animation. Other instances would include blending between strafing and walking based on what direction the player is heading and what direction he's facing. That's all in the entities hands with the type of API Horde provides.


Top
 Profile  
Reply with quote  
 Post subject: Re: Update callbacks
PostPosted: 17.10.2009, 11:16 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
I'd really recommend steering clear of the "callback" concept for the scenegraph.

Ogre has listeners which are essentially callback mechanisms. It also has classes you can derive from where you get certain member calls at certain times during the render setup.

The problem is that in a game, you really dont want your rendering to be "in charge" of anything. Rendering should be "throw some data at the card and forget it". Implementing things like update loops via a renderer callback can lead to all sorts of isssues (which is why I encourage my students to use Ogre's "RenderOneFrame" method to do the rendering when THEY want it to render.

In general, its usually physics that is "in charge" of things, mainly because then your AI can handle updates after the physics simulation has been run. In my past games, we've had the ability to literally switch off rendering entirely (and its something I still do in my own engine) so that we can test game logic and AI etc without having the renderer draw anything, we add the ability to speed up time and run the whole simulation at a faster rate looking for bugs.


Top
 Profile  
Reply with quote  
 Post subject: Re: Update callbacks
PostPosted: 18.10.2009, 16:59 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
zoombapup, these are good points. I'm a big fan, of layering, pipelining and especially orthogonality, so I see that similar to you. Also, callbacks do not work well with asynchronous (multi-threaded) game loops.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 27 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group