[reactive] Can we do without delayed switching?

Jules Bean jules at jellybean.co.uk
Wed Mar 25 18:00:58 EDT 2009


Hi,

(resurrecting a very old thread)

You have your answer (recursion is supposed to work in reactive!) but I 
would observe that there are three solutions to defining a behaviour for 
the kind of model you propose:

(1) Solve the problem completely so you have a purely time-parametrised 
behaviour. In general this involves solving d.e.s so it may not always 
be possible. It also doesn't support the interactivity well. I used the 
complete solution approach for the pong "game" (it's non interactive) in 
the crayon demo I just posted.

(2) Solve the problem using mutual recursion between Events/Behaviours. 
This allows you to access the previous value "just before" the kind of 
instaneous change `switcher` introduces.

(3) Approximate the problem using a boring finite clock-rate iterative 
simulation. This is the solution I used in my stars demo uploaded last 
december to this list. This is obviously the least elegant approach, but 
there are all kinds of algorithms much easier to express as iterative 
simulations than the other kind. You can use quite a slow iteration rate 
(I think I used 10fps in stars) and then interpolate between the 
'keyframes'; it works very nicely. This is a good place to generate 
collision events etc.

Jules


More information about the Reactive mailing list