1. Guest, as per the stickied thread, this forum has not been in use since 2014. All bugs and feature requests should be posted to JIRA.

Solved Bug in SpawnerCreature.spawnEntities

Discussion in 'Bugs & Feature Requests' started by Erocs, Nov 28, 2012.

  1. In SpawnerCreature.spawnEntities changes were made to calculate the moblimit based upon the spawnRadius instead of a hardcoded value of 8. When retrieving the value of mobcnt and then setting moblimit, the magic value 256 is used for a division. Let's name that value spawnArea. This division is scaling back the limit after adjusting it by the number of chunks to account for in the calculation. It is calculated based upon the area of chunks around the Player which were added to the LongObjectHashMap b. -8 to 8 is 16 which is then squared to achive the spawnArea, 256.

    Using the new spawnRadius calculation would now require that this spawnArea also be dynamically calculated so the scaling is correctly preserved.

    I saw it last night while looking over the source code changes for 1.4.4.
     
  2. md_5

    Administrator Developer

    Care to submit a fix?
    If you could that would be great.
    mikeprimm
     
  3. There you go! :)
     
  4. md_5

    Administrator Developer

    And there you go! Merged. Thanks :)
     
  5. mikeprimm

    mikeprimm Retired Developer
    Retired

    This will effectively undo the point of the original change, which was to avoid having low view-distance settings yield escalated mob densities. Here's the point:

    With default settings, the spawn area is an 8 chunk radius (17 x 17 chunk, versus the 16 x 16 indicated). Assuming, for simplicity, there is exactly 1 player in the world, that means that 289 chunks count towards to the population limit. The resulting number would be 'limit * 289 / 256' or (1.129 * limit) mobs. This translates to a population density of (limit * 0.0039) mobs per chunk.

    Now, set the view-distance to 5. The chunk count will wind up being 11 x 11, or 121. The result with the existing change was 'limit * 121 / 256' or (0.4726 * limit) mobs. This translates to the same population density as the default view-distance - and a net drop in the overall number of mobs on the server (which one would think would be appropriate with each player only activating about 40% of the number of chunks. Without the change, (vanilla MC or CB), the result was the same original limit (1.129 * limit) applied to 40% of the area - net result is about 2.5 times as many mobs per chunk (0.0093 * limit, versus 0.0039 * limit).

    With this change, you're effectively rolling back to the original characteristic - you wind up with 'limit * 121 / 100' as the mob limit, which is (1.21 * limit) mobs total, and a density of (0.0100 * limit) per chunk (which is actually a bit higher than vanilla).
     
  6. md_5

    Administrator Developer

    mikeprimm alright you reasoning seems sound, you can reverse merge the commit if you feel that is best.
     
  7. Bestle

    Patron

    With Erocs fix I actually found naturally spawned mobs throughout the world and now that it has been reverted there are once again no natrual mobs.
     
    • Agree Agree x 2