source: experiments/frams/foraminifera/data/scripts/foraminifera.show @ 1152

Last change on this file since 1152 was 1152, checked in by Maciej Komosinski, 3 years ago

Foraminifera show has now smaller world compared to expdef (and adjusted other parameters), so it is better suited for visualization and demonstration

File size: 3.8 KB
Line 
1show:
2name:Benthic foraminifera
3info:~
4There are two species of Foraminiera: longitudal and coiled. The first chamber of the longitudal species has orange marks. Haploid and diploid generations alternate in both species. All chambers of the haploid generation have the same size. In the diploid generation, subsequent chambers are bigger than their predecessors.
5
6Nutrients are shown as tiny green cylinders. Foraminifers move towards nearest nutrients and this way they can accumulate enough energy to reproduce.
7
8When the "Enhance visualization" option is enabled, reticulopodia are shown as large disks and positions of nutrients are indicated by cuboids. 
9
10More information at www.framsticks.com/foraminifera
11~
12expdef:foraminifera
13code:~
14
15global Params; //to easily transfer changes in identical properties from this show to expdef
16global last_simspeed; //to display time scale when it changes significantly
17
18function onLoad()
19{
20        // Since Theater is mostly for demos and visualization, we make the world smaller (than set by expdef) for clarity, and adjust other parameters accordingly
21        World.wrldsiz = 100;
22        var nutrient_multiple = 200;
23        Params = { "foodflux" : [0.000000037815, 0.000000075631, 0.00000015126], "feedtrans" : [0.0005, 0.001, 0.002], "energy_nut" : [nutrient_multiple * 144.54, nutrient_multiple * 544.54, nutrient_multiple * 944.54], "stress" : [0, 1], "visualize" : [0, 1]}; //a set of smaller food fluxes because of the smaller world
24        //larger initial energies result in fewer individuals that do not overcrowd the small world:
25        ExpProperties.energies0_haplo = 60;
26        ExpProperties.energies0_diplo = 3.75;
27        ShowProperties_foodflux_set(); //force call of the value change handler
28
29        ShowProperties.visualize = 1; //calls value change handler
30        ExpProperties.secPerStep = 50;
31
32        Simulator.init(); //calculates some parameters based on the current world size
33        last_simspeed = 0;
34        GLDisplay.desiredsimspeed = 50;
35        GLDisplay.minfps = 10;
36        TrackingCam.cam_h = 15; //more side view
37
38        //useful for screenshots:
39        //GLDisplay.world_visibility=2+4; //show only environment and creatures (no background)
40        //GLDisplay.bgcolor=0xffffffff; //white background
41}
42
43function timeScale()
44{
45        //just a draft, this function and all constants in expdef need serious review
46        var localDriveMicronsPerStep = framsToMicrons(getMovePerStep());
47        var foramSpeedMmPerSec = ExpProperties.foramSpeedMmPerMin / 60;
48        var localDriveMmPerStep = localDriveMicronsPerStep / 1000;
49        var localDriveMmPerSec = localDriveMmPerStep * Simulator.simspeed;
50        return localDriveMmPerSec / foramSpeedMmPerSec;
51}
52
53function updateBanner()
54{
55        GLDisplay.banner = "World size is %g mm." % (framsToMicrons(World.wrldsiz) / 1000);
56        GLDisplay.banner += "\nShowing real-time x %g." % timeScale();
57}
58
59function onShowStep()
60{
61        if (Simulator.simspeed < last_simspeed * 0.9 || Simulator.simspeed > last_simspeed * 1.1) //significant change
62        {
63                updateBanner();
64                last_simspeed = Simulator.simspeed;
65        }
66}
67
68function setShowParam(param_id)
69{
70        ExpProperties.[param_id] = Params[param_id][ShowProperties.[param_id]];
71}
72
73function ShowProperties_foodflux_set()
74{
75        setShowParam("foodflux");
76}
77
78function ShowProperties_feedtrans_set()
79{
80        setShowParam("feedtrans");
81}
82
83function ShowProperties_energy_nut_set()
84{
85        setShowParam("energy_nut");
86}
87
88function ShowProperties_stress_set()
89{
90        setShowParam("stress");
91}
92
93function ShowProperties_visualize_set()
94{
95        setShowParam("visualize");
96}
97
98~
99
100property:
101id:foodflux
102name:Food flux
103type:d 0 2 1 ~Low~Medium~High
104
105property:
106id:feedtrans
107name:Energy transfer
108type:d 0 2 1 ~0.0001~0.001~0.01
109
110property:
111id:energy_nut
112name:Nutrient energy
113type:d 0 2 1 ~28908~108908~188908
114
115property:
116id:stress
117name:Stress
118type:d 0 1 1
119
120property:
121id:visualize
122name:Enhance visualization
123type:d 0 1 0
Note: See TracBrowser for help on using the repository browser.