[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] FastRenderGroup revised (update4)



René Dudfield:
> What are the main features of FastRenderGroup?

Since I have read earlier versions of this code, and chatted with DR0ID
in the #pygame channel about the architecture (I suggested exponential
back-off as worth exploring) I'd like to have a go at this.

The core of it seems to be the chunk of code that tries two rendering
methods every 75th frame and chooses the faster of the two as the method
to use for the next 74 frames.  It's a benchmark-based system, and could
probably be called the BenchmarkingRenderGroup.

> The jerking stops for me when I make it not oscillate between update,
> and flip modes.  I think maybe an Exponential back off strategy might
> work...  not too sure.  I think we should try a few different things
> when we meet up in two weeks.
> 
> Some possible different strategies:
> - figure out the best rendering method in the first 1-3 seconds, then
> stick with that.
> - keep checking to see which is the fastest way.  Only change modes at
> most once every 10 seconds.

While writing the above, I thought that the name "StochasticRenderGroup"
might be good.  Then I stopped to look up the literal definition of a
stochastic process, and realized that it did not apply.  However, such a
process might actually be the solution to removing the sampling jitter.  

gcide says:

     3. (Statistics) of or pertaining to a process in which a series of
     calculations, selections, or observations are made, each one being
     randomly determined as a sample from a probability distribution.

Consider that when you sample, you have a timing value for the fastest
and the slowest method given a particular data set.  Use this to
calculate a threshold, and compare it against the current rendering
time.  Keep the rendering time for the previous frame as well, and do
comparisons between successive frames and comparisons relative to the
tests done earlier.  

You should also consider attack/sustain values for when to switch, so
that you don't end up with bang-bang switching in cases where the two
methods have similar speeds.

-- 
How do you get mailings?... from the lists             Nick Moffitt
1. suspects                                           nick@xxxxxxxx
2. elbows
                -- Don Saklad