Implementing Destructive Collisions 

I have been working on predator-prey systems for a little while and have
become convinced that more interesting behaviors could arise if destructive
collisions were possible (rather than predators automatically assimilating
prey on any collision). The website shows examples of this in movies, and it
is referred to in several places, but I can't find any examples of how to
implement destructive collisions in an expdef file. I have been trying to
learn to write scripts myself, but since I have zero experience with any
programming language I have had limited success so far. I would greatly
appreciate it if someone could post the relevant portions of their own
expdefs and/or explain how the scripting of destructive collisions works.
Thanks in advance.

Forums: 
Maciej Komosinski's picture

> I have been working on predator-prey systems for a little while and have
> become convinced that more interesting behaviors could arise if
> destructive collisions were possible (rather than predators automatically
> assimilating prey on any collision). The website shows examples of this in
> movies, and it is referred to in several places, but I can't find any
> examples of how to implement destructive collisions in an expdef file. I
> have been trying to learn to write scripts myself, but since I have zero
> experience with any programming language I have had limited success so
> far. I would greatly appreciate it if someone could post the relevant
> portions of their own expdefs and/or explain how the scripting of
> destructive collisions works.

Hello,

"Destructive collisions" is the only feature from v1.x that was not
implemented in v2.x :-)

This is because we came to a conclusion that this is an unnecessary
complication. On destruction, a creature needs to be divided, its
neural network too, and then you have to somehow compute fitness
of such parts, and somehow assign credits of creature parts
to its original genotype. It was done in v1.x but actually was
never used otherwise but for realistic look and nice graphics.

Of course, when a predator "desctructs" a prey and the prey
is in two moving parts, the predator needs to follow the parts
etc... but we considered that such effects are not really
meaningful. In v2.x, you can write your own collision handler
so that only a portion of energy is transferred from prey
to predator on each collision, which is simpler and more
intuitive. You could even try to make energy level of prey affect
the work of its neurons, etc.

As to writing scripts, it is good to copy a simple expdef
(like reproduction.expdef) to a different name and start
modifications. See the following resources:

http://www.framsticks.com/common/tutorial/index.html (with section IV)
http://www.framsticks.com/common/script/expdef.html
http://www.framsticks.com/common/script/pres/sz_scripting_pliki/frame.htm

Good luck,

Macko