Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Getting ready for life in the Terrarium

I've been working on Herbert (my Terrarium Herbivore) this week and I've made some pretty good progress. When I started I just grabbed a Herbivore Skeleton and ran it - I actually introduced it into and environment chock-full of plant and no Carnivores just to observe how it acted of it's own accord. I noticed that, although they had no competition, my Herbert species would eventually become extinct after several hours due to poor ability to reproduce. In fact, I ran the game for 10 hours and 80 Herberts reduced to extinction after about 12 hours.

Chapter 10 of the Advanced Developer Documentation talks about the requirements for reproduction; they are:

  1. You must be Ready to grow. That is, your current State must be IsMature and the current GrowthWait must be zero.
  2. You must a have normal or greater energy level
  3. You must have room to grow - this could be up to 8px distance from any plant or creature.

So, from that, I was able to determine that the cause of my reproduction issues was that I never quite had enough room to reproduce because I was always parked up against a Plant feeding. So, I changed my original algorithm:

Original algorithm
If Me.CanEat Then
    BeginEating(targetPlant)
End If

New algorithm
If ShouldEat() Then
    ....
Else
    ' this allows me to back off which increases my liklehood of reproduction
    If NearToPlant() Then
        MoveAwayFrom(targetPlant) 
    End If
    If CanReproduce Then
        BeginReproduction(Nothing)
    End If
End If

I recompiled Herbert1 and ran it. After 30 minutes in an identical environment to the original Herbert my population had grown from 10 to 240! It stayed at ~240 for the remainder of the game (due to sickness etc) so, this improvement solved my reproduction issues.

My next tasks are to build in some smarts regarding the conservation of energy, early detection of predators and escaping algorithms.

1 Comment

  • hi,



    as you mentioned above you play in the terrarium game - my question is - is there other way to play it when you are over NAT or firewall than this given by Terrarium doc (they say that I need to translate the 5000 port on NAT) - couse I want my bug on it... Or maybe I have to set up my own server to do this in local network ?



    --

    best regards

    & have a nice weekend ;-)

Comments have been disabled for this content.