ID:168796
 
Odd trying to code again, been so long yet again. Well, here goes.

I've been looking at several things. Namely creating an environment that is run without any player interaction. Trees grow and die. Water spreads or shallows through flood or drought. Weather changes. Day and night interchange. Animals breed and die. Paths are formed from being tread and dirt fades to grass from being left alone.

The problem I've ran into now is a tree turf spawning another single tree turf in only 1 tile within its oview(1) randomly(Any turf/grass in oview(1) of the tree, but only 1.) and completing its life and dying off, deleting the tree turf completely.

Anyone mind giving some help on how I can go about doing this? If you need more description on the situation I can post again and try.
I have troubles with turfs, just make the turf an obj and use it as an obj, it should work..
In response to DarkMystic182
One thing you could do, is, in your grass turf, check to see if there is a tree in oview(whatever), and have like a chance for it to turn into a tree. Or maybe you just want them to spread over time. The thing is, this creates dense forest, no space in between trees.

I really like your idea
In response to Nukes4U
The problem is...do you seek to make a persistent world that goes on after world wipe? Than youll need external variables that are saved and read from a website...and that requires advanced coding...
Jowy wrote:
The problem I've ran into now is a tree turf spawning another single tree turf in only 1 tile within its oview(1) randomly(Any turf/grass in oview(1) of the tree, but only 1.) and completing its life and dying off, deleting the tree turf completely.

For trees, you might not want to use turfs. If you're making something as flexible as you want it to be, you would want to use an obj.

For your question, it isn't really difficult to spawn another tree one tile away from another tree.

obj/tree
icon = 'blah.dmi'
proc/die_and_spawn()
var/list/turflist = list() // get a list of grass turfs
for(var/turf/grass/G in oview(1, src))
if(!locate(/obj/tree) in G) // make sure there isn't already a tree
turflist += G
if(turflist.len) // only spawn one if there is space to spawn
var/turf/T = pick(turflist) // randomly pick one
new /obj/tree (T)
del(src)


Unless I misread what you wanted to do, this should do.

~~> Dragon Lord
In response to Unknown Person
You may want to had in prob() in there, you know, for randomness. =p
In response to Lou
From a website? No need, just save some savefiles onto the host's PC.