Imaginary Realities Imaginary Realities About Search Glossary
What's new? Index :)
Select issue:
Join a discussion Resources

How to Write Effective Mud Help
- Sheila Summers
A Proposal of Marriage
- Kerry Jane
A Contiguous World
- Natalia
The Word Game - Reactions
- Selina Kelley
The Mud World
- Jonathan Untied
Mei Manifesto
- Savant
Creating a viable virtual ecosystem
- Patrick Dughi

Letters to the editor

Enter your email to be informed when this site is updated.

Comment on articles

Letter 1
Contact editors


Creating a viable virtual ecosystem

by Patrick Dughi

Invariably, every mud I have ever played has brought up the idea of a working ecosystem in some form or another. Perhaps it is the latest pokemon craze that has them thinking about evolving creatures. Maybe it is the resource system Ultima Online uses to allow players to generate items. Perhaps they have just played one too many games of SimEarth.

However, few of them ever make this leap out of their static world into this more dynamic universe. That is understandable, as the problems are immense. I would like to present a solution though; a viable ecosystem.

An Australian Lizard

Flora and Fauna, no no! Don't eat that!

What is a virtual ecosystem?

Webster's[1] defines an 'ecosystem' as; the complex of a community of organisms and its environment functioning as an ecological unit. In brief, it is the world and everything that lives in it, and most importantly, the way they interact with each other. We can see this system at work anywhere we look - from oxygen-producing plants and the ocean tides to carnivores and volcanic eruptions. It is a very complex ballet with each piece adding it is own little step.

A virtual ecosystem is an attempt to copy this difficult architecture into a virtual world. It is an attempted stride into a more real-world system. This is a departure from our standard role playing game system, where you face unlimited waves of enemies, or simply leaving and re-entering a room refreshes the recently defeated monster population. Of course, a virtual world has no way of duplicating the enormous formula that runs the real world. Instead, we will focus on what we can reasonably design.

Specifically, we will generate a resource system (minerals and plants) and a way for mobs to realistically reproduce, and perhaps grow. This will be done with an eye towards the end goal of generating a look, feel, and result of having an actual ecosystem. I will warn the hyper-realists out there, there is a few tricks and kludges to get around the intricate dance of nature as it appears in a nasty multiplayer environment.

The Land, and the Air:

The world is like the stage for our ecosystem. Simply, the world is where all the action takes place. It is at once the most important part of the ecosystem and also the least noticeable. This is because the world is slow to change, and for the most part weather patterns are constant and things like mountains and lakes tend to stay in the same place. For the most part. Never underestimate the impact of a volcanic eruption or earthquake.

The first thing you will need in your virtual world stage is space. Lots and lots of space. Many muds are setup with a room-based system, sometimes entire castles sitting in an area defined by less than a hundred ambiguously shaped and sized rooms. Huge mountain ranges, the distance to walk from coast to coast, and the marketplace of a town may all share the same cost in rooms.

From a RPG'ers point of view, this bending of space-time is great - it lets you ignore all that boring, uneventful travel time and lets you get on with the heroic stuff! However, this casual dismissal of a more realistic world view costs you your ecosystem. Without boring, uneventful areas for wheat to grow, or ore to be mined, or even animals to grow and reproduce, you can not have a nice realistic system. We will hit the numbers later on, but for now just realize that you have to have a huge world, filled with all the empty space you can spare. Look at tile based systems like Ultima IV & V, or more recently, StarCraft and Civilization - these are great examples of a huge graphical world. Not every space is used, but all are required for cohesion. For our theoretical ecosystem, I am going to use Ultima's system - a big chess-board like tile scheme, square, that wraps at the edges. My basic system is a simple 1024x1024 square. For those that are counting, this is just over a million rooms. It is built with an eye towards expandability though - assume this 'square' is a zone in the traditional sense. There is no problem linking in another zone as time goes by. In fact, this is how I deal with towns & castles and other standard zones - they are one tile. This is also how I make my world seem 'endless' - by connecting the rooms at the edges to rooms on the opposite edge.

