Vanilla Mob Spawning, Massivemob Spawning, Mob Caps, And Chunk Info On Massive[research/help]

AccursedRadiance

White People at a Cookout: It needs more salt
Joined
Apr 20, 2014
Messages
63
Reaction score
119
Points
0
Location
Between the frosting and the plate.
Vanilla Mob Spawning, MassiveMob Spawning, Mob Caps, and Chunk info on Massive[Research/Help]
(pssstttt...it's not organized in this Order)​


How exactly does mob spawning work in Minecraft(Multi-player and Single player), could the multiple plugins on MassiveCraft(such as factions, massive-mobs, potions, etc)effect mob spawning and spawn rates? How often and where will mobs spawn, and why?

These are questions that have been running through my head for a while now. And Since I was unable to find any information on the topic, or anything that may anwser my questions, I decided to do some research as well as experiment with the multitude of mobs as such.

Vanilla Spawning


I began said research by looking at the spawning system for Pure Vanilla Minecraft(Vanilla meaning that there are no mods or plugins). And found that , In the words of the Minecraft Wiki, /Mobs are broadly divided into four categories: Hostile, Friendly, Water(i.e. Squid), and Ambient(i.e. Bat)./ which I for one, did not know, -I believed that mobs where categorized into Peaceful, and Hostile Categories, and there then where the bats, which in my opinion at the time, where just annoyances. So from there, after discovering these categories, I began testing the spawning rates of said mobs, and found that Hostile Mobs have one spawning cycle once every game tick(1/20th of a second), whiled friendly and water categorized mobs only went through one spawning cycle every 400 Game ticks(20 seconds). Because of this I concurred that Hostile mobs can spawn at any time, while Freindly mobs very rarely spawn, normally going through their main cycle when a new chunk is loaded for the first time. At first I thought this was all there was to mob spawning, but I was completely wrong.

You see, Mobs spawn naturally inside a Loaded Square chunk group. In single player mode, this area would be a 15x15 chunk area(240 Blocks* 240 Blocks), But on multiplayer servers the size varies with the server settings. When there are multiple players, mobs can spawn within the given distance(240 Blocks) of any of them. However, hostile mobs(and some others) that mover farther than 128 blocks from any player will soon despawn, so even within a larger chunk loading radius, the mob spawning is more-or-less limited to spheres with a radius of 128 blocks, centered upon each and every player. But this is where the MassiveFactions plugin may come in, you can set flags for your faction that make it where no mobs may spawn within your claimed chunks. So if you're standing in your claimed chunk, and there are claimed chunks occupying every chunk in the 128 block radius around you, nothing at all will spawn within or around your chunks, causing them instead to spawn in any unclaimed chunk that is near another player. But also in turn completely skipping that areas spawn cycle.


Mob Capacity(Cap)

Mob caps are directly porportional to the total number of chunks elligable for spawning(Claiming and setting Mob Spawning to false lowers the max cap because it makes the chunk inelligable for spawning, the same goes for excessive lighting). To calculate the cap, the spawning area is expanded by one chunk in every direction(so the default gives 17x17 chunks), then the total number of chunks is Plugged into the following Formula

Cap = constant*chunks/256

Each mob category has a different cap and a different constant in he formula:
  • Hostile = 70
  • Friendly = 10
  • Ambient = 15
  • Water = 5

In single player mode, the chunk count is 17x17=289, and the cap works itself out to be:
  • Hostile = 79
  • Friendly = 11
  • Ambient = 16
  • Water = 5

In multiplayer however, chunks that are in the range of multiple players are only counted once(So in turn, this would mean dark-rooming[DR] alone is far more productive). So the more spread out the players are, the more chunks will be covered and the higher caps will be, but if thousands of chunks are in-elligable due to lighting or claiming, then the cap severely decreases. The caps themselves are checked once at the beginning of each spawning cycle. If the number of living mobs in a category is at its cap, the entire spawning cycle for that category will be skipped.

Pack Spawning

For each spawning cycle, one attempt is made to spawn a pack of mobs in each eligible chunk. A random location in the chunk is chosen to be the center point of the pack. For the pack to spawn at all, the center block must be water for water mobs and air for all other mobs. Note that in the latter case, it must actually be an air block. Any other block, even a non-colliding one, will prevent the entire pack from spawning.

If the pack location is suitable, 12 attempts are made to spawn up to 4 mobs (8 for Wolves, 1 for Ghasts) within a 41×1×41 area centered at that block (that's a 41×41 square that is one block high). Mobs will spawn with the lowest part of their body inside this area. For each spawn attempt, a block location within the pack area is chosen at random. Though the pack area extends 21 blocks out from the center, the random location is heavily skewed toward the center of the pack. Approximately 85% of spawns will be within 5 blocks of the pack center, and 99% within 10 blocks of the center.

All mobs within a pack are the same species. The species for the entire pack is chosen randomly from those eligible to spawn at the location of the first spawn attempt in the pack.
In the Overworld, this depends on the biome:
    • Most biomes can spawn sheep, pigs, chickens, cows, spiders, zombies, skeletons, creepers, Endermen, witches, and Squid.
  • Forest and taiga biomes can also spawn Wolves.
  • Jungle biomes can also spawn Ocelots.
  • Desert, beach, river, and ocean biomes cannot spawn animals; only hostile mobs and Squid.
  • There are actually two ways for a Slime to naturally spawn without a Monster Spawner: In any eligible chunk under layer 40, or in a swamp biome at a low light level
Each individual spawn attempt succeeds only if all of the following conditions are met:
  • There must be no players and no player spawn points within a 24 block distance (spherical) of the spawning block
  • If it's a squid, then...
    • the spawning block must contain liquid (water or lava)
    • the spawning block must be between level 46 through 62, inclusive
    • the spawning mob must not be obstructed by other mobs
  • If it's not a squid, then...
    • the block directly below it must have a solid top surface (opaque, upside down slabs / stairs and others)
    • the block directly below can't be bedrock
    • the spawning block itself must be non-opaque and non-liquid
    • the block directly above it must be non-opaque
    • the spawning mob hit-box must not be obstructed by solid blocks, other mobs or liquids
  • If it's an animal, then...
    • the block directly below the spawning block must be grass
    • the light level of the spawning block must be 9 or brighter
  • if it's an ocelot, then...
    • the spawning block must be above level 62
    • the block directly below the spawning block must be grass or leaves
    • there is a 1/3 chance the spawn will fail
  • If it's a hostile mob in the overworld, then...
    • the light level of the spawning block must be 7 or darker, and more light increases the chance that the spawn will fail
    • sunlight falling on the spawning block further increases the chance that the spawn will fail, by up to 50%
If all of these conditions are met then the mob is spawned. The pack is complete when 4 mobs have spawned (or 8 wolves, or 1 ghast), or 12 attempts have been made, whichever comes first .

MassiveMob Spawning
MassiveMobs is a server side plugin that makes use of a few vanilla aspects of the game, these being that mobs holding items possess a longer despawn time unless the square chunk group that mob is in becomes unloaded(examples being Dropped player items, Leads, Name Tags, Golden tools, books, etc.), and mobs that are named(Normally with a a name tag if not in creative or using cmd blocks) will not despawn(The plugin however has it set that some mobs will despawn based upon in-game ticks, it varying for each massivemob), this being possible because the game packets(The groupings of Java code that make up the Game) recognize said mob not as an entity, like other mobs, but as what I like to call, a Packet Pen(the reason for this being that if you think about it, a pen can move anywhere on a piece of paper and write or change things, make markings, etc. The players in game do the same thing by moving around the packets, the things that make up the world, and editing them, or writing on them like they're a pen). But they are also know by other....more intelligent people, such as yourselves, as Players. And players, as you all know, can't despawn like entities or mobs.

So the plugin code is written to give "names" to certain mobs, and then buff them up with higher health, higher attack; and Special, permanent effects such as regeneration, strength, invisibility, or speed. It then proceeds to find a suitable, eligible spawn location and begins placing the codes that make up that Mob into the packets. Some exceptions of this Eligibility system are the Slime ancient and the Magma Ancient, both extremely powerful Mobs/bosses that deal insane damage and have insane health and effects. These can both spawn Daylight and Have been coded to output speech lines within the chat console. They However, are extremely rare, about a 15% chance for a Slime Ancient, and a 5% chance for a Magma Ancient to spawn every 100 spawning cycles.


Some variants of the MassiveMobs such as the Cultists(Normally Zombies in White or Black Leather Armour), and the Spiders also make use of the pack spawning system I outlined earlier as well as impliment the spawning location requirements, such as the Light Level, the Player Proximity, and the Opaque/Non-Opaque block, code strand.

There is are also mobs that drop Entities that are based upon their Titles, two examples being the Pastry Chef(Drops Cookies[Normally 16], 1-3 Cakes, and 3 Pumpkin Pie), and the Undead Jeweller(Drops Emeralds, Diamonds, clocks, and Gold).

Sometimes there will be an extra word in front of the Name of the mob, for example: Withering Undead Cultist. This word is used to describe the effect the mob will have if they land a successful hit on you. I'd Link you a proper list of effects if there was a Location where they where all located, but there ins't at this time, so I will try my best to list all of the ones I know, as well as describe them the bst I can without sounding completely idiotic. Also, please feel free to correct my effect durations and to add/remove any effects you know can come on massivemobs

Withering: You're struck with the force of the Wither, it's essensce seeping into your body and damaging you like the worst poison imaginable.
Wither, 15 seconds
Slowing: Your feet begin to feel heavy mere seconds after your foe lands hid blow, you move like a slug and you swing like a child for mere seconds, and then suddenly, everything goes fast forward as the effect wears off.
Slowness, 10 Seconds
Dazing: You suddenly grow dizzy as your foe slams its fist into the side of your helm, leaving you standing still, staring into nothingness as you become solid, unable to move as your foe draws near, then suddenly, you are no longer dizzy and can move again!
Dazed, 8 Seconds....?
Poisonous: You scream as the corrosive poison splashes your armour and eats through to your flesh, and then as it wears off and the pain dies, you resume your slaughter of the spider filth.
Poison, 10 seconds
Weakening: The dart slams into your leg and empties its venoms into your bloodstream, leaving you as strong as a child hefting his first sword, dealing little damage to the foes that you where just crushing. But It lasts only a little while, and you resume your smiteful quest.
Weakness, 10 seconds
Hungering: Your mouth begins to water as your sustenance slowly begins to fade, leaving you starving, slow, and weak.
Hunger, 20 seconds

In the words of @yendor46, "MassiveMobs are enabled in Fendarfell and Daendroc. Fendarfell is the only world on s3. Daendroc and Ellador are on s4. Fendarfell is the most challenging world for mob spawning, as there are few caves in which mobs can stay during the day, so most hostile mobs die during the day and need to be respawned at night. This keeps a fairly constant load on the server." But they're also enabled in New Ceardia(NC, s2).


Sources:
http://minecraft.gamepedia.com/Minecraft_Wiki

http://forums.massivecraft.com/threads/darkroom-debate.10781/
Personal Testing
Server Experience

Thanks for reading, I hope this research helps you, as much as it's helped me!
 
It should be noted that on servers ticks don't happen exactly every 1/20th of a second, due to lag and such.
 
I do not believe massivemobs are enabled on New Ceardia, as I live there and should know.
๖ۣۜNo, there are if my thoughts serve me right. They aren't as dense as Fenderfall, yes; but they all have their individual traits such as Withering Undead, Undead Cultists, Earthwrecker etc. They just aren't as deadly. Normal MC doesn't have those kind of mobs spawning.
 
๖ۣۜNo, there are if my thoughts serve me right. They aren't as dense as Fenderfall, yes; but they all have their individual traits such as Withering Undead, Undead Cultists, Earthwrecker etc. They just aren't as deadly. Normal MC doesn't have those kind of mobs spawning.
No, there are no mobs with names at all. Therefore, there is no massivemobs, as it adds names to mobs in active worlds.
 
@Chronicler_372 well you see........I'm verrryyyyyy bad at math. So it took me about 4 or so days. It wasn't untl the 4th day that I foundout most of th numbers where already on the wiki........so basically I did a bunch of pointless math. But I learned alot along the way! :)
 
*convulses with happiness.* Dang I needed this. I'm a person that puts high values on efficiency. This makes my life on massive 100% easier.
Gonna put it on my favorites and use it when designing mob systems.

Also, do you have any clue as to why the animals in my industrial farms keep disappearing every time I leave the server for a day? Is it an in game cause, or a player cause?
 
@Cakezzsault It's actually only happening in the massive mobs world. While in places like Ithania, I can have a cow farm without a problem. But when it comes to places like Ellador, unless it is tamed it ends up disappearing the next time I get on. I have more evidence of abandoned desolate factions that still have animals trapped in their little cages on Ithania. So, are you sure that's the cause?
I just want to know how I can have a working industrial farm without the animals disappearing every two seconds. Having my cake and eating it. So pinpointing the problem and finding a solution is imperative.
 
@Laach you say You're only having an issue with it in MassiveMobs enabled worlds? Hmmmmm...... That's interesting........since MassiveMobs is a somewhat substantial element of those worlds. The plugin may be written so that the packets give spawning and despawning priorities to Massive mobs, making the system deem the passive mobs you're mentioning as "extra entities". By this I mean the system is thinking of them as the normal massive mobs and deleting them rather than deleting the actual Mob the code title belongs to(the MassiveMob).

Sorry if that's confusing, I kinda sorta confused myself with it as well. What I'm trying to get out of my ADHD brain is that the Plugin is written so that they take the entity ID of the MassiveMob, and swapping it out with the Entity ID of the Friendly mob. For example, you're sayIng that it despawns cows and sheep if they aren't named. Well Basically the plugin would be rapidly switching(maybe in 1/10th of a game tick, but this is merely a geusstimation) the mobs ID's, but keeping their titles the same. So when the game ran through a hostile mob despawn cycle, it would be like

/Console
Console$: /sudo run-Despawn-cycle
Console$: Scanning%
Console$: (Blah blah blah) Hostile entities in existence,
(blah blah blah entity numerical codes)
Console$: There are (blah blah number) entities located in (blah blah chunk numbers) & (blah blah number) are farther than 128 blocks from any player
-the console would then begin the despawns cycle and very rapidly switch the entity numbers but edit them so that the MassiveMobs keep their above head titles. The system would then think that the passive mobs where the hostile mobs they where trying to delete, and in turn, wipe them.

This being a possibility because MassiveMobs are a major part of the worlds in which they're inactive, also because(correct me if I'm wrong) I don't think passive mobs despawn anymore.

This may also be a key cause of the lag in Fender. Due to the Server Mob cap being so high, due to the eligible chunk number being enormous. Then tons of mobs will be spawned(hence the unkind mob hordes in wilderness), and since the mob cap is so high, the system has probably been designed to up the number of despawn cycles.

The large, rapid amounts of entity title switches + The Huge Mob Cap + The Large Player Number + all the creative gates = Lots of huge, abnormal lag spikes.
 
@Laach if you think about it, it's kind of like this

Imagine a door stopper. (Ya know, those coiled things that are designed to stop your door from slamming into the wall.) As you know, if you bend it to one side and let it go, it will shoot back and forth from one side to the other.

Well, the speed and frequency of which these "bounces" take place are directly proportional to the force to apply when pulling it back. So....
Frequency = F = How often. Despawn cycle occurs
Speed = S = Number of entities detected * the number of chunks they occupy/Ticks per second
Force = Fa = Mob Cap Formula /Number of chunks within player radius

So since our average player basis is very large and spread out, and the chunk number per world is enourmous, then the frequency of cycles will be higher.

But Now that I think of it, the MassiveMobs plugin will probably only switch entity titles with passive mobs that aren't within player radius
 
For example, you're sayIng that it despawns cows and sheep if they aren't named.
I don't think you understood what I was saying.
  1. They are MassiveMobs, therefore they already had a name.
  2. I wanted a solution or an explanation of how to fix it. You kind of went overboard with the info without telling me how to fix the problem.
  3. This hasn't been a problem in MassiveMobs disabled worlds.
I also think I wasn't being clear enough.
  • This has happened four times to me. The 3-4th time I was in a separate location, so it might have been a different continent with MassiveMobs enabled.
  • The first two times, I had multiple adult cows packed in a 1x1x3 breeding area. The place was faction protected, so non-faction members couldn't have gotten access inside. But both times, the adult cows and children cows vanished with no extra loot in my hopper connected chest.
  • The third time was outside of protected land. In a fenced area with a friends cows already inside. I had led the cows with a rope to get them inside, so my cows = ~7 and friends cows = ~3. I bred a few, but I don't remember how many. I also built half a structure in the animal pen. The next day, my building disappeared along with most of the cows. Leaving, as far as I could tell, the same amount of mobs that my friend had started out with. A sign was also left by my friend as a sort of "keep out sign" (I didn't really ask permission to build the structure but the animals were approved). I didn't get the chance to question him, so I was left without any answer.
  • The fourth time I was a bit more cautious. I brought a cow into my house with a lead in hopes that I could put him into an indoor breeding machine. When inside, I attempted to attach his leash to a fence post. I must have been lagging because the cow had suddenly gained the same physics as an air block. So with minor fear that someone could snipe my cow through the window, I got off of my computer for that day. Our faction is insanely strict with their building perms., so I felt safe knowing that only 5 trustworthy members had access to my house. You can guess what happened next.
  • As far as I know, I'm the only one having these problems. (They obviously hate me for packing them in a 1x1x3 area.)
