I guess my first blog here will be about the terrarium competition we are running in Canada. This seem to be the best place to pick up the slack, as that is the last thing I blogged about at theSpoke (www.theSpoke.net).
So what is Terrarium?
Terrarium is a multiplayer ecosystem game developed using the .NET Framework. Developers can create their own creatures and add them into the game on their own client machine. The creatures get teleported between clients in the Terrarium peer-to-peer network. So, your bug (herbivore, carnivore or plant) gets teleported and starts fighting against other bugs. The best part is, you can be a beginner and still compete on par with professional developers as there are plenty of sample bugs you can use to get you started.
First, a couple of rules for all those interested to play
1. Plants serve as food to Herbivores
2. Herbivores eat plants and generally dont fight unless attacked
3. Carnivores are the warriors, they kill and eat whatever they see
Here is some code on how to create a sample plant. You may want to introduce platns to the system first, followed by the herbivores.
So,
- Start up Visual Studio.NET
- Click File->New->Project
- In the Project Types pane, click Visual C# Projects
- In the Templates pane, click Class Library
- Come up with a creative name for your project. This will be the name for your plant when you introduce it to the system
- Click OK
- Open Class1.cs source file
- Select all code in the file and erase it.
- Copy the code below and paste it instead of the code you just deleted
using System;
using System.Drawing;
using System.Collections;
using System.IO;
using OrganismBase;
[assembly: OrganismClass("Food3")] // The class that derives from Food
[assembly: AuthorInformation("YOUR NAME HERE", "YOUR E MAIL HERE")]
[MatureSize (26)]
// Point Based Attributes
// You get 100 points to distribute among these attributes to define
// what your organism can do. Choose them based on the strategy your organism
// will use
[MaximumEnergyPoints(10)]
[SeedSpreadDistanceAttribute(90)]
public class Food3 : Plant
{
public override void SerializePlant(MemoryStream m)
{
}
public override void DeserializePlant(MemoryStream m)
{
}
Now you need to add references to 2 libraries you are using
- Select Project | Add Reference
- Select System.Drawing.Dll and click Select
- Then click Browse… and browse to organismbase.dll. This dll will be in the folder that Terrarium is installed in (usually c:\Program Files\Terrarium\Bin). Select organismbase.dll
- Click Open
- Click OK
- Go back to the code and enter your name instead of “YOUR NAME HERE”
- Go back to the code and enter your e mail instead of “YOUR E MAIL HERE”
- Build the executable file from within the IDE by selecting Build | Build Solution
- You shouldn’t have any build errors. If you do, you have done something wrong. Go back and retrace your steps.
- This should do it, you are now ready to submit the plant to the terrarium ecosystem,
Provided you downloaded the Terrarium Client, all you need to do now is
- Click on Introduce
- Browse to the folder your plant is located at à Depending on what you called your plant in step 5 (ie. ReallySimplePlant), then your plant DLL is at “C:\Documents and Settings\v-sashak\My Documents\Visual Studio Projects\ReallySimplePlant\bin\Debug”
- Select your plant
- Click on open
There are several tutorials available on how to create herbivores and carnivores at http://64.201.37.243/Terrarium/documentation/tutorial_cs.aspx
Sasha