Most excellent!
Thank you!
Looking forward to checking it out.
Most excellent!
Thank you!
Looking forward to checking it out.
Hello, I’ve appended the test place to the post.
LessSimpleZone:UpdateVolume()
to use the new BVH.updateBVH()
function I recently added for SimpleZone
instead of completely reconstructing the BVH. Very nice!Zone:IsPointWithinZone()
traverse the BVH instead of looping through all leaves (except for BasePartVertexZone), this reduces time complexity from O(n) to O(1) (from my calculations, it’s probably very close to constant time tho The download link has been updated
:IsPointWithinZone
return the part/box node/tetrahedron that contained the point as the 2nd argumentQueryOptions
constructor directly into LessSimpleZone instead of having to access SimpleZone firstHi, there are several steps I would take here, if you haven’t already:
QueryOptions.UpdateInterval
to the necessary value, usually 1/30 is pretty goodQueryOptions.InSeperateQuerySpace
and manually copy items you wanna query via Zone:CopyToQuerySpace()
, this reduces performance issues purely from Workspace
containing alot of stuffIf after all this you still have performance issues I’d encourage you to send your microprofiler dump so I can see what’s taking up so much frametime (or just tell me xd)
Wait, what version are you using?
A test place is present on the SimpleZone post
Ahh, the latest version is 108, I’ll update the download link real quick just incase that’s the problem
also i only had 2 different zone.
What constructor are you using? .fromParts
and .fromBoxes
tend to be the best
local zone = Zone.fromParts({ … }, options)
Hmm, yeah I’d try just downloading the newest version (i updated the download link) and seeing if that fixes it, if not and query spaces still don’t work I guess i need to work on a new update!!!
just slightly better than before, and it will go down once more players joined
4 players in a server can get 40-55fps, but once it hit more than 5, it can go down over 30 or lower…
-- first zone
local Zone = require(Shared:WaitForChild("Zone"))
local options = Zone.SimpleZone.QueryOptions.new()
options.ThrottlingEnabled = true
options.UpdateInterval = 1/25
options.AcceptMetadata = false
local zone = Zone.fromParts(Helper.storage.GlobalConfig.SafeZoneArea:GetChildren(), options)
zone:BindToHeartbeat()
zone:ListenTo("Player", "Entered", function(player: Player)
add(player, true)
end)
zone:ListenTo("Player", "Exited", function(player: Player)
remove(player, true)
end)
-- second zone
local Zone = require(Shared:WaitForChild("Zone"))
local options = Zone.SimpleZone.QueryOptions.new()
options.ThrottlingEnabled = true
options.UpdateInterval = 1/24
options.AcceptMetadata = false
local zone = Zone.fromParts({ Helper.storage.GlobalConfig.KoHArea.Area }, options)
zone:BindToHeartbeat()
zone:ListenTo("Player", "Entered", function(player: Player)
if player and player:HasTag("DataLoaded") and player.Character then
table.insert(KoHController.in_zone, player)
end
update_koh()
end)
zone:ListenTo("Player", "Exited", function(player: Player)
if player and table.find(KoHController.in_zone, player) then
table.remove(KoHController.in_zone, table.find(KoHController.in_zone, player))
end
update_koh()
end)
i had migrated other zones (except these two) with this simple function
Helper.is_in_box = function(size: Vector3, c: CFrame)
c = c:Inverse()
size = size/2
return @native function(pos: Vector3)
pos = c * pos
return not ((pos.X >= size.X) or (pos.X <= -size.X)
or (pos.Y >= size.Y) or (pos.Y <= -size.Y)
or (pos.Z >= size.Z) or (pos.Z <= -size.Z)
)
end
end
I’ll try seeing if I can replicate the performance issues, I’ll let you know when a fix has been implemented Just to confirm, can you send the amount of zone parts you have, and the rough size and shape of each one?
e.rbxm (14.0 KB)
here for the parts
when hit about 10-15, it can go down to 7-10 fps
Hi, unfortunately i can’t replicate the performance issues Can you try providing an OverlapParams to
:BindToHeartbeat()
? If the zone is just detecting players this should be pretty easy to do