Jump to content

Recommended Posts

EUG-2.jpg

 

 

FILE

EUG 1.02 (Dropbox, APL-SA license)

 

 

INTRODUCTION

Not sure, if there's any point in releasing this toy, but you never know, who's watching... Different types of weirdos are out there, so why should it collecting dust hidden in the dark corner of HDD... Anyway. 

 

EUG is an experimental SQF script that tries to model basics of ecosystem. Everything is visualised on the 2D map, nothing to see in 3D. At this point there's no any user-friendly GUI, so any tweaking would require script editing with some global variables given in init.sqf. Every organism is in fact an array of values ("genome"), visually represented by a marker, marker characteristics correspond to certain genome values. Simulation runs in cycles, and at least with my CPU it can take even several minutes when number of organisms exceed few thousands. 

 

Mostly for optimization purposes whole land mass is divided into square sectors. Some calculations performed each cycle per each organism require information about near(est) other organisms, which is obtainable way cheaper, if we determine the occupied sector and focus on organisms inside it. Acceptable simplification. Each species can mutate at procreation (next generation may inherit altered genome). 

 

Initial population is generated "ex nihilo" by randomization a set number of seeds/"hatchlings" around player's position. Scenario is automated - it will open the map and start initial seeding till some plant survive. Herbivores are added at 100 plants, carnivores - at 100 herbivores. Since initial genome is random, result my strongly vary each run. It is possible, initial plant will die before any successful seeding, in that case just restart the scenario. 

 

At shift+LMB simulation will pasue, there will be shown temporarily a marker with enviroment values at clicked pos, also nearest organism's genome will be shown and logged into RPT. LMB to resume simulation. 

 

As for further development, no particular plans, but if something comes to mind, the file shall be updated. Feel free to experiment with the code. 

 

Low quality video sample on Twitter (wip version).

 

General simulation variables:

 

RYD_ECO_Speed = 1;//pause between cycles in seconds.
RYD_ECO_InitSeed = 100;//amount of seeds randomized at init "ex nihilo". Divide that by 20 for herbivores and carnivores. 
RYD_ECO_FLocRad = 200;//sector radius (halved dimension). The bigger, the cheaper calculations, but less accurate simulation. By default 119 sectors on Stratis. 
RYD_ECO_Run = true;//if false, cycles will not run. 
RYD_ECO_ShowSeed = false;//if true, seeding is visualised. Slowes down simulation.
RYD_ECO_ShowLifers = true;//if false, there's no visual representation for organisms (juggling with numbers behind the scenes only). 

 

There are 4 main elements of the simulation: environment, plants, herbivores and carnivores.

 

 

ENVIRONMENT

Modelled are only few key characteristics:

 

Temperature - may range from -40 to +40 C, half of the map height is warmest ("equator"), top and bottom edges are coldest ("poles"). Locally temperature depends on ASL height (the higher, the cooler).

Variables:

RYD_ECO_BaseTemp = 40;//max temperature (Celsius). Minimal is always 80 degrees lower

 

Humidity - may range from 0 to 100%, depends mainly on ASL height (the higher, the drier), also will be higher close to the shore line. 

Variables:

RYD_ECO_BaseHum = 50;//base humidity at sea level

 

Fertility - represents not only mineral abundance of the soil, but in general - growth friendliness, say, sunlight access etc. Main factor limiting plants density - each alive plant decreases local fertility, while dead plant - increases it. For optimization purposes this value is statistically averaged per each sector (one, shared  value common to whole sector area).

Variables:

RYD_ECO_BaseFert = 5;//base fertility. Lowering this value may greatly reduce plant population (due to less number of successful seeds)

RYD_ECO_FertDiv = 50;//divisor of the value, by which local fertility will be reduced at new plant growth (and raised back when the plant is dead and decomposed). The lower value, the lower possible plant number per area, which makes it good way to regulate plants population density and therefore CPU load

 

PLANTS

 

kwiatek.jpg

 

These organisms "eat" sunlight (accumulating energy), require certain ranges of temperature and humidity to grow and occupy local space by reducing local fertility till death. Procreation via seeding, when certain fraction of max energy capacity is reached. Each seeding certain amount of positions in seeding range are randomized, then tested against seed's requirements stored in the genome. If requirements are met - new plant begins its life there, otherwise - seed vanishes futile. Visualised by solid markers of various colors, shapes and dimensions depending on genome.  

 

Genome structure:

				[
				(random [10,100,1000]),//spreading range 0
				(random [1,15,25]),//spreading amount 1
				(random [0.5,0.75,1]),//spreading energy treshold 2
				_enC,//energy capacity 3
				_enG,//energy gain 4
				[_tMin,_tMax],//temperature range 5
				[_hMin,_hMax],//humidity range 6
				(random [0.1,4.5,10]),//fertility treshold 7
				(random [0.01,0.05,1]),//patogen susceptibility 8
				(random [10,30,100]),//lifespan range 9
				[(random [0.025,0.05,0.075]),1],//[(random [0.002,0.05,0.1]),1],//mutation chance 10
				[],//visual 11
				(position player),//position 12
				RYD_ECO_CycleC,//seeding time 13
				(random [_enC/100,_enC/10,_enC/5]),//stored energy 14
				true,//is alive 15
				"",//marker 16
				locationNull//location 17
				];

 

 

HERBIVORES

 

owca.jpg

 

These organisms "eat" plants. As animals, are mobile and will move if, in order of priority, there's a carnivore to run from, there's discomfort due to hunger (towards best found plant near) or not optimal environment parameters (towards best fitting spot in range) or at random if no plant nor better spot found. Movement costs energy. If organism is near to full of energy, it procreates by direct division (organisms of next generation inherit half of parent's energy each). Uses non-solid markers with pictures.

Genome structure (shared with carnivores):

				[
				(random [100,200,300]),//movement range 0
				_enC,//energy capacity 1
				_enG,//energy gain 2
				[_tMin,_tMax],//temperature range 3
				[_hMin,_hMax],//humidity range 4
				(random [0.01,0.05,1]),//patogen susceptibility 5
				(random [10,30,100]),//lifespan range 6
				[(random [0.025,0.05,0.075]),1],//[(random [0.002,0.05,0.1]),1],//mutation chance 7
				[],//visual 8
				(position player),//position 9
				RYD_ECO_CycleC,//seeding time 10
				(random [_enC/100,_enC/10,_enC/5]),//stored energy 11
				true,//is alive 12
				"",//marker 13
				locationNull,//location 14
				_isCarn//is carnivorous 15
				];

 

 

CARNIVORES

 

dino.jpg

 

Similar to herbivores, but eat herbivores, not plants, feeding on a herbivore kills it (drains energy to 0, part of energy is consumed, the rest is wasted). Don't run from anything. Genome structure same, as for herbivores except last entry is true, not false. Markers as for herbivores, but turned 45 degrees.

 

Well... That's it for now, I suppose. Enjoy? 

 

 

 

  • Like 8

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×