PDA

View Full Version : Suggestion: Think-function


MatteKarla
03-30-2004, 02:51 AM
Hi,
I'm following the development of this wrapper closely, using a lot of the ideas for my own wrapper I'm creating, (using GL)

Why not implement a "Think" function in the scene. Where you set up timeout until called again, or "NextThink".
for example: setting think-timeout to 1 second, every second this function gets called and you could for example switch rotation of a object from cw/ccw.
Or for example add a intro-scene to the core, set nextthink to 3s, do fancy intro stuff for 3 seconds, the think-function gets called and loads a new scene, sets the new scene as next and calls MarkForDeath().

I solved it by adding a Think-function that's called in every loop, and then when "think" actually occurs (current_time >= next_think_time) it calls the virtual function OnThink.

And I also have a function called SetThinkTimeout(floats fSeconds) , if you set it to 0.4f then OnThink() is called every 400ms.

Thxn again for releasing such a great wrapper!
(excuse my english btw :-) )

bladder
03-30-2004, 07:17 PM
I really like this idea. It will give a lot finer control to anyone who is using the scenes interface. While reading your idea, I even thought that I can make a counter for a scene. FOr example when you create a scene, set the counter to 3 and it will only call update 3 times before automatically marking itself for death.

heh, I havent really thought of why I should have a "death counter", but anyway, the think idea is great. Good thinking.

MatteKarla
03-31-2004, 12:33 AM
Want more ideas?! :)
I have plenty, hehe

Have implemented some of them in my own engine/wrapper, but since I have very little time to actually write them down in code I have only implemented a few, and usually very sloppy, just to see if my ideas work as planned.

Enabled(bool) and IsEnabled() on scenes, temporary disables rendering/ai/think for scenes.

Ideas how to implement tcp-sockets, resource/object management with smartpointers in scenes amongst other things.

..Mats