Profiler issue raised for raids #3077
Labels
No Label
#P1 CRITICAL
#P2: HIGH
#P3: elevated
#P4 priority: medium
#P6: low
#Review
annoying
API
bug
code quality
combat
commands
compatibility
configurability
contribution inside
controls
core feature
creative mode
delayed for engine release
documentation
duplicate
enhancement
environment
gameplay
graphics
ground content conflict
GUI/HUD
help wanted
incomplete feature
invalid / won't fix
items
looking for contributor
mapgen
meta
mineclone2+
Minecraft >= 1.13
Minecraft >= 1.17
missing feature
mobile
mobs
mod support
model needed
multiplayer
Needs adoption
needs discussion
needs engine change
needs more information
needs research
nodes
non-Minecraft feature
non-mob entities
performance
player
possible close
redstone
release notes
schematics
Skyblock
sounds
Testing / Retest
tools
translation
unconfirmed
mcl5
mcla
Media missing
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: VoxeLibre/VoxeLibre#3077
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A minetest dev raised a profiler spike for raids. It's worth considering if we can tweak this slightly.
@PrairieAstronomer Any ideas? If not, I can try to check it out later.
Here's the full interactive profiler graph (mcl2 commit
826b9fcc45
, minetest 5.7.0-dev, profiled on a pretty much new world) if anyone wants to check: https://grejer.voxelmanip.se/uploads/mcl2_001.svgMost importantly, it looks like
mcl_raids.find_bed
and/ormcl_raids.find_villager
being called bymcl_raids.find_village
has some kind of bottleneck.@rollerozxa analysis is spot on here. I suspect it's find bed:
It's looking 128 blocks! I'm wondering if that's looking in all directions, cause that's gonna be expensive.
I'm wondering if we just find beds a certain distance from the town bell. That could make that computationally less expensive, because village structures spawn from near the bell. If the raid starts near the bell, or heads to the bell and goes from there, it could be efficient.
Question: wouldn't finding the town bell be as computationally expensive? or am I missing something here?
Maybe you're right. I don't think I engaged brain fully at that point.
For most stuff villager related, we check within 48 blocks and it isn't that bad. Perhaps we shouldn't look to start a raid more than 48 squares away from a player. It feels a bit excessive, and if that's 48 squares in all directions, that's a lotta squares.
Because you need to be near the village for this to be meaningful, maybe 32/38 squares from town bell would make sense.
32m away would be a lot better. (1/16th the scanning area of 128 -- like image size, cutting it in half reduces it by a factor of 4.)
This is profiler results from one of our players who's server slowed down. Over 50% on zombie siege finding a village.
I will fix this this weekend and test. I will also ensure it doesn't check for village if it's not the correct time, so it doesn't do this processing at all during the day.
Fyi... multiple zombie raids can be started (so, probably pillager raids too)... So... Need to add in a zombie raid start check, to see if a raid is already started... and if it is, disallow starting a new one.
I crashed my game trying to test it out...
I would say the distance should probably be the same as the villagers check, which I believe is 16 nodes.
I dont recall making it 128, but I could be wrong.
Well, I found the commit that messed this up,
37144f8787
.Also, from discord:
JoMW1998 — Today Hi I just came back and saw that mineclone 2 just crashed with this error AsyncErr: Lua: Runtime error from mod '??' in callback environment_Step(): ...s\mineclone2\mods\ENVIRONMENT\mcl_zombie_sieges\init.lua:13: attempt to index local 'm' (a nil value) stack traceback: ...s\mineclone2\mods\ENVIRONMENT\mcl_zombie_sieges\init.lua:13: in function 'on_stage_begin' ...64\bin..\games\mineclone2\mods\CORE\mcl_events\init.lua:85: in function <...64\bin..\games\mineclone2\mods\CORE\mcl_events\init.lua:72> F:\minetest-5.6.1-win64\bin..\builtin\game\register.lua:431: in function <F:\minetest-5.6.1-win64\bin..\builtin\game\register.lua:417>
Thought that it should be known.
Looks like a different crash than the one fixed in #3063 .
What mineclone version is this user running, current git?
Please submit a new issue for this if the user cannot do it himself.
I guess we need to add another check-object-before-use there.