1/12/11

Cellular Turing Machines(Physics Simulation)

If everything works as planned, we've go our creature all the way manufactured, popped out, everything. It's sitting in the environment, ready to rock and roll. Now what?

Ultimately, I want these creatures to do everything you might expect of a normal creature. They should move around, mate, sense their environment, etc., all in a continuous simulation. I don't want to be that complicated off the bat. The first version will only have the one creature at a time, but I do need to consider how these sorts of things might be implemented later when I'm designing the physics now.
Here's what we have to work with: we have our creatures, and every tick of the game, every node in their body engages in a cyclic cellular automata, the end result being a new state. Each node has a list of other node's its linked to. It has a number associated with it, which for the purposes of the physics simulation I am going to take to be amath 1, 2, 3, 4, ..., n endmath.
I'm not planning to emulate real world physics. There will be similarities (I'm going to introduce a gravity force (and perhaps a sort of friction force if necessary), for instance) but there will also be differences (I won't implement velocities into the nodes. Forces applied to the nodes will just directly move them, and every step those forces are recalculated.). I'm looking to create an interesting and complex environment, but also one that is quick and simple to implement and simulate.
The physics simulation is going to treat each link a a weird sort of spring whose equilibrium length can change. If we are considering the link between nodes amath A endmath with value amath a endmath, and amath B endmath with amath b endmath, then the equilibrium length will be amath e =  ab % n +1 endmath. The force exerted by a spring that is stretched to length amath l endmath will be amath F(l)=e^2-l^2 endmath, the force on node A being exerted in the same direction as the vector from B to A.
Gravity will simply be a constant downward force. The ground will exert a normal force exactly sufficient to keep every node no lower than the level of the ground. If friction is implemented, it will be a force that simply opposes horizontal movement of nodes that are on the ground.
Every step, all the forces acting on a node will be summed up, and the node will move, its new position being the sum of its old position and the net force. Then I'll pass the creature back to the Cyclic Automata to update the node values, and do it all again.

No comments:

Post a Comment