kangarko / CoreArena

A high-end monster arena Minecraft plugin with procedural damage and RPG system. Maps included!
https://www.mc-market.org/resources/21643/
30 stars 12 forks source link

Next Phase mode: monsters gets stuck often even though there are no mobs in the arena #373

Closed LeehamElectronics closed 4 years ago

LeehamElectronics commented 4 years ago

When playing in arenas with next phase mode set to monsters, the arena often gets stuck thinking there is still 1 mob left to kill even though there is not. I can confirm this by running /killalll monsters and /killall mobs and observe that no mobs are present in the world.

Here is my console log with CoreArena in debug mode: https://pastebin.com/paan2DnD Here is a screenshot of the evidence: https://imgur.com/gallery/NiWWUbS

I have noticed that running /killall entities does fix the issue, so there must some sort of random entity that CoreArena detects as a mob, I just don't know how to diagnose the issue.

I am not sure what is causing this issue, I hope you can find a way to fix it, Thanks!

kangarko commented 4 years ago

Hi there!

I could not reproduce your problem, https://www.loom.com/share/1b10f9ea4c664cbb9d457b8f8fc29502?from_recorder=1

Ensure no entities are saved when using WorldEdit snapshots. You can also set the Debug option I show in the video to see what happens.

LeehamElectronics commented 4 years ago

Okay thanks @kangarko I will try soon, would it be possible to add a mob tracker placeholder that returns the xyz location of the nearest mob that needs to be killed? Something like: corearena_ARENA_PLAYER_nearestMobLoc This would be great for diagnostics and as a really cool feature for score boards for when players cant find that last mob, Thanks for the detailed video response too, I appreciate the detail and effort there.

Thanks!

kangarko commented 4 years ago

Added. If anything just comment below.

Skjermbilde 2020-11-01 kl  17 57 24
LeehamElectronics commented 4 years ago

Nice work, however I just realized showing co ordinates on a score board is pretty hard for players to look at, would you be able to add one that calculates how many blocks away the nearest mob is instead? You have already done most of it, just need some math like player x - nearest mob x and so forth. And then make another place holder that returns the the amount of blocks (integer) that is between the player and the nearest mob. They may be an algorithm on the web available for calculating it since it is a vector equation which might be slightly more complex since there's 3 dimensions.

Here is an example of the algorithm that would work well in my opinion from https://minecraft.gamepedia.com/Tutorials/Measuring_distance

Euclidean Distance in 3 Dimensions (Including Elevation)

The above calculation is correct if you want the "map" distance between two points (i.e., only the north–south (z) and East/West (x) distance). But if you wish to include the elevation (y) in the distance calculation as well, that's very easy to do: Simply add the y coordinates to the above distance formula, as shown in bold text, below:

d = sqrt( (x1 - x2)2 + (y1 - y2)2 + (z1 - z2)2 )

Referencing the above debug screens again, our 3-dimensional coordinates are as follows:

x1, y1, z1 = -35, 68, 97
x2, y2, z2 =  76, 43, -5

Again, solving for d, with differences in bold text:

d = sqrt( (x1 - x2)2 + (y1 - y2)2 + (z1 - z2)2 )
d = sqrt( (-35 - 76)2 + (68 - 43)2 + (97 - -5)2 )
d = sqrt( -1112 + 252 + 1022 )
d = sqrt( 12321 + 625 + 10404 )
d = sqrt( 23350 )
d = 152.81 m

Thanks @kangarko !

LeehamElectronics commented 4 years ago

Ooh, maybe you could even duplicate this method and make a placeholder that returns the nearest player in blocks (integer) for our PVP mob arenas? That would be pretty cool...

LeehamElectronics commented 4 years ago

Also might be worth adding to the FAQ's about using 'monsters' as next phase mode so players know to check to make sure there is no entities / aggressive mobs inside the arena when saving a snapshot. If you like I can update the wiki to help out since you don't have much time...

kangarko commented 4 years ago

Thanks, added.

Can you please update the wiki to add this variable and your suggestion as well?

Skjermbilde 2020-11-04 kl  19 00 53
LeehamElectronics commented 4 years ago

Yep I have updated the Wiki, let me know what you think. I noticed you already added the nearestmob placeholder to the wiki, sorry I didn't see your email earlier. Would also be great to see these two placeholders for nearest player too if you get time. Thanks!

kangarko commented 4 years ago

Thanks!