Cool, Thanks for the info.
On Sep 14, 1:59 pm, "Erik Corry" <[EMAIL PROTECTED]> wrote:
> On Sun, Sep 14, 2008 at 7:40 PM, vlad <[EMAIL PROTECTED]> wrote:
> > I'm creating a 3d game platform for my game development needs. I'll
> > use v8 for my scripting needs.
>
> Sounds interesting!
>
> > I need to call a function in the render system of the platform on a
> > regular basis, say 30 times per second, so that display gets updated
> > but I'm not sure where to place that call. When calling
> > v8::Script::Run(), the virtual machine takes over from here and runs
> > the script. I could install a function in the javascript world, say
> > render(), that would call the render inside the platform, but I don't
> > like that method because it's a burden that I don't want the
> > javascript aspect to have to deal with.
>
> > How can I setup a way to allow the engine to run internal systems
> > (display, networking, etc) on a regular basis?
>
> It sounds like you really want to spawn another thread and then have
> that use a loop with a sleep in it to call your render function. Of
> course that thread shouldn't touch Handles and other JS data. The JS
> thread(s) can communicate with the render thread using locked C++ data
> structures, where the locks are held only for short times during
> callbacks from V8.
>
> If you are doing games you should be aware that V8 is not real time so
> there can be no guarantees about pause times. The GC is a particular
> concern here. Although most pauses are short, every now and again
> there will be a full collection and the pause time will be
> proportional to the size of the JS heap.
>
> --
> Erik Corry, Software Engineer
> Google Denmark ApS. CVR nr. 28 86 69 84
> c/o Philip & Partners, 7 Vognmagergade, P.O. Box 2227, DK-1018
> Copenhagen K, Denmark.
--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---