TECHNOVE / Airplane

A stable, optimized, well supported 1.17.1 Paper fork.
https://airplane.gg
GNU General Public License v3.0
344 stars 99 forks source link

Mob despawning behavior is inconsistent / not as expected #45

Closed Puremin0rez closed 3 years ago

Puremin0rez commented 3 years ago

Upon doing some investigation into the low mob spawning issue across a variety of forks, I came across an issue that is unique to Airplane and does not occur on Tuinity or Paper.

When using Tuinity (or Paper), upon spawning a bunch of zombies during night time, when flying backwards quite some distance (well beyond 64 blocks) and flying back - all zombies were gone, as intended. This is the desired behavior of hard range.

When using Airplane, this same test was repeated and upon coming back to the area most of the zombies are still there. Some are despawned, but most remain.

I repeated this test multiple times to verify results. Same results.

I recorded video footage of both test scenarios as this is a problem that is best viewed and makes the issue much more clear.

Tuinity behavior: https://streamable.com/q4z1vl

Airplane behavior: https://streamable.com/qdo4oq

All tests were completed using Airplane #48 and Tuinity #21 on Minecraft 1.17.1.

The following settings can be used to perfectly reproduce this issue from an entirely default set of configs: server.properties > view-distance: 4 paper.yml > no-tick-view-distance: 8 paper.yml > despawn-ranges.hard: 64 paper.yml > keep-spawn-loaded: false

I have tried adjusting the despawn-check-freq value in airplane.air but it really didn't seem to make much of a difference for me.

Let me know if you need any additional information :)

sxphirus commented 3 years ago

I copied your setup and completed a test on a clean build and server using Airplane #48, only changes being:

despawn-ranges.hard: 48 (so you can still see what is happening) & despawn-check-freq = 1

Airplane :

https://streamable.com/oi2yen

Same test completed on Tuinity #21 :

https://streamable.com/f3p6x7

Do you feel as though this is accurate to what you're experiencing?

If not it could be that in your test some of the zombies are being moved outside of ticking chunks before they are able to be discarded, (due to the delay that you experience in my Airplane video)

PaulBGD commented 3 years ago

I appreciate the in-depth look, non-persistent mobs definitely should be getting removed. I'll take a look into this later today.

Puremin0rez commented 3 years ago

Do you feel as though this is accurate to what you're experiencing?

Absolutely, nice video :P

My guess is that since my ticking view distance is low and my hard range is based around that, just moving around the world normally is causing chunks to go from ticking to non ticking and the despawn check being throttled (as perfectly demonstrated in your video) is making it really difficult for mobs to naturally despawn.

PaulBGD commented 3 years ago

I think I'll go ahead and remove the despawn check limiter. I'm not sure what's making it act so strange on 1.17 vs 1.16, but it's a hack anyways which doesn't need to be in Airplane.

PaulBGD commented 3 years ago

I'll leave this open as a tracking issue, but hopefully this looks more consistent now.

Puremin0rez commented 3 years ago

Despawning is now working as I would expect using Airplane #55, thanks!

Likewise, mob spawning now feels better (comparable to Tuinity) as mobs underground are no longer sticking around and consuming the mob cap.

PaulBGD commented 3 years ago

Ironically I now think I found the line with the issue:

if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > level.paperConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances

If we changed the random removal of mobs in the soft distance the patch might've been fine, but oh well. Glad to hear it's fixed.