The next thing your world is going to need is some terrain. This is largely up to you, as the world designer, but you can always look at a map of the earth if you need help figuring how to balance your ocean/landmass or mountain/field ratios. The earth is a pretty effective ecosystem if you ask me, and makes a good model. We will hit the numbers on terrains below too, but for now, sketching out a little pattern on a napkin might be good start. Do not forget to include some exciting fjords, high mountain ranges and wide open plains. This is the fun part, so have fun with it.

Your terrain is really what is going to define the livability for that area - desert, swamp, fields, mountains, forests, tundra, etc, all are your base factors for the weather. Below, we compress the effects into a simple chart, but you may wish to generate a complicated dynamic weather system. I feel that this is not worth the effort, since the weather patterns (seasonal effect, average rainfall, etc.) remain constant over time - worse though, all your hard work will probably never be noticed by anyone (unless your players are heavily into meteorology or agriculture, enough to chart the cycles). It is easier to assume regional constants and allow local changes which do not bump the system out of whack. This is especially important if you allow players to alter the weather in subtle (or not so subtle!) ways.

Here is a small bit of a world I happen to run, an island near the tropical equator. This is a generalized form, actually, the real thing is a bit more complex.


Last for the world comes your resources. Technically there are two types of resources, renewable and non renewable (think trees, compared to mined gold). However, we are a multiplayer game. If you choose to make any resource non-renewable, you better have a good system in place for returning it to it is point of origin so that future players may also acquire it. At the same time, if it is always there, what is the point of an ecosystem?

The solution to this problem is simple; have the resource regenerate slower than it can be removed at. If you can remove 10 trees a day from a forest, perhaps a tree takes 20 days to grow back, etc. The difference though, between renewable and nonrenewable resources comes into play here - nonrenewable should still regenerate - but at a much, MUCH slower rate. That way a 'dead' mine will stay dead longer, improving our realism, and the perceived value of what ever is being mined (due to rarity). Both resource types should also have a maximum cap, as you would not want an unrealistic amount of any resource in one area.

Our ecology will have the following resources; trees, grains (subsistence food), fruits (tasty food), herbs (medicinal), metals, and gems. I have two separate layers for this, a vegetation layer, and a mining layer. Lets look at both of them, side by side:

The sprouts*:
The rocks:



* - minus temperature

As you can see, the vegetation map is identical to our terrain map. I almost did not include it, but I thought it would make the mineral map more understandable. In truth, the vegetation map is the combination of terrain type, and temperature for a given area - and because this small island is entirely in one temperature zone, it would be pretty silly to make a map of it. The temperature map itself is simply overlaying squares which define average temperature in the area. Normally, they exist as bands which tend to be warmer towards the equator, and cooler towards the poles. The temperature itself is modified by the terrain type (mountains and tundra colder, desert and plains hotter, etc.).

This union of terrain and temperature gives us our vegetation type. Lets look at one example from a light-forest terrain for just tree type (though similar charts will exist for grains, fruits, and herbs for each terrain type).

Tree type for 'Lt. Forest' Terrain by temperature range



-60 and lower

None 90%, Evergreen 10%

-30 -> -60

None 20%, Evergreen 60%, Deciduous 20%

0 -> -30

Evergreen 60%, Deciduous 40%

30 - > 0

Evergreen 50%, Deciduous 50%

60 -> 30

Evergreen 20%, Deciduous 70%, Fruit 10%


Evergreen 10%, Deciduous 60%, Fruit 10%, Tropical 20%


Deciduous 40%, Fruit 10%, Tropical 50%

Of course, each of these broad groups is broken up into subcategories like 'pine, spruce' or 'oak, maple, hickory'.

One last point about our vegetation map - we need consistency. If you have an oak forest tile surrounded by hickory, no one will care. If you have pine next to elm next to oak, next to cherry, next to maple - people will start questioning the realism. After all forests usually tend to be of one predominant tree. There are two easy ways to keep consistency; hashing, and type seeding.

Hashing is the easiest. The idea is simple - if you take something constant (I use x-y coordinates) and use them as arguments in a formula, you will always get the same result. Hashing is used for fast lookups of data because for a given set of inputs, you will always get the same value - instead of searching 300 names, you just find the hash value and jump right to that entry. My formula may read something like "type= abs(((x/30)%20) ((y/30)%20))" . I will end up with a number from 1-20 which will not change for any given 30x30 area of land. This will be the 'type'. You can use any formula you would like, but the important thing is to hash it so you get square divisions, like my 30x30 area. If you do not know what I am talking about, perhaps the second method is more your style.

