Ecology Musings III: Rethinking

In my last musings post I put forth the proposals that:

  1. Plants should live for at least as long as it took them to grow, and
  2. Beyond that, their lifespan will depend on availability of resources.

Since then I’ve done some fiddling with the numbers, however, and discovered that just doesn’t work, if I stick with my use of the average of available CAs to determine the tick setting. I even changed the arbitrary minimum divisor based on the average of available CA levels from 0.01 to 0.1, but it still worked out that plants in areas with poor resources lived significantly longer than their counterparts in fertile areas.

I’m still real attached to the idea that it should take plants longer to grow with fewer resources, but I can’t accept having them actually have longer lifespans, so I had to go back to the drawing board. I figured that while I was at it, I might as well look into seasonal growth too, which meant I had to find out about seasons, and probably come up with a new approach that measured lifespans in some amount corresponding to them in some way.

According to Liam, one real-world second is about 19.5 ticks. Somewhere over on CDN, I learned that one game day is 20 minutes long, so:

19.5 ticks/sec * 60 sec/min * 20 min/day = 23400 ticks per game day

And finally, there are 4 days per season in C3/DS, with the usual 4 seasons; spring, summer, autumn, and winter. Now, how to put all of this together?

The approach I’m working on now is that timer cycles are still determined as before, by dividing some base value (currently 50 for bleubells and 100 for starflowers) by the average of available resources. This results in values ranging from around 56 ticks up to 500 (my arbitrary maximum for rooms with no appreciable CA levels). Except for the new arbitrary minimum, this part is the same as before.

The new part is that I decided to allow the plants to have approximately the same lifespan in poor-quality areas as in fertile areas. For bleubells, I set that at one game day, and for starflowers, two. The new versions will grow at the rate allowed by room CA levels, whether fast or slow, and then every so many cycles (currently 40 for bleubells and 80 for starflowers) they get to produce a seed. At the end of their lives, they get to splurt out one last seed, and then they spend their last few remaining cycles dying. (And no, most plants don’t produce seeds throughout their lifetimes, but hey, they’re not EARTH plants, so a little bit of weirdness should be okay, as long as it makes sense in some way!)

For plants in poor-resource areas, the result is that although they live as long as their counterparts, they spent a larger proportion of their lifespan growing. Once they reach adulthood, they don’t get as many chances to seed. Using the numbers I’ve mentioned here, the plants in the poorest areas will produce a maximum of two seeds in their lifespans, while the ones in fertile areas could produce as many as…well, I haven’t calculated it, and I’m feeling lazy, so we’ll just say somewhere around 10. Roughly. I think.

I’m thinking that seeds shouldn’t sprout in winter. But what happens to the plants who sprout right at the tail-end of autumn? I think in my first attempt I’m going to shorten their lifespans, and see how that works. There’s an OV variable that keeps track of how many ticks they’ve lived; I’ll stuff it with extra ticks each time through the timer script so they age faster, and see how that works. If so, it offers the potential of having different lifespans based on seasons as well as CAs — for instance, plants live longest in the springtime, with gradually shorter lifespans through summer, autumn, and winter.

I’m hoping to get a new version of both flowers up today that incorporates these changes, so that people interested in these insanely minute details can play with them and add some feedback.

Things I still haven’t thought too hard about:

  • how to decide how much of each CA the plant consumes per timer cycle
  • how much should be returned when it dies
  • the fact my plant agents are injected as plants, and therefore could be injected in the middle of winter, and whether I’m okay with this

Ecology Musings, Part II

Continued from Part I

Here are some of the basic “rules” I’ve come up with so far, for my ecology-aware plant agents:

Seeds will sprout, if they’re in soil, whether the room has the required CAs or not.

It’s no fun for users if things don’t work at all, so I don’t want to “penalize” players for room developers who haven’t paid attention to CAs. So things will still grow in CA-less rooms, just a lot more slowly.

Right now I’m not differentiating between types of soil (boggy, normal, drained), on the assumption that the moisture CA levels may already reflect this. When I learn more about the CA levels, I’ll have a better idea whether I need to change this.

Plants require light, moisture, and nutrients.

I’ll probably add in heat later on, but I haven’t gotten a good feel yet for what “temperature” ranges are in the game, and how cold or hot they are.

