home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 2: PC
/
frozenfish_august_1995.bin
/
bbs
/
graphics
/
megajr13.lha
/
MegaJitter
/
README
< prev
next >
Wrap
Text File
|
1994-05-30
|
19KB
|
559 lines
*****************************************************************************
* *
* PUBLIC DOMAIN SOFTWARE LICENSE *
* *
* ++++++++++++++++++++++++++++++ *
* *
* *
* The following program(s) and/or data file(s) are declared Public Domain. *
* *
* Conditions of use: *
* ------------------ *
* *
* 1) No part of this distribution will be omitted (incl. this README file) *
* 2) None of the Copyright texts will be modified or deleted. *
* 3) None of the files should be stored and/or converted onto environment- *
* ally damaging media. (paper listings, faxes, etc...) *
* *
* Provided the end user sticks to the above mentioned author's wishes, he *
* or she is authorized to use, copy, analyze and improve the items. *
* *
* *
* The Author, *
* *
* Laurence VanhelsuwΘ *
* *
* Auroville 19/MAY/94 (India) *
* *
* *
*****************************************************************************
-------------------------------
Program Title: MegaJitter V1.3
-------------------------------
Author: Laurence VanhelsuwΘ
0. Short description
1. Requirements/Installation
2. How to use it
3. Internals
3.1 Command Line Options
3.2 Creature Genes
3.3 AREXX Support
3.4 Speed Optimizations
4. Limitations/Warnings
5. History
6. Future
7. Bibliography
8. Credits
0. Short description:
------------------
MegaJitter (from now on: MJ) is a biological Evolution simulator.
It tries to simulate a simple ecosystem with creatures which eat, get born,
procreate and die.
Believe it or not, but without ANY pressure on the program's part, these
creatures often EVOLVE into new species which are optimally adapted to their
environment !
Many different environment scenarios can be configured for MJ, with totally
different species emerging.
The main "Laws of Nature" the program codifies are as follows:
- if you eat food, you get X energy points
- moving costs energy
- if you run out of energy, you die.
- if you reach a fitness threshold, you're allowed to procreate.
- any offspring get copies of your genes, but in slightly mutated form.
MJ Doesn't have miracles, the Fittest Survive, that's the bottom line.
On the Amiga, MegaJitter's dual-screen approach offers a full screen of
graphical statistics plus the actual ecosystem with pixels representing food
and creatures.
For research purposes, the animated ecosystem can be disabled for faster
simulations (overnight runs for example).
1. Requirements/Installation:
--------------------------
This Release (V1.3) contains the following directories/files which should
be copied into an empty directory called "MegaJitter" (or something like it).
==================================================
SCENARIOS (dir)
CHAINREAC Clusters
Hedges Oasis
REXX (dir)
GOD MSC
.Product-Info ja.s
makefile mj
mj.c mj.wth
README SCOPTIONS
==================================================
Required:
---------
- V39 of the Amiga OS.
- a 68020-based Amiga or better.
- at least 1.5 Mb of RAM to run.
Optionally:
-----------
- AREXX for external program control.
2. How to use it:
--------------
This distribution actually contains 3 programs: MegaJitter (MJ) proper and
two supporting REXX utilities.
For MegaJitter itself,
Just type: "MJ"
Or "RUN MJ"
or MJ followed by any of the command line options.
(type "MJ ?" for a list or see below for details)
The two REXX programs are GOD and MSC and control or configure MJ, respectively.
- MSC Stands for "MJ Set Scenario" and takes one argument: a MegaJitter scenario
file.
For example, to configure the "Oasis" scenario you would type:
RX MSC SCENARIOS/OASIS
'RX' Is of course the REXX program dispatcher. You can omit this if you are
using a Shell which allows direct execution of REXX programs.
- GOD Is a MegaJitter scenario finder. It generates random sets of starting
parameters and configures MJ to use them.
Then, for about 15 minutes it monitors the running, simulated environment
to see if the parameters result in a stable ecosystem.
If so, it dumps the settings to the screen, otherwise it kills off the failing
ecosystem and generates a new set of parameters, ad infinitum.
Use as follows:
RUN RX GOD >godlog ;capture all output in file 'godlog'
3. Internals:
----------
3.1 Command Line Options
--------------------
The CLI command template for MegaJitter is :
AUDIT/S,DATALOG/S,NOANIM/S,VISION/S,SEX/S,SHOWDEFAULTS/S,MAX_BUGS/K,
INIT_BUGS/K,INIT_FOOD/K,INIT_ENERGY/K,INIT_VARIANCE/K,MUTATE_RANGE/K,
FOOD_RATE/K,FOOD_ENERGY/K,X_AND/K,Y_AND/K,OASIS_SIZE/K,NTSC/S
For those not yet 100% familiar with the 2.0 DOS template syntax, here's
a quick guide:
labels followed by:
/S mean that they are used on their own to enable some feature (a |S|witch)
/K mean that they should be followed by a value (a |K|eyword)
Note: numerical parameters have lower and upper limits. See section 3.3 for
figures.
-----------------------------------------------------------------------------
AUDIT Enable full internal audit of creature processing.
This will show you (in the CLI window) what each particular
bug is doing, and sometimes, why.
Example: MJ AUDIT NOANIM INIT_BUGS 1
Default: AUDIT is OFF
-----------------------------------------------------------------------------
DATALOG Dumps the statistics in numerical form to STDOUT.
This is useful if you want to capture the statistics for
further analysis, like correlation of variables, etc...
Example: MJ DATALOG NOANIM INIT_FOOD 1000 > MJ_RUN043.DAT
Default: DATALOG is OFF
-----------------------------------------------------------------------------
NOANIM Inhibits the opening of the animation screen and lets the
program use a much more efficient representation for the
ecosystem, allowing faster simulations.
Example: MJ NOANIM
Default: NOANIM is OFF
-----------------------------------------------------------------------------
VISION Enables the VISION capability (gene) for all creatures.
With VISION on, creatures can SEE food and override their
genetic movement pattern somewhat so that they can home in
on food directly.
Normally creatures are completely blind and rely on bumping
into food frequently enough to survive.
Vision gets modulated by the DAY/NIGHT oscillator.
Example: MJ VISION AUDIT INIT_BUGS 35 OASIS_SIZE 20
Default: VISION is OFF
-----------------------------------------------------------------------------
SEX Enables the SEXUAL reproduction gene for all creatures.
Normally creatures just split asexually when they can,
producing offspring with slightly mutated copies of the
"mother" creature.
With SEX on, creatures can be 0..100% sexual creatures.
100% Sexual means that the creature always needs to find a
sexual partner to procreate. Only partners which are at
least as healthy as the originator are chosen.
Example: RUN MJ SEX OASIS_SIZE 20 FOOD_RATE 2
Default: SEX is OFF
-----------------------------------------------------------------------------
SHOWDEFAULTS Dump settings of all internal parameters.
Handy to find out the built-in default scenario settings or
to see what the resultant settings look like when you
override some or all of the built-in defaults on the command
line.
Example: MJ INIT_BUGS 100 MUTATE_RANGE 20 SHOWDEFAULTS
Default: SHOWDEFAULTS is OFF
-----------------------------------------------------------------------------
MAX_BUGS Maximum number of creatures the simulator can handle.
The program dynamically allocates an array to hold MAX_BUGS
creature structures.
Example: MJ MAX_BUGS 500
Default: 300
-----------------------------------------------------------------------------
INIT_BUGS Initial number of creatures when program starts.
The initial population consists of completely random
creatures.
See also INIT_VARIANCE.
-----------------------------------------------------------------------------
INIT_FOOD Initial amount of food (-pixels) strewn across the plane.
-----------------------------------------------------------------------------
INIT_ENERGY Average starting fitness of creatures.
-----------------------------------------------------------------------------
INIT_VARIANCE Initial genetic variance in the starting creature pool.
This variance is distributed evenly around middle value (128).
-----------------------------------------------------------------------------
MUTATE_RANGE Allowable aggressiveness of mutations.
If it's too low, then your creatures will not evolve, as
they won't be able to "jump" the required distance to find
new, stable genetic configurations.
If it's too high, then genetic inheritance breaks down,
since offspring now essentially become random creatures
again, and bear no resemblance to their parents.
-----------------------------------------------------------------------------
FOOD_RATE Rate at which food grows.
For every N timesteps, the program puts down one food unit.
Therefore smaller values mean higher food growth rates.
Example: MJ FOOD_RATE 1 ;highest food growth rate!
-----------------------------------------------------------------------------
FOOD_ENERGY How much one food pixel packs in energy.
-----------------------------------------------------------------------------
X_AND
Y_AND These two parameters can affect the way food is distributed
in normal (non-OASIS, see below) mode.
As random (x,y) coordinates are generated to grow some food,
the coordinates are always ANDed with X_AND and Y_AND respec-
tively.
This allows you to grow food in straight "hedges", either
vertically or horizontally, or even simulate rectangular
fields of growing food.
Default: 1 (for both)
-----------------------------------------------------------------------------
OASIS_SIZE If this parameter is set, food will grow only within a
circle in the middle of the screen.
OASIS_SIZE is the radius of the circle.
X_AND and Y_AND are not active in this mode.
-----------------------------------------------------------------------------
NTSC This option forces the program to open a shorter statistics
screen, to support American NTSC monitors/Amigas.
-----------------------------------------------------------------------------
3.2 Creature Genes
--------------
Nearly all genes have a numerical meaning which control a PROBABILITY.
Internally, genes are encoded as BYTEs (unsigned) so the numerical range
per gene is 0..255.
Some genes use this scaled up (like the age genes) or scaled down (like the
vision gene).
Here is the full list of genes implemented so far:
right, left : these two genes control a creature's movement pattern.
If for example gene 'right' is nearly 100% (ie 255), then
it is nearly 100% certain that the current bug is going
to make a CLOCKWISE turn of 45 degrees on his next step.
Gene 'left' similarly controls ANTI-CLOCKWISE turns.
If for example both genes are close to 0% then the bug
will essentially move in a straight line.
speed : This gene determines a moving DELAY.
0 Means no delay, 255 means max delay, resulting in a
very slow creature.
(scaled down to 0..7)
dying_age : 0..65535. Designed built-in lifespan.
If a creature is very healthy when he/she reaches this
age, then his energy level is used to counteract this
guideline limit.
minsexage : 0..4095. Minimum age before a bug can procreate.
maxsexage : 0..65535. Maximum age for procreation.
procr_energy : 0..16384. Minimum energy before procreation can begin.
foodtype : 0.. 63: mainly HERBIVORE
64..191: mainly OMNIVORE
191..255: mainly CARNIVORE
Since the gene is used probabilistically, a 99% carnivore
can sometimes be seen to eat grass !
vision : 0..63. Vision range in pixels, in the current moving
direction. Bugs don't have peripheral vision AT ALL.
When many bugs have good vision, the program has to do a
LOT of work just to support the vision element !
sexuality : Like foodtype, probabilistic gene. 0 = ASEXUAL to 255 =
SEXUAL. Anything inbetween gives you biased mixtures.
Sexual reproduction requires a mate physically touching
the sexually mature creature ! (Difficult to get in desserts
with just a few creatures roaming around !).
3.3 AREXX Support
-------------
Currently the following AREXX commands are implemented:
"MJ_QUIT" Quits MJ immediately.
"MJ_RESET" Restarts a simulation with current settings.
"MJ_DUMPDEFAULTS" Dump settings to CLI window.
"MJ_SEX" Enable Sex Genes.
"MJ_NOSEX" Disable.
"MJ_VISION" Enable Vision Genes.
"MJ_NOVISION" Disable.
The following commands are QUERIES, which return information via the RC
special AREXX variable. Use RC to retrieve values.
"MJ_BUGS?" Queries the number of bugs living.
"MJ_RUNS?" Queries the number of simulation runs so far.
"MJ_TIMESTEPS?" Queries the age of the current simulation.
The following global parameters can be set at any time by using a syntax
like the following:
<PARAMETER_NAME> <value>
PARAMETER_NAME LOWEST HIGHEST
-------------- ------ -------
"INIT_BUGS" 1 100
"INIT_FOOD" 1 30000
"INIT_ENERGY" 10 15000
"INIT_VARIANCE" 1 250
"MUTATE_RANGE" 1 120
"FOOD_RATE" 1 100
"FOOD_ENERGY" 1 5000
"X_AND" 1 260
"Y_AND" 1 260
"OASIS_SIZE" 0 50
Note that each parameter has a minimum and maximum acceptable value which
should not be exceeded.
Also note the LACK of the "MJ_" prefix (sorry).
3.4 Speed Optimizations
-------------------
Instead of using WritePixel() and ReadPixel() I wrote my own optimized
versions.
Since the ecosystem screen is 512x512 (x4), I eliminate the overhead of
having generic code for variable screen dimensions.
Also, for the general plot_pixel I have an array of pixel-setting routines,
one for each pen value. This eliminates the typical shift register, then
set or clear the bit-loop.
Since most pixels in MegaJitter will have to be erased again because of the
mobility of the creatures, plot_pixel actually caches the end results of
its calculations (the byte offset and the bit number), so that we can have
a very, very fast fastwipe_pixel.
Since checking for a food pixel or empty pixels is also very common, I also
wrote custom routines for that.
Late in development I converted all the above routines to even faster ones
by having the screen as an INTERLEAVED bitmap.
This allows the use of just one pointer to the bitmap (instead of 4
previously), which simplifies code quite a bit, thus speeding it up again.
4. Limitations/Warnings:
---------------------
Internally, a gene is encoded as a byte having a numeric range of 0..255.
The random number generator uses the Amiga video beam x/y position register
to help randomize the numbers; because of this you can't currently replay
EXACTLY a previous simulation, as the random numbers are REALLY random !
Occasionally, you might observe some BUG warnings about rogue pointers and
the like... these are harmless in this release.
5. History:
--------
I started writing MegaJitter in 1992 when I had become addicted to watching
a similar program, called "Jitter" (by Don Reble & Chris Gray), for hours and
hours and hours.
In the beginning I even tried analyzing Jitter's run-time behaviour (with
homebrew tools like HeartBeat (also PD)) to see if I couldn't optimize the
speed by patching this or that. I was horrified to learn that Jitter used
something like RectFill() to draw its bugs on the screen... obviously a quick
hack !
The answer was clear: I would have to write my own, but optimized for speed.
6. Future:
-------
I am acutely aware that my simulation is not "open ended", like Nature really
is. By this I mean that, apart from the millions of permutations possible
with the genes and the environmental parameters, MJ is CLOSED. It won't let
new "Laws of Nature" evolve, or let the creatures develop any intelligence.
They can't develop brains... yet.
A desirable future change would be to give creatures private, programmable
"program space" so that they can learn, remember, re-program their
behaviour.
There should be no distinction between inanimate "grass" food and living
moving grazers.
On the Human Computer Interface front (and what a battlefield it is !), I
would like to add a fully interactive control panel with sliders and
switches to control MJ further.
I am thinking of using the REXX interface to implement this.
Further speed optimizations are possible.
The handle_bug routine should be the focus of attention as it is the
bottleneck.
The whole program should also be re-compiled with the new register parameters
option.
7. Bibliography
------------
"Artificial Life: The Quest for a New Creation" by Steven Levy
ISBN 00-224-03599-1 (PUBLISHER: Jonathan Cape)
This is an INCREDIBLE book. Worth getting a copy if you're remotely
interested in this program.
See also:
- the original 'Jitter' (by Don & Chris)
- 'Evolution' on Fish Disk #239 (by Russel Yost)
8. Credits:
--------
The following address is my home base (where I haven't lived for 8 eight
years now) but where things will bounce off to wherever my real, current
address is (like India for the mo!).
Laurence VanhelsuwΘ
Christinastraat 105
B-8400 Oostende
Belgium
Original stimulus: Don Reble & Chris Gray's "Jitter"