What does "spawn-limits" in bukkit.yml refer to?

Discussion in 'Bukkit Help' started by dxwarlock, Jun 16, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    dxwarlock

    I know it pertains to the amount of mobs able to spawn, as turn it wayy up makes TONS of mobs and animals, but it doesn't seem to be the 'number' limit of mobs in server...is it mobs per chunk? or per player?what does the number actually reference to as far as "monsters: 70", 70 monster per 'what'?

    As the defaults was a bit too low and mundane for my players, but making it 200 we had monsters wall to wall, a /butcher after just 2 minutes killed 4560 mobs.. so trying to find out what it references to so I can get an idea of what to tweak it to

    spawn-limits:
    monsters: 70
    animals: 15
    water-animals: 5

    cautious bump...anyone know
    bueller?..bueller?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  2. Offline

    sverre26

  3. Offline

    Acrobot

    70 monsters per tick. This is a maximum amount of monsters/animals/etc which can spawn in one tick in the whole server.
     
  4. Offline

    dxwarlock

    SO how does that work with this

    ticks-per:
    animal-spawns: 40
    monster-spawns: 10

    say I have that and 70 for "Monsters per tick"..that means every 2 seconds (40 ticks) 2800 mobs can spawn? (70 per tick and 40 total ticks, just waiting 40 before making them). that doesn't sound right, so dont think its the way it works...as it would be redundant to have a wait time if each real tick counted as being able to make 70..no matter the "ticks to wait" it would still have the same sum to work with, just dumping them in 'clumps" every X ticks.

    or is it "70 per set tick" as in...70 can spawn, every 2 seconds (40 ticks) with the above settings (70 mobs, 40 ticks)
     
  5. Offline

    NotYetRated

    I too want to know this. It is not documented anywhere, and Acrobot sounds incorrect. Sounds like he is talking about the "Ticks-Per" setting.
     
  6. Offline

    delial

    He is thinking of the "ticks-per" setting. "ticks-per" specifies how often the server will try to spawn mobs. From the wiki:



    "spawn-limits" specifies how many mobs the server can spawn total. Mobs spawn around players, so a limit of 200 means up to 200 mobs total can be spawned in the general vicinity of any of the players on the server. If there is just one player or all the players are in the same place, all 200 mobs will spawn around them.
     
    El_Cream likes this.
  7. Offline

    andune

    Since the explanation and proof is long, here is the TL;DR: The number is roughly the number of mobs/animals/water creatures allowed to spawn naturally PER PLAYER. There are some caveats to how this works, read below for full details.

    ---

    Was looking for the same myself, wasn't sure I trusted the final answer, so I went digging through code. Here is the Bukkit commit that added the new features, specifically linked to a comment from Amaranth about the number:

    https://github.com/Bukkit/CraftBukkit/commit/7dc9865aee83ce21efb274c72c685d65bd7cd011#L3R26

    Here Amaranth says it's the "number per chunk". However, my research shows this isn't accurate either. The wiki documenting stock MC behavior http://www.minecraftwiki.net/wiki/Spawn#Mob_Spawning indicates that the number is actually per 'player mob spawning radius'. Mobs are allowed to spawn within a 7-chunk radius of a player (essentially 16x16 chunks). Here at this line we can see the math Bukkit is actually using:

    https://github.com/Bukkit/CraftBukkit/commit/7dc9865aee83ce21efb274c72c685d65bd7cd011#L0R112

    The final equation is basically "world.a(enumcreaturetype.a()) <= limit * b.size() / 256" which we'll convert to "A <= L * B / 256" where A is the number of that type of mob [monster, animal or water] currently on a given world, L is the limit defined in the bukkit.yml (such as default of 70 for mobs) and B is the number of currently loaded "spawnable chunks" around players.

    B works out to be 256 per player (16x16 chunks), meaning the "B / 256" part of the equation is effectively the player count, adjusted for overlapping chunks (since each player will have 16x16 spawnable chunks loaded around him/her). To simplify, we'll assume all players are far enough apart to have no overlap and call this P. This leaves us with: "A < L * P". This means as each player logs into the server, the number of mobs that can be spawned goes up by L (again, ignoring overlapping chunks for simplicity here).

    Also of note is that this number is per-world. This doesn't change the equation or totals because the values are determined by the number of loaded chunks on each world. This just means that if 25% of your players are on world A and 75% are on world B, the mob populations for each world will match that same ratio. Bukkit does provide an API for plugins to set different values per-world, but I'm not sure any take advantage of this yet.

    Those of you running WorldGuard can verify these numbers using "/wg report" and look at the report. Your numbers should be roughly in line with the equations above; it won't be exact since these numbers don't account for animal farm spawning and also most servers have some player chunk overlap.

    Last note: the method SpawnerCreature.spawnEntities() that this code appears in is the only place these values are referenced in Bukkit, meaning it only controls this method. Note this line here:

    https://github.com/Bukkit/CraftBukk...et/minecraft/server/SpawnerCreature.java#L155

    The only spawn type controlled by these limits is "SpawnReason.NATURAL". This means every other reason is NOT controlled by these limits:

    https://github.com/Bukkit/Bukkit/bl...kkit/event/entity/CreatureSpawnEvent.java#L85

    So things like spawners, breeding, village invasions, etc can exceed your defined limits. Of course once the limits are exceeded, animals/mobs will stop spawning naturally.
     
    xbenas, Jobsti, dxwarlock and 2 others like this.
Thread Status:
Not open for further replies.

Share This Page