I don't have the time to act all detective since I have both homework and building projects to do for other people. Instead I was wondering if you could possibly go all myth buster on this project to see if MassiveMobs is truly the cause.
And to prove I'm not just being lazy, I'll give you a stack of my earned leather if you end up solving this mystery.
 
Last edited:
@Laach oooooooo, I need leather for books............hmmmm *scratches chin in deep though*

Well......this may take a little while because it may be a Bukkit error......How about a full stack of plain books, and I'll be your detective.
 
@Cakezzsault
I just want to know how I can have a working industrial farm without the animals disappearing every two seconds. Having my cake and eating it. So pinpointing the problem and finding a solution is imperative.
MassiveMobs will despawn if not tamed. Taming horses is straight-forward. For all other animals, I have had to breed the MassiveMobs to produce vanilla mobs, which do not normally despawn. I believe that there might also be a MassiveMob feature that despawns mobs that are trapped in too small of an area, which may, or may not, apply to animals as well. Animals are also limited to 20 per chunk, total, for all animals. I have not checked if this causes despawning of the surplus.
 
MassiveMobs will despawn if not tamed. Taming horses is straight-forward. For all other animals, I have had to breed the MassiveMobs to produce vanilla mobs, which do not normally despawn. I believe that there might also be a MassiveMob feature that despawns mobs that are trapped in too small of an area, which may, or may not, apply to animals as well. Animals are also limited to 20 per chunk, total, for all animals. I have not checked if this causes despawning of the surplus.
*DING DING DING*
You're exactly correct. When Cayorion made it possible to tame MassiveMobs with Mushroom soup he implimented it so that if an untamed MassiveMob is untamed And within to small of a space that It will "Escape". A somewhat cheaty way to keep the chunks the mobs are located in from unloading would be to put up Item frames because they keep whatever chunk they're located in loaded.