My current calculation for this is pretty simple. I add up the CA numbers for light, moisture, and nutrients in the room, and divide by 3 — this just averages the numbers. If this number is zero (there are no CA levels), I arbitrarily set it to 0.01. Here are some results of this calculation from the C3/DS areas that have soil:

Aquarium: 0.02
Desert: 0.25 – 0.89
Jungle: 0.39 – 0.49
Norn Terrarium: 0.47 – 0.72
Norn Meso: 0.54 – 0.89

Each plant has a “base” growth rate, which is the TICK setting for the timer script. For the bleubells, for example, this rate is set to 50. I divide the base growth rate by the CA average to get the modified TICK setting for the current plant in the current room. For the CA averages shown above, this results in a modified growth rate ranging from 3000 ticks per stage in the aquarium to 56 ticks per stage in the desert and meso.

Plants should live for at least as long as it took them to grow.

Bleubells, for example, take 10 timer cycles to reach adulthoood. So it seems fair that they should live for at least 10 more cycles beyond that.

This is pretty arbitrary, and is in line with my “it’s no fun if you can’t have plants just because the developer was lazy” theme. I decided this when I realized, after coming up with the modified tick rate based on resources, that it made sense to slow down plant growth, but the result was that those plants also lived MUCH longer than their counterparts in other, richer areas. Which led to…

Beyond that, their lifespan will depend on availability of resources.

The bleubells take 10 cycles to grow, and their unmodified lifespan was set to last 50 more cycles once they were fully-grown. My latest modification to them, which will be posted in the next few days (and soon after that for the starflowers), shortens this lifespan. Here’s the math: First I subtract the minimum lifespan (10) from the total (50). This leaves me with 40, which represents the base additional lifespan possible, depending on availability of resources. I multiply this number by the CA average determined earlier, which, for the C3/DS rooms results in a number ranging from 0.67 to 35.5, and then add back the “minimum” lifespan of 10. This number then becomes the setting for how many times the timer script will run before the plant is set to die.

My alarm has just informed me that it’s time to stop playing and get ready for work. In my next installment I’ll talk about use of CAs, death, and returning CAs to the environment. In the meantime, tell me what you think! Would you do things differently? How/why? What other factors (seasons, day/night) should come into play, and how?

Other things I’ve thought of while writing this post (Look! A bunny!):

  • What should happen to a plant that is picked up, while it is being carried? (Right now, the timer just stops until it’s dropped.)
  • What happens after it’s dropped? (I think right now they just keep on growing, even if not dropped back in soil. I should probably fix this.)
  • I also need to talk about population controls and minimum spacing.
  • I really need to take the sandbags out of the bed of my truck.

Ecology Musings, Part I

Since Amaikokonut got me to thinking about the ecological interactions in C3/DS I’ve been tinkering with my agents to make them more ecologically participative. One of the frustrating things about this, though, is that there are no real standards or guidelines out there for any of it. So as a beginning CAOS coder, I’m constantly running into questions there are no ready answers to:

  • How long should it take for a seed to sprout / plant to grow?
  • How long should it live once it’s grown?
  • How many offspring should it produce? How often?
  • How close together / far apart should they be allowed to grow?
  • How many dormant seeds should I leave lying about for norns to snack on?
  • What’s a reasonable amount of Cellular Automata (CA), or resources, to expect to find in a given room?
  • How much of which CAs should be present for a plant to grow?
  • How much of which CAs should the plant consume while it grows and lives?
  • How much should it return to the environment when it dies?

And on, and on…

Since I’ve had to make arbitrary decisions about these things as I go, I thought I’d start writing down the standards I’m setting for my own agents, not only for myself, but maybe to start some collaboration going, so that more new agents will use the amazing environmental interplays, and maybe in more consistent ways, to make the game more interesting.

So this post will be the beginning of a set of guidelines for me to follow in my own coding, and I hope others will jump in and contribute their thoughts about the questions I’ve listed, and maybe more that I haven’t thought of yet. Because the more people participate, the more the resulting agents will make sense to everyone, and the more interest and fun we can add to the ecological side of the game.

Meanwhile, I have to go to work, so the rest of the thoughts bouncing around in my head will have to stay there for another day. 🙂

Read Part II