Re: TurboSphere
Reply #435 –
I would like to think that I do, in fact, have a partial solution to the issue of feedback in asynchronous engines in TurboSphere.
And that is that TurboSphere is kind of semi-synchronous now.
It works so that the render thread or engine thread 'float' back and forth--one can be ahead of the other--although they can be synced at any time. The real trick I've been seeing is that you always perform syncs on the opposite thread than the one you want to have wait. If you want to change the framerate, you need change the input rate. This lets the framerate stay floating, which is what we really want. Since you know that it will normalize to whatever input you give it (ignoring stutter), you can control it from the engine's main thread.
We'll see what happens when I start doing full scene specifications, but I am going to try something similar. A feeder thread that is throttled, and a render thread that floats freely. The feeder thread is basically zero overhead (much less than the render thread, at least), so the same logic should apply. The engine is already designed to handle what happens if the render thread outruns the engine proper, and the entirety of the render system in Sapphire is designed to be thread safe, so another layer of abstraction for feeding the renderer will be no problem. The number one blocker here is making graphics Groups a fully recursive data structure, which means I need to learn more about multi-pass shaders.
In unrelated news: The Sphere 1.x compatibility script for Images is coming along, as is the primitives script. The translation from the old API to the new one is actually pretty simple, it's mostly just giving each Image object a corresponding Shape and Group, and having separate shapes for each primitive.
Which outlines the difference between the old API and the new one--in Sphere 1.x, you give objects temporary states. In Sphere 2.0, both assets and states are unique and individual objects that are used in combination. An image doesn't inherently `blit', it's a texture, a `shape' is just a collection of points with properties, and a `group' is a series of transformations. You need all three to properly make something happen, they are all persistent but mutable, and you can use them in any combination.