Type seeding is simpler to grasp, but harder to program. The idea has two components; having a world builder place a 'type seed' on the world, and setting the random seed used for the world generation.

As a world builder, I would place a 'seed' of oak trees in a forest. The closer a tree was to that seed, the more likely it would be oak. In essence, you plant a seed which blossoms into a forest of that type within a defined radius. The tricky part comes in if you have multiple seeds close enough together to have their areas overlap. Then, you have to weigh the seeds impact on the tree type based on distance - you may have 4 seeds competing for one tile, ending up with something like 20% elm, 40% pine, 30% oak and another 10% from an oak. Then you have to randomly choose one.

This is where the random seed comes into play. As most programmers know, computers generate numbers which are not really random, but the result of a random-seeming function. In actuality, if you start the computer in the same state, it will produce the same random number each time it is run. The random seed is how you set that initial state. The crux of this is, as long as you set the random seed to the same value each time before you randomly choose between the elm, pine, oak or whatever, you will always get the same value. So, by setting the random seed and then choosing the elements of your entire world, you will always end up the same.

The bad point is that this can be difficult to perform in practice.


I bet you thought I forgot them. Well, I did not. Minerals are just so simple though, that I considered skipping over them all together. Because they do not have the same proclivity towards expanding, growing and reproducing, except over many millennia, we can simply make them 100% not random. That is, your world builders should mark each spot on the map where each type of mineral may be found, and how much can be found there. There is not any problem putting two minerals together either, just divide the quantities mined by the percents of each mineral present. You should follow the suggestions above about resources growing back unless you plan to seed the world with these minerals often.

Living things; Vegetation vs. Crawlies:

Vegetation is the first mutable factor in our theoretical ecosystem. We need vegetation to feed creatures who will, in return, feed other creatures and so on. Your players may be only indirectly involved in this, as they will normally prefer to purchase food in its prepared form (bread, instead of wheat, or pixy stix instead of sugar cane). However, that will not change it's impact on the players - if there is no wheat, the players will not get any bread. The crawlies - humans, bears, wolves, all the creatures in your world affect, and are affected by vegetation - they are your second mutable factor.

Remember above where I claimed you needed a huge area? Well, this is because of the size of land needed to support one person. At best case, a sq. mile of farmland can sustain 30 people. Let's start looking at some charts for human-like (intelligent hunters/farmers) characters[2].

Average human population of area based on area category


Average population per 50 sq. mi.









Population modifier based on terrain

Terrain type














*- 100% dependent upon your role playing game (RPG), usually humans do not live literally, on the sea.

Now, take into account the farming/food transportation techniques of a standard medieval society, and you will require that 80% of the population is required to engage in farming or other food-producing industry to the exclusion of all else. To put it another way, a group of people can sustain one quarter of their size of non-food-producing personnel. 300 people can support 75 loafers (bakers, armorers, soldiers, etc.).

This starts to get difficult when the population is as large as it is in suburban areas - even those which allow larger populations (field/flat/coastal) due to their food-producing ability. Generally these areas both contain more skilled labor (i.e., not food-producing), and also the food starts to focus on the specialty/rare types. Roads and engineering advancements (bridges) in those areas do help with food transportation though.

When you get above 10000 people in a 50 mi. sq. foot area, you need surrounding areas with a higher percentage food-producers to support it. There simply is not enough free room. Large cities (like ancient Rome) were literally surrounded for miles with farms. The Aztec's of Central America had the same size civilization size, however their food transportation technology was not advanced enough to sustain them. This is one of the reasons their culture died out. Of course, both Rome and the Aztecs were advanced enough to garner more than the ratios of farmers-loafers given above.

These charts are generally true for all farming creatures - those which are hunters/gatherers have their average population quartered or cut by an eighth (or more!). Those which lack intelligence (wolves, bears, etc.) suffer even more.

(Arbitrary) Average animal population per 50 sq. mi. by animal type


Small Medium Large Huge





















Small - Rodent, bird, etc
Medium - Dog, Wolf, deer.
Large - Jungle cats, bear, moose, etc.
Huge - Rhino, elephant, etc.

