Content: Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Background: Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Pattern: Blank Waves Notes Sharp Wood Rockface Leather Honey Vertical Triangles
Welcome to TerraFirmaCraft Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

  • Announcements

    • Dries007

      ATTENTION Forum Database Breach   03/04/2019

      There has been a breach of our database. Please make sure you change your password (use a password manager, like Lastpass).
      If you used this password anywhere else, change that too! The passwords themselves are stored hashed, but may old accounts still had old, insecure (by today's standards) hashes from back when they where created. This means they can be "cracked" more easily. Other leaked information includes: email, IP, account name.
      I'm trying my best to find out more and keep everyone up to date. Discord (http://invite.gg/TerraFirmaCraft) is the best option for up to date news and questions. I'm sorry for this, but the damage has been done. All I can do is try to make sure it doesn't happen again.
    • Claycorp

      This forum is now READ ONLY!   01/20/2020

      As of this post and forever into the future this forum has been put into READ ONLY MODE. There will be no new posts! A replacement is coming SoonTM . If you wish to stay up-to-date on whats going on or post your content. Please use the Discord or Sub-Reddit until the new forums are running.

      Any questions or comments can be directed to Claycorp on either platform.
Therighthon

Animal Spawning Mechanics

14 posts in this topic

 

It seems pretty likely at this point that TFC2 will feature lots of animals. And, to do justice to this, I feel like there should be a better system in place than the Vanilla system of spawning animals once and that being all you get.

Basic Principle:

With this in mind, I propose that there should be an island-based system for spawning wild animals. Essentially, when an island generates it would generate a list of species that can spawn on that island, based on climate zones, and probably some randomization. Then, based on the numbers of hexes meeting certain requirements (altitude, tree cover etc.) it would determine how many of each species of herbivore it could support. Then, based on that, it would look at a food web to see how many of each species of predator the prey population could support. This should probably be made to favor a larger number of predators than would be realistic, because otherwise we would never see any predators. The island would then generate with the correct number of animals spread across it, with some bias for various locations based on the type of animal (i.e. bears could be more likely to spawn near rivers and fish from them (which would be really cool)). Then, if the count of the animals becomes unbalanced, due to the player hunting, or predators killing prey animals the population could regenerate through random spawns. (Alternatively, animals could start to reproduce when the balance was messed up, but because of the limitations of chunks loading and unloading, and the likelihood of animals being separated from mates, this probably wouldn't work.) This system would ensure that an island will never be over hunted, and that you will never be able to completely clear an area of bears etc.


For Example:

Disclaimer: All numbers and animals used in this are examples, and wouldn't be used in a final plan, as the animals may/may not be included and may/may not actually spawn temperately

Step 1: An island generates with a temperate climate, and flat terrain. The list of animals that can spawn on such islands includes bears, deer, sheep, cows, boars, bison, goats, cougarswolves, squirrels, rats and raccoons.

Step 2: A randomizer determines that only sheep, bison, goats, cougars, wolves, squirrels and raccoons can spawn on the island, making sure to choose at least one large predator, and a few large herbivores and decoration animals.

Step 3: The island has 307 land hexes. Each bison needs 20 hexes, while sheep and goats only need 8 hexes a piece. Each type of animal is allocated 102 land hexes. As such, the island can support 12 sheep, 12 goats and 5 bison.

Step 4: Each wolf needs 4 prey animals, and each cougar needs 10 prey animals. The island can support a total of 27 prey animals. Thus, there are 13 prey animals available for each, meaning the island can support 1 cougar and 3 wolves.

Step 5: The animals spawn in the island with the world generation, with reasonable spacing between the groups. Squirrels and Raccoons spawn and despawn similarly to most hostile mobs in vanilla, and could be kept from despawning by players by some method like the nametag.

Now that the island has generated, say that the player hunts down and kills a bison. Now that there are only 4 bison, a 5th bison will be able to spawn. Because animals generally spawn in herds, the game could either spawn it with a herd, impregnate a bison at random, or wait until more are killed and form a new herd. If a cougar or wolf kills a sheep or goat, the process would be much the same. Now, say that the player successfully domesticates two sheep, and begins to breed them. Soon, the player ends up with 7 captive sheep, bringing the island's total population up to 10 sheep. Now when the wild sheep are killed off, they do not respawn in the wild and eventually only the domesticated sheep are left, but there are now 20 sheep, far more than the island would normally support.

At this point, I am not sure what should happen, but there are a few options.

- A: Nothing would happen aside from no more sheep spawns.

- B: As the number of sheep reaches the island limit, they begin to use up the hexes allocated to the bison and goats, causing them to stop spawning.

- C: As the population of sheep increases, the island becomes able to support more cougars.

So what I am asking with this, is should the actions of the player influence the balance of the environment? I am personally all for that idea, because it is always cool when actions like that mess with the environment, but it would mean the population capacity for each type of animal would have to be dynamic, rather than being calculated once when the island was generated.

 

Anyway, I have typed now for long enough, and would like to know what you guys think and hear some other ideas.

 

EDIT: Also, I meant to put this under suggestions. let me see if I can move it or not…

Edited by Therighthon
1

Share this post


Link to post
Share on other sites

well, I like the idea.  I don't know if it's feasible but I like it. 

1

Share this post


Link to post
Share on other sites

I prefer the A-option, as the preys are captive, but the wild sheeps should not stop spawning, as the captive sheeps are feed by players and the wild food in the island does not decrease.

 

And i prefer the spawning alternatives, not impregnating.

And if the last animal is a male or there are no more animals, the population of the animal will disappear, giving space to preys and predators of other species.

 

And, IMPORTANT, a specie cannot spawn with only 1 animal.

0

Share this post


Link to post
Share on other sites

I don't see any reason why animals "in captivity" should affect the wild population in any way, shape, or form whatever.  They are then no longer part of that biosphere.

0

Share this post


Link to post
Share on other sites
8 hours ago, ChunkHunter said:

I don't see any reason why animals "in captivity" should affect the wild population in any way, shape, or form whatever.  They are then no longer part of that biosphere.

I agree. 

The only other thing that could be considered would be a developed chunk. So when counting the chunks, any chunk with buildings should be removed from the total.

After all it makes no sense to have wild animals spawning in the middle of a town.

0

Share this post


Link to post
Share on other sites

I might add, that with regard to the player breeding lots of animals, option C would be best, and moreover they should spawn often in the vicinity of the player's animals. This should also be true of crops.   This would be a direct difficulty mechanic.  So the player has a lot of poultry?  weasels spawn more often, and try to kill the chickens.   larger animals, you get wolves, big cats, and other predators.   Bears too maybe.  If the player has a bunch of crops, then raccoons, deer, and pigs start appearing and attempting to attack the crops.  The more of these things the player has, the more predators and crop hasslers appear. 

Depending on difficulty desired, maybe a simple fence stops most of these.  Or maybe it doesn't, and the player must employ a variety of counter-meatures.   Weaseles and raccoons can just walk through a split rail fence (if code feasible).  So the player must construct wicker fence panels (made from sticks) or simply build a 2-high wall of solid blocks around the chickens.  Deer can jump 3 high, so the player has to build an extra-tall fence to keep them out.   Bears can break through wood fence, so a stone fence is needed.  And if all else fails, guard animals (finally a use for wolves).

So I think there should be a game challenge spawning aspect, that is separate from any natural ecosystem mechanic.  These challenge spawned creatures might be different in that if they reach their target and kill a few animals or destroy a lot of crops, they then despawn.  Or if they can't get to their target for a certain amount of time, again, they despawn.  At least, the non-violent ones.  If a bear gets in and kills the player's guard animals, and starts killing livestock, maybe it won't go away on it's own and the player has to deal with it.

The notion of wild animals respawning on their own to keep a balance, is fun, but I wonder how that would affect the challenge level of the game, in terms of the player being able to always hunt for food.  If hunting were made harder, so that non-breedable prey animals flee if the player gets within a certain range and isn't sneaking, that would probably help balance the situation.

1

Share this post


Link to post
Share on other sites
1 hour ago, Darmo said:

I might add, that with regard to the player breeding lots of animals, option C would be best, and moreover they should spawn often in the vicinity of the player's animals. This should also be true of crops.   This would be a direct difficulty mechanic.  So the player has a lot of poultry?  weasels spawn more often, and try to kill the chickens.   larger animals, you get wolves, big cats, and other predators.   Bears too maybe.  If the player has a bunch of crops, then raccoons, deer, and pigs start appearing and attempting to attack the crops.  The more of these things the player has, the more predators and crop hasslers appear. 

Depending on difficulty desired, maybe a simple fence stops most of these.  Or maybe it doesn't, and the player must employ a variety of counter-meatures.   Weaseles and raccoons can just walk through a split rail fence (if code feasible).  So the player must construct wicker fence panels (made from sticks) or simply build a 2-high wall of solid blocks around the chickens.  Deer can jump 3 high, so the player has to build an extra-tall fence to keep them out.   Bears can break through wood fence, so a stone fence is needed.  And if all else fails, guard animals (finally a use for wolves).

So I think there should be a game challenge spawning aspect, that is separate from any natural ecosystem mechanic.  These challenge spawned creatures might be different in that if they reach their target and kill a few animals or destroy a lot of crops, they then despawn.  Or if they can't get to their target for a certain amount of time, again, they despawn.  At least, the non-violent ones.  If a bear gets in and kills the player's guard animals, and starts killing livestock, maybe it won't go away on it's own and the player has to deal with it.

The notion of wild animals respawning on their own to keep a balance, is fun, but I wonder how that would affect the challenge level of the game, in terms of the player being able to always hunt for food.  If hunting were made harder, so that non-breedable prey animals flee if the player gets within a certain range and isn't sneaking, that would probably help balance the situation.

Yeah, hunting would have to be rebalanced. They could always just make it so that the animals drop less food.

I like the idea of having to keep animals away from crops and animals. Crops should probably be made easier to protect, with stuff like scarecrows because otherwise it would get really annoying. So, while protecting animals would be more dynamic and unpredictable because it relies on AI, defending crops would be more predictable and systematic, similar to support beams. I really like the idea of having sheep dogs though. That would be super cool.

0

Share this post


Link to post
Share on other sites

I think that ideally it would be a scaling system.  So if the player is in the stone age  and has like, 5 maize plants, the game goes easy on them and doesn't hassle them.   But if the player is going bonkers with their farms and has 150 planted crops in one hex, up the difficulty and bring in some hassling animals.  The more crops (or animals) the greater the chance.   So ideally you're only becoming annoying when the player already probably has a lot of crops/animals anyway.   And if the hasslers despawn after destroying X crop blocks or animals, you can control the damage.  Each hassler will reduce the total crops by no more than a certain amount, so as not to wipe out the player's stuff in one shot.  This in turn reduces the chance of the next one spawning.

If the chance is based on crops per hex, it could encourage the player to spread their fields out a bit, reducing the chance for each field  (or pen of animals) to be hassled.  Or it could just be based on a single block check that scans for crops/animals in a 5 block or whatever radius, and depending on the count, maybe gets hassled.  Where the hasslers spawn might be tricky.  If fences are used as a defense, you don't want the hassler spawning within the fence - that's cheating.  That might limit the enclosure size.  If it got too large, the check might not realize there's a fence, and spawn the hassler inside.

I hope I'm not hijacking your thread Therighthon.  Your macro idea of island-wide spawning I like, and don't have a lot to suggest, especially given my lack of knowledge of the code possibilities.  I might suggest that aside form picking from the 3 categories you suggested, maybe there should also be only 1 production animal of each type.  So an island might only have 1 certain wool producing animal, or milk producer.  If some animals produced more than a given commodity than others, then one island might have a really good milk producer, but poor wool production.  Another might have both be not great producers, and another might be have really good ones.  I guess some could be absent altogether.  It just might make the islands have different characters, rather than each one being the same animals in different skins.

0

Share this post


Link to post
Share on other sites

I like the way you think Darmo, my only point is that TFC needs a better Spawning system..

Using Just Another Spawner and Mob Properties I was able to make a server where no mobs spawn over artificial blocks. So in the case mobs only spawn over Dirt, grass, or raw stone. Mobs never spawn over wood blocks, smooth stone, bricks etc.

This would make it so mobs spawn outside of the player buildings, but the player still needs to build fences and walls to protect his base.

My point is that as much as I like your idea of having more wolves spawning because the player has a huge sheep herd, the wolves should not spawn inside the sheep pen.

0

Share this post


Link to post
Share on other sites

Good news, as far as the macro spawning this is sort of how it already works!

  • Each animal has a habitable climate zone.
  • Each island selects several species (iirc its small random number)
  • The animal spawner then queues X number of each creature to spawn on the island in groups of Y to Z where X, Y, and Z are arbitrarily controlled numbers based upon our own balancing choices.
  • When animals are killed, they subtact from the population pool for that animal type.
  • As long as the population pool is not emptied, the spawner will queue up more of that animal to spawn in an appropriate hex.
  • When the island ticks, it will replenish the population pool over time.
  • Killing or in any way altering(taming or moving an animal via portal) will cause it to leave the population pool for that island.

I'm still making up my mind about extinction or not. We'll leave it in for now and see how it plays out.

 

2

Share this post


Link to post
Share on other sites

Would love to see that when you kill an animal, a baby animal spawns in the same location of a grown wild animal of its specie, or even better, a random female gets impregnated, as Therigthon said. You can just kill all the grown ups, because the little babys would be an easy prey for other animals + you cant kill  all the females of the island. Also, if only females can get impregnated IF a male is within a 50 block radius, you couldn't kill all the males. 

0

Share this post


Link to post
Share on other sites