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

Last change on this file since 847 was 847, checked in by Maciej Komosinski, 5 years ago

Code formatting

File size: 3.2 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        var nutrient_multiple = 200;
21        Params = { "foodflux" : [0.0000000037815, 0.0000000075631, 0.000000015126], "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]};
22        ShowProperties.visualize = 1;
23        ExpProperties.secPerStep = 50;
24        Simulator.init();
25        last_simspeed = 0;
26        GLDisplay.desiredsimspeed = 50;
27        GLDisplay.minfps = 10;
28        TrackingCam.cam_h = 15; //more side view
29
30        //useful for screenshots:
31        //GLDisplay.world_visibility=2+4; //show only environment and creatures (no background)
32        //GLDisplay.bgcolor=0xffffffff; //white background
33}
34
35function timeScale()
36{
37        //just a draft, this function and all constants in expdef need serious review
38        var localDriveMicronsPerStep = framsToMicrons(getMovePerStep());
39        var foramSpeedMmPerSec = ExpProperties.foramSpeedMmPerMin / 60;
40        var localDriveMmPerStep = localDriveMicronsPerStep / 1000;
41        var localDriveMmPerSec = localDriveMmPerStep * Simulator.simspeed;
42        return localDriveMmPerSec / foramSpeedMmPerSec;
43}
44
45function updateBanner()
46{
47        GLDisplay.banner = "World size is %g mm." % (framsToMicrons(World.wrldsiz) / 1000);
48        GLDisplay.banner += "\nShowing real-time x %g." % timeScale();
49}
50
51function onShowStep()
52{
53        if (Simulator.simspeed < last_simspeed * 0.9 || Simulator.simspeed > last_simspeed * 1.1) //significant change
54        {
55                updateBanner();
56                last_simspeed = Simulator.simspeed;
57        }
58}
59
60function setShowParam(param_id)
61{
62        ExpProperties.[param_id] = Params[param_id][ShowProperties.[param_id]];
63}
64
65function ShowProperties_foodflux_set()
66{
67        setShowParam("foodflux");
68}
69
70function ShowProperties_feedtrans_set()
71{
72        setShowParam("feedtrans");
73}
74
75function ShowProperties_energy_nut_set()
76{
77        setShowParam("energy_nut");
78}
79
80function ShowProperties_stress_set()
81{
82        setShowParam("stress");
83}
84
85function ShowProperties_visualize_set()
86{
87        setShowParam("visualize");
88}
89
90~
91
92property:
93id:foodflux
94name:Food flux
95type:d 0 2 1 ~Low~Medium~High
96
97property:
98id:feedtrans
99name:Energy transfer
100type:d 0 2 1 ~0.0001~0.001~0.01
101
102property:
103id:energy_nut
104name:Nutrient energy
105type:d 0 2 1 ~28908~108908~188908
106
107property:
108id:stress
109name:Stress
110type:d 0 1 1
111
112property:
113id:visualize
114name:Enhance visualization
115type:d 0 1 0
Note: See TracBrowser for help on using the repository browser.