User avatar
By SKyTheThunder
#241145 As far as I'm aware at the moment only natural spawns register for this spawn cap, since they're the only thing actively spawning in relation to a specific player. But that still leaves a lot of other ways to surpass that limit, which can have quite an impact on performance.

I would suggest two things:
  1. Any Pokémon that is spawned in (and doesn't already have a player it spawned on) looks for the nearest player and registers for them.
    This prevents things like Group Spawns from massively bypassing the entity limit. Currently you may get unlucky and have several times as many Pokémon around you than what you set the cap to. With them registering, it would stop all spawns as soon as a group goes over the limit, and only resume once enough have despawned for it to fall below the cap again.
  2. Statues, Village NPCs and similar persistent entities dynamically register to the respectively nearest player within draw distance at the time.
    That way these additional entities will effectively lower the spawn cap while nearby, to keep the total number consistent. It should also make Statues less of a performance risk, because for each one placed you'd in turn have one Pokémon less to take up resources. The checks for that wouldn't need to be too frequent either - just enough to be on the same order of magnitude as spawn events.

Overall this should make sure that natural spawns at the very least won't make things worse in a busy area, by considering any entities that already exist. As a side effect you would have fewer spawns around villages as well, which also is a plus for me, considering the limited space.