MobArena
MobArena copied to clipboard
Custom distance from spawnpoint to be activated
Summary
- This issue is a…
- [ ] Bug report
- [X] Feature request
- [ ] Documentation request
- [ ] Other issue
- [ ] Question
- Describe the issue / feature in 1-2 sentences: This feature consist on a simple config option to customize the necessary distance between a spawnpoint and a player to be activated and spawn mobs per arena.
Background
Feature request
-
Feature type:
- [X] Arena configuration
- [ ] Classes
- [ ] Documentation
- [ ] Economy integration
- [ ] Leaderboards
- [X] New config settings
- [ ] Other (please explain)
- [ ] Rewards
- [ ] Third-party plugin support
What does it do?: This feature is designed specially for "vertical" mobarenas. I have an arena on my server that is like steampunk city inside a mountain, very vertically built. So this is a problem, because mobs can spawn on the floor downstairs from where the players is, or upstairs. To solve this issue, there would be a custom value (15 default) on every arena configuration, so that it can be reduced and mobs can spawn on more accurate locations.
Does it need new or changed commands? What are they?: No commands need to be changed.
Does this feature affect other parts of MobArena?: Only configuration file, as a new variable per arena.
To solve this issue, there would be a custom value (15 default) on every arena configuration, so that it can be reduced and mobs can spawn on more accurate locations.
If I understand right, this is about setting up spawnpoints in an area. I don't think you're asking for me, since we can't go higher, but it's an interesting idea to lower the radius.
@garbagemule Any idea if this is an easyfix or a difficult task?
Exactly, the idea is to make this value: "MobArena only uses spawnpoints in a 15-block radius from any player" as a variable per arena, so it can be a lower value or higher.
So the reason we can't go higher is because of Minecraft/Spigot limitations. Basically, forcing a monster to target a player outside of a 16-block radius will cause the monster to freeze in place until A) the target player moves within the radius, or B) another player attacks the monster (and thus steals aggro from the other player). Historically, the only way to "fix" this problem is to bypass the API (which means the plugin would break on every Minecraft update).
As for lowering the radius, I'm not entirely sure this is the right solution. It comes with a few obvious issues:
- At 3 or 4 blocks, mobs would be spawning literally on top of players a lot of the time, meaning it would be almost impossible to have strategic "preparation spots", which is something I've noticed is pretty crucial in "hardcore" MobArena'ing.
- Lower radius means higher density, and as it is right now, the algorithm for finding valid spawnpoints is a scary
O(n*m)
, wheren
is the number of spawnpoints andm
is the number of live players.
Before introducing customization that will likely cause more harm than good, I think it's worth exploring strategies that are more "map aware". Direct line of sight and A* are two obvious algorithms to try out (and benchmark!).
Another complex solution could be to introduce the notion of a "sector" or "district", which is more coarse-grained than single blocks, but more fine-grained than the arena region itself. The big problem here is managing and setting up these sub-regions. With no proper way to visualize the regions, it becomes really hard to see what's going on.
What do you mean with this?
Direct line of sight and A* are two obvious algorithms to try out (and benchmark!).
@MetalGearDaner Currently, the algorithm for finding spawnpoints for a wave is a very naive check: "is there a player within 15 blocks of this spawnpoint? if so, it is a valid spawnpoint". The check does not take any kind of context into account, which is ultimately the problem we wish to solve. The context we want to solve for is "map awareness".
One way to do this is to introduce an extra check, e.g. "is there a direct line through traversable blocks (air, water, grass) from this spawnpoint to a player?". That's direct line of sight.
A* is a fast path finding algorithm that takes obstacles into account. In the case of a map with multiple floors, the direct, map unaware distance from a spawnpoint on one floor to a player on the floor below would be maybe 5 blocks, but having to follow a valid path via a staircase or something would be maybe 40 blocks, and thus "too far".
Hmm, I guess the best fix then would be to design an algorithm that takes in account the path that the mob may have to follow to get to the player. At least, setting a maximum ammount of blocks for that path to be valid. So A* seems to be an excellent idea for this!
There is some overlap between the investigative area of this issue and #430
I revive the topic with what was discussed in discord.
I have spigot and paper quite optimized in terms of tracking and range of mobs activation, this affects the arena? have you checked? it would be nice if there are servers that have this feature quite optimized that MobArena forces mobs to activate from a long distance, so that this does not make the plugin quite heavy in terms of performance you could add an option in the settings to enable or disable this option, as I was testing days ago and mobs that are a bit far from players do not activate, do not attack players (you have to get quite close to them, which allows players with bows like to easily kill mobs). It would be nice if this option would make the mobs activate and mark the player if he is in the same region of the arena for example, an option to disable and enable in the settings or to set the distance blocks where the mobs will mark the players.