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
RevLine 
[401]1show:
[454]2name:Benthic foraminifera
[401]3info:~
[434]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.
[422]5
[444]6Nutrients are shown as tiny green cylinders. Foraminifers move towards nearest nutrients and this way they can accumulate enough energy to reproduce.
[434]7
[446]8When the "Enhance visualization" option is enabled, reticulopodia are shown as large disks and positions of nutrients are indicated by cuboids. 
[444]9
[407]10More information at www.framsticks.com/foraminifera
[401]11~
[406]12expdef:foraminifera
[401]13code:~
14
[446]15global Params; //to easily transfer changes in identical properties from this show to expdef
[448]16global last_simspeed; //to display time scale when it changes significantly
[423]17
[401]18function onLoad()
19{
[1152]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;
[569]22        var nutrient_multiple = 200;
[1152]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
[847]30        ExpProperties.secPerStep = 50;
[1152]31
32        Simulator.init(); //calculates some parameters based on the current world size
[847]33        last_simspeed = 0;
[401]34        GLDisplay.desiredsimspeed = 50;
35        GLDisplay.minfps = 10;
[442]36        TrackingCam.cam_h = 15; //more side view
[847]37
[503]38        //useful for screenshots:
39        //GLDisplay.world_visibility=2+4; //show only environment and creatures (no background)
40        //GLDisplay.bgcolor=0xffffffff; //white background
[401]41}
[423]42
[446]43function timeScale()
44{
45        //just a draft, this function and all constants in expdef need serious review
[847]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;
[446]51}
52
[448]53function updateBanner()
[446]54{
[847]55        GLDisplay.banner = "World size is %g mm." % (framsToMicrons(World.wrldsiz) / 1000);
56        GLDisplay.banner += "\nShowing real-time x %g." % timeScale();
[446]57}
58
59function onShowStep()
60{
[847]61        if (Simulator.simspeed < last_simspeed * 0.9 || Simulator.simspeed > last_simspeed * 1.1) //significant change
[446]62        {
[448]63                updateBanner();
[847]64                last_simspeed = Simulator.simspeed;
[446]65        }
66}
67
[423]68function setShowParam(param_id)
69{
[486]70        ExpProperties.[param_id] = Params[param_id][ShowProperties.[param_id]];
[423]71}
72
[590]73function ShowProperties_foodflux_set()
[401]74{
[590]75        setShowParam("foodflux");
[401]76}
77
[486]78function ShowProperties_feedtrans_set()
[401]79{
[423]80        setShowParam("feedtrans");
[401]81}
82
[486]83function ShowProperties_energy_nut_set()
[401]84{
[423]85        setShowParam("energy_nut");
[401]86}
87
[486]88function ShowProperties_stress_set()
[422]89{
[423]90        setShowParam("stress");
[422]91}
92
[486]93function ShowProperties_visualize_set()
[444]94{
95        setShowParam("visualize");
96}
97
[401]98~
99
[486]100property:
[590]101id:foodflux
102name:Food flux
[423]103type:d 0 2 1 ~Low~Medium~High
[401]104
[486]105property:
[423]106id:feedtrans
[422]107name:Energy transfer
[590]108type:d 0 2 1 ~0.0001~0.001~0.01
[401]109
[486]110property:
[423]111id:energy_nut
[422]112name:Nutrient energy
[590]113type:d 0 2 1 ~28908~108908~188908
[401]114
[486]115property:
[422]116id:stress
117name:Stress
118type:d 0 1 1
[444]119
[486]120property:
[444]121id:visualize
122name:Enhance visualization
123type:d 0 1 0
Note: See TracBrowser for help on using the repository browser.