FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Simulation, Artificial Life
(Moderator: REAS)
   Spring-and-Mass Physics
« Previous topic | Next topic »

Pages: 1 2 
   Author  Topic: Spring-and-Mass Physics  (Read 4830 times)
narain


Re: Spring-and-Mass Physics
« Reply #15 on: Apr 29th, 2004, 4:43pm »

on Apr 28th, 2004, 6:01pm, TomC wrote:

HTML!

 
Aha! Haha! :-D
 
Actually, I was talking about encoding the structure of the creature (Mike actually wanted one for a general graph) into a "decently mutable genotype string".
 
I mean, look at this genotype I got off the Framsticks website: "rCCirCCii(rXX[| T :379.564],rrX,X)"!
 
I wanted to how what on earth that was. But I've read the genetics documentation there, so now I know. Kinda. It still looks funky, but now I know it's not magic.
 
And Tom, your Soda emulator is very impressive! I love it. Excellent work!
 
I think your problem with friction may be this: The frictional force is not proportional to speed; it's proportional to the force pressing down in the y-direction.
 
So don't do this:
vx = vx * const_sfriction;
 
Instead, do this:
friction = abs(const_sfriction * fy);
vx = vx + friction*(vx>0 -1 : 1);
 
I don't really know if this will fix it, but it will make it more faithful to physics.
 
I have a feeling, though, that the problem really lies in the fact that after once touching the ground, the vertex will just bounce off and friction won't get a chance to work for more than one frame. Can't think of a way to fix that though...
 
TomC

WWW
Re: Spring-and-Mass Physics
« Reply #16 on: Apr 29th, 2004, 7:50pm »

Ah, I had some luck with swapping around where I had vy *= const_sfriction; and vx *= const_sfriction; so that vx gets slowed on contact with the bottom and top, rather than left and right boundaries.  If that makes sense.  Now at least dainty walker doesn't walk on the spot, and dirk jiggler doesn't droop :|
 
I'll try the friction proportional to downward force next though - do you think surface_friction="0.1" from the soda xml corresponds to a coefficient of friction?  I've only ever played with the algebra, I've no idea what a sensible value is.
 
Thanks for the feedback.
 
Mike Davis

WWW
Re: Spring-and-Mass Physics
« Reply #17 on: Apr 29th, 2004, 9:36pm »

>> What's the advantage of expressing the construction data as a string? Faster? Smaller? .......?
 
Depending on the grammer used, the string can define recursively grown parts of the structure and other interesting stuff.
 
For example, the L-System grammer can grow a tree of any size with a line as simple as "A|A=F[-A][+A]".
 
The advantage is that mutations to this string can result in either drastic structural changes or small ones.  This method resembles genotype(DNA)->phenotype(grown) more closely than simply perturbing structures in each generation.
 
For example: When an embryo's cell gets changed early in development, the effect is multiplied as the creature grows.  A single cell-division error early in development can mean a missing arm or an extra leg.  Something like an L-System works like this.  But if we simply take a parent structure, copy it, and modify it a little bit for each child, that would mean you might have offspring with a few cells missing from the arm in this metaphor.
 
This of it as the difference between mutating a mathematical formula or mutating the results of a methematical formula.
 
TomC, that's amazing work.  I couldn't have imagined that we could get so close to the sodaplay system; apparently their physics really are this simple.
 
I've got some ideas I'd like to try outside of the sodaplay model:
 
1) Keep the same structure for every generation, but each one has a "program" of muscle actions.  Evolve the program through subsequent generations towards some goal.  This'd be easy, and I'll be trying it first.
2) Upgrade the model with some features that sodaplay doesn't have.  Namely, do (1) but attach "flippers" at specified angles to some vertices; flippers being line segments that exert some force on the overall structure as a result of movement through space.  I'd image that some freaky deep sea looking swimmers could be evolved from this.
 
mflux

fluxhavoc WWW
Re: Spring-and-Mass Physics
« Reply #18 on: Apr 29th, 2004, 10:24pm »

Ah mike, that's a great explanation, thanks. The string acts like an algorithm instead of an exauhstive "blueprint" of the entire construction down to the last detail.
 
Mythmon


Re: Spring-and-Mass Physics
« Reply #19 on: May 30th, 2004, 7:09am »

hey TomC, have you read Jeckyll's paper at http://wqww.sodaplaycentral.com ? he exhaustivly analizes the physics of the constructer.
 
Fish-face

308232952308232952thedemonsheep WWW Email
Re: Spring-and-Mass Physics
« Reply #20 on: Aug 22nd, 2004, 7:28pm »

Well, I'd already got a faulty spring-and-mass engine, so I thought I'd jump on the bandwagon and code an ALife thing, as well.
 
To see it, visit http://www.fishface.a.la/processing/genosprings/applet/
 
If you go into the data section you can see the 'genome' file it parses - so that you don't have to do so yourself, here's a synopsis of the code.
 
It works a bit like framsticks:
 
M - create a mass, and attach a spring to the previous mass.
M(MM) - create a mass with two other masses branching off it.
K/k - increase/decrease spring K
L/l - increase/decrease spring rest length
M/m - increase/decrease mass of masses
~ - turn on/off muscles (default off)
>< - increase/decrease muscle phase - changes by 15 degrees each time.
S - create a spring from the current mass to one defined by relpar:
- - decrease relpar by one. Relpar starts at the mass previous to the current mass.
 
So far I haven't created an actually genetic morpher, or even something that randomly creates genomes. Hopefully you understood enough to do something with it.
P.S. The code is probably awful - don't worry about lecturing me.
 

--

The C@ S@ on the M@
=Fish-Face=
~#Chris#~
Pages: 1 2 

« Previous topic | Next topic »