New Concept: Proximity Spawning (to reduce bandwidth usage)
While talking over performance issues with one of my guides, I came up with an idea that might be an awesome new feature to make a huge impact on the emulator. I think this feature could potentially reduce server load and bandwidth usage by a very noticeable amount.
I think this may also help reduce zone crashes or player LDs from raids in highly populated zones. I have tested and found that a zone with a large amount of spawns will almost always have lag if a raid of 3 groups or more is in it and fighting, but if they fought the same encounter in a zone with only a couple of NPCs there is no lag at all.
The idea is to have a way for spawns to only spawn if a player is within a set proximity to them. So, if a player is in 1 corner of the zone and no other players are in the zone, only the mobs in that corner of the zone would be spawned, which should considerably lower the traffic being sent to the client and possibly server load to manage pathing, scripts, etc on the other NPCs that aren't spawned. As players move throughout the zone, mobs set to use this system will spawn around them as they get within a set range.
The Details so far:
1. To make this work, we could use something similar to aggro radius or proximity, where the spawn point is waiting for a player to enter it's radius before actually spawning if doesn't have time left on the spawn timer. I think that the code for aggro radius might be a good place to start for getting this setup. The server will look at the spawn locations and set a radius to spawn for NPCs that are set to use this feature.
2. I am thinking that either the spawn_conditions table or maybe even just the npc_types table could be used to simply define 2 things to set this up. The first setting would be either 0 or 1 for if you want that particular NPC to use this system or if you want it to spawn normally. This way, you can have named mobs that are always up and just set trash spawns to use this system to reduce the bandwidth load. Any special NPCs with scripts or special pathing can all leave this feature disabled, to make this setup as customizable as anyone wants. The second setting will just be the radius range for the NPC to spawn in. If you are spawning small indoor zone like an LDoN dungeon, you could probably set all trash mobs to spawn within a 200 radius and no one would ever even be able to tell that this system was different than how it worked before (accept MQ users who would be like "WTF" lol). Or, if you were doing a large outdoor zone, you might set the range as far as 600 or so. I don't think mobs are drawn much further than that anyway. Even with a large range like that, a huge zone could still be over 50% empty most of the time, which should make a huge impact on bandwidth.
Post here if you have any concerns, suggestions or thoughts on this system. I think it should be doable and might make a huge difference on servers with limited bandwidth!
I am going to see if I can start figuring out where to even begin on coding this, but if any of the coders want to help out, you are more than welcome! If this ever gets finished, I would be extremely excited to try it out and see what if any impact it has on bandwidth and server load.
|