Now, keep in mind that this chart assumes direct competition with man-types(based on category type); a given 50 sq mile of wilderness steppe land could provide support for 10 men, 2000 rodents/etc, 200 deer, 40 bear, and 10 rhinos.

This gives us our first theoretical example of our ecosystem at work. Given the above setting, the rodent population (known for their high reproductivity) will probably remain fairly constant. Constant that is, until men start killing rhinos and bears, and deer. In order to support themselves, the five groups come into contention. In this case, as in most cases in the world, men will usually remove the other groups - thus allowing them room to expand. The rhino, bear and deer population start to decrease as the human and rodent population increase - the rodents not being as actively hunted by men - or by other creatures now.

This also gives us our very first problem; Men are the most aggressive expansionistic species known to date. Players in the game are worse - they tend to kill, destroy and maim simply because they can - or because they are rewarded for doing so.

Psychopathic players:

Our example scenario above does not have to happen - after all, you control all aspects of the world. You can make an area static, insofar as the average populations of the animal & humans are concerned. The one thing you cannot control though, is your players. 95% of them will kill, or attempt to kill anything that moves, including sometimes, each other. Your perfect, delicate balance will be up ended.

This is because players will slaughter even the rabbit and town guard populations if they feel even the slightest inclination to do so. If you were to meet a real life player avatar, he would casually look you over, and then drive his sword through you regardless of what he saw. He would be in the next room slaughtering your friends before you hit the ground. You could make the claim that players in real life are jerks.

What I am getting at though, is that standard mud game play is not realistic, and therefore, does not exactly fit into a realistic world ecology. This is the most important concept when we think about making our ecology an attainable one. So, the first thing we do is make the ecology more realistic by taking a step away from realism.


You read that right. See, in our realistic world, the animals would act pretty much like the vegetation resources - they multiply rapidly compared to minerals but the rate is based on how many there already are, and are limited by what the area can sustain. Of course, our unrealistic players are going to slaughter every last one of them. In the end, we have a very real, very empty ecosystem.

What we have to do is hide the animals away in an unrealistic manner so players can not slay them.

To do this, we resurrect the age-old idea of wandering monster encounter charts. In the old Dungeons & Dragons™ system, most areas ended up with charts describing what monsters are simply 'wandering' around, and thus likely to bump into the players. Pretty simple for the players - they still see (and probably kill) the deer, bear, water buffalo, wild turkey, and spiny toad, just about as often as they might if all these animals were just dropped into rooms. However, they can not easily destroy all of one type. As a matter of fact, it is nearly impossible.

Let us look at a chart I use for random encounters:

Random Encounter chart for a Temperate forest


Initial Number/Max


Black Bear



Gray wolf



Red Fox



Rabid Squirrel















There are more, but this gives us an idea. You will have to generate your initial charts based on the population tables way up above, in order to properly integrate the effects of things like cities or packs of wolves on rodent or bear population.

Now, when a player is walking through this forest, a random check is made (say, 1 in 20, or 1 in 30). If it succeeds, then we select a random creature from this chart, based on how many are there. Lets say there is only 200 rabid squirrels and 40 wolves for a total of 240 creatures. Well, we have a 200/240 = 83.3% chance of getting a squirrel, and a 16.6 chance of getting a wolf (ignore the minimums for now).

Say we get a wolf. We pop that wolf onto the map at the same time when the character enters that tile, and decrementing the total count in the forest. Give the animal a timer, say 120 seconds, after which it 'leaves' the room, and returns back to the forest pool. Unless of course, the player has killed it. Your populations will decrease, but so do the chances of a player happening across that particular animal. When you reach the minimum population, you still pop that type of creature out, however, the number does not decrease. For example, no matter how many rabid squirrels you kill, there will always be at least 40 out there, and they will reproduce more quickly too, because there are more of them.

As time goes on, though, the regeneration rate is affected by other things than just population. Specifically, resource depletion. Remember above how we describe the maximum number of creatures that can live in a given area based on terrain type? Well that is because of the resource limitations. It is easiest to set up a simple ratio table; small animals (rodents) need 1/1000'th of the resources of a human, etc. - and we have these ratios above in our magic terrain vs. population charts. Then, it is a simple matter to determine if we have gone over the limit. If we have, the affected populations start regenerating at a negative rate. That is, they start dying off. You can show this to the players quite easily by marking members of a population as 'dead' (do not forget to discount them when determining max regeneration rate by population!). When they discover a 'wandering monster', it may be a corpse!

This is the simplest way to have a working ecosystem. You can go a bit further though, with very little difficulty. See, in the real world, each type, either carnivore, omnivore, or herbivore needs a certain type of resource. If we alter our ecosystem so that each monster/animal/person be qualified as one of those three types, we can affect the regeneration rate based on the specific resource available (meat or vegetables). Simply count the resources as above with the terrain/population charts, but use the population of the herbivores and only 50% of the omnivores. Then, use the number of herbivores, 60% that of the omnivores, and 20% that of the carnivores as the resources available for the remaining population - 50% of the omnivores, and all the carnivores. This will give you an increased regeneration rate for herbivores which is good - because each carnivore that is fed will subtract from the herbivore population. These percentages will probably need tweaking in your given system, depending on the regeneration rates you have set for different creatures, and perhaps how often you expect the carnivores to eat compared to the near-continual feeding of the herbivores.

Adding minor modifications to this system is easy as well - say you want the trees, grain, fruit, and herb resources (The population/terrain charts do not 'live' off these.. they are separate, though related.) to be depleted in an area if your herbivores start to starve. Perhaps your animals will permanently relocate to a new area (due to overpopulation, or under feeding). Maybe you even want to allow creature extinction for a given range. My favorite is simply to increase the chances of finding a given creature if you have a tracking-type skill and are specifically looking for that creature.

What does it do?

Well, if you have filled in the blank spaces and completed the exercises that were left to the reader, you should have a thriving world with a dynamic animal and vegetation and mineral population. Players will be hard pressed to throw anything too out of whack, but at the same time, they can see the results of their and other peoples actions in a realistic seeming manner. In the end though, all you have is a sturdy framework. It is time for you to build on it.

See, you are still missing about 95% of the benefit of your ecosystem. Right now, your players have 1 way to interact with the world; killing animals. They are going to want to have other ways too - like chopping down trees for wood to make bows and arrows, or mining those gold and gems. Perhaps they want to make things with it, or perhaps they are required for some NPC to make things for them. Maybe they are just going to sell it wholesale to others. Maybe now, a bear skin rug will actually be something to strive to get - you are going to need some herbs to cure the skin, the skills to make the rug, and of course, a bear (better make sure it is not alive before you make a rug out of it). Remember, even more so than in the real world, time and effort equal value. Heck, do you even have a way to make a meal out of that deer you just slaughtered?

You also should make the ecosystem more reactive to players. Make it so the bakers are dependent upon high 'grain' resources. If the rodent population is destroying the grain, the bakers can not bake, and the cities begin to starve. Maybe you can have evil races which from time to time burn the fields, or slaughter all the wolves. Maybe it could just be a lightning strike or earthquake. Maybe you even want to simulate the animal-to-animal struggles so players can happen upon them. You could even start populating animal borne diseases (bet that would keep many players out of the swamps). Lucky for the players, the herbs to cure these diseases will probably exist nearby in decent quantities perhaps some potion brewing is in order.

You can also make the players more concerned with what some consider to be the boring aspect of an ecosystem; farming and planting. If you allow things like player-run cities though, perhaps you want to give players the ability to plant and sow fields, or permanently raze forests to create new fields (driving out the majority of the animal population of course). Maybe it is not just a way to keep your citizens alive, but also a trade. Perhaps you want to add new vegetation types, like cash crops (cotton, tobacco, coffee or spices and drugs).

One of the things I have totally skipped here is what some consider the most important resource - water. Wells, natural springs, and distance from lakes, rivers or the sea were critical for a community of anything to survive, especially humans. It is no wonder that the major cities of medieval times were usually located comfortably close to at least a tributary. Not only that, but food in the form of fish, shell fish, and crustaceans form a decent switch from a daily meal of gruel, and expose yet another food resource!


In the end, you still have a long way to go for a nicely working ecosystem. I have outlined some of the choices I see the best results from, but there is worlds of possibilities that I have not even covered. Specifically, the real world, and those of your imagination! Maybe you can find a better way to do something, or somewhere to hook on another level of realism without sacrificing your ecosystem to the marauding players.