Well, actually testing any of these out seems to eat all the RAM on my
box & I have to kill it...I don't think that I'm 'morally' doing
anything wrong, so I guess I've just been assuming it's related to the
other ticket I filed where the same thing happened. That might not be
a safe assumption though...
I see. IMO in Haskell one can replace 100 lines of C code with just 10 lines of Haskell, but then it takes 10 times as long to fix the space leaks ;) But in the end it's all nicely orthogonal and composable, so it should be worth it :)
One thing that I was pondering about: if I recall correctly (it has been a while that I played with this stuff), if one wants to perform a Runge Kutta, then the simulation engine must be able to "peek" ahead in time, temporary moving (and rotating) all rigid bodies a fraction of the time step in the "future", computing the forces and torques at that new time, and then backtrack to the start of the sampling time interval, combining the different forces and torques over the time interval to perform a numerical integration step. So basically if one has a Behavior for the Position of some rigid body, one would need to create a new Position Behavior for sampling these temporary Positions, since the final Position of the rigid body at some time T will be different from the temporary Position at the same T, and since we're dealing with functional programming here, we have referential transparency so the same Behavior cannot have a different value at the same time... I'm not sure how this will work out (and my English seems to be too bad to express what I really mean without a face to face conversation and a piece of paper, sigh)
As for physics. One person on #haskell (can't remember who...)
suggested making a pure interface to chipmunk similar to FieldTrip's
interface to OpenGL. That seems like a good & pragmatic idea.
Yes, but OpenGL is used as a "backend/actuator"; it just renders stuff. A physics engine would have to generate events and provide behaviors, so it would be "IO in the middle", and I have no idea how that would work out.
chipmunk seems to be really cool but it's "just" a 2D physics engine. but anyway a lot of C/C++ physics engine are available.
Being a bit of a physics nerd, I think it'd be really cool to make an entire
2d or 3d engine to go with Reactive from the ground up. It'd probably
be a lot of fun to work on but it might not be the fastest way to the
finish.
Well Reactive isn't exactly the fastest way to finish either, but I guess we all hope it will be the nicest way to finish :)
You certainly seem to be the right "nerd" for a "pure" physics engine, so why not give it a shot :) I suspect that the Reactive core might need some architectural changes if one wants to integrate a real physics engine with an good RK4, so I guess it's better to confront Conal with this earlier than later... Personally I'm still struggling to leave my 20 years of imperative hacking skills behind me, so currently I'm just watching and being amazing with all this development ;-)
Cheers,
Creighton