It currently has the features I need. I’ll come back to this if i need to in the future
Having this issue where a player that died in a zone stops firing the Enter and Exit events after respawning and going into new zone instances. Is this something that was encountered before and has been fixed?
Has been fixed in newer versions
alright so i downloaded it from the creator store instead of getting the rbxm., seems to be the latest. i think you should remove that option so ppl like me dont download the old version
Im keeping it because it has the packagelink which allows updates to be automatically downloaded, though I do think i need to refresh the download
Optimization Update:
-
Changed BVH traversal to be iterative instead of recursive
-
Added
ThrottlingEnabled
andUpdateInterval
fields toQueryOptions
if you wish to slow down updates done byZone:BindToHeartbeat()
-
Changed
Zone:BindToHeartbeat()
to usePostSimulation
instead ofHeartbeat
, this is faster due to how the task scheduler handles update orders (and also now the name is kinda inaccurate, but I’m keeping it for backwards compatibility sake) -
BVH nodes are now aligned to the 4x4 voxel grid (The voxel size can be configured by going to the
BVH
module and changing theVOXEL_SIZE
constant) -
Added
SimpleZone.fromPartsLPO()
(fromPartsLocalPlayerOptimized) which does not do queries for every non-leaf node, and instead does a local player within bounds check. I may remove this constructor in the future and generalize it to one where you can use anything that contains a .CFrame property -
Added 2 more overloads to
SimpleZone.new()
which encompass.fromBoxes()
and.fromParts()
-
Made it so that signals aren’t fired if there aren’t any functions connected to them
And a few other minor changes
Known Issues:
- Script activity can exceed 1% if zones are extremely big (probably the only way to fix this is to implement a global zone tracker, that way I can do operations that consider the entire world)
Download link has been updated and the new update is also available on the marketplace.
Update:
- Removed the
Types
module and integrated all types into the main module - Moved all docstring comments to ontop of where the function is declared (This makes understanding functions quite a bit easier)
- Changed one of the 2 major loops in
Zone:Update()
to be an iterator loop instead of a counter loop to reduce table accesses (This should provide some minor speedups)
Coming Soon:
-
Global zone tracker to do more performant operations considering all zones instead of just the space 1 zone occupies
-
Spatial partitioning using CollectionService (inspired from 1 devforum post called something along the lines of “Spatial partitioning with tags: the poor mans octrees”, if you can provide the link I’d be happy to credit him)
Potential Issues:
- I’ve heard from 1 person that they were experiencing issues about the
PlayerLookup
module, however they didn’t really tell me what it was. If anyone else experiences related issues, let me know.
If anyone has issues updating, let me know. The new version (should) be available on the marketplace, and the download link has been updated.
To know if you have the latest version, the version number of your PackageLink
should be 38+ (it was replaced a while back), and the top of the module should look like this:
If your download of SimpleZone
doesn’t match, I would recommend redownloading and replacing your old copy
Is this getting a Wally port? I suspect it wasn’t made via a git repo
Yeah probably not, I have a ton of trouble setting that stuff up
Package Version 44+:
-
Fixed a pretty major memory leak inside the
PlayerLookup
module which was because theplayerOwned
tables weren’t being cleared when a player left. This is now fixed -
Added a
ClientOnlyDetectLocalPlayer
attribute to the module if set to true then ifSimpleZone
is ran on a client context it will only add theLocalPlayer
to the player lookup tables, which saves on memory. -
Fixed
SimpleZone.new()
from not detecting BasePart arrays
Right now I’m working on making the PlayerLookup
use less memory-heavy lookups, it will be released in the same update as the global zone controller.
This hopefully should be the last update before the global zone controller is done, stay tuned!
The new update is available on the latest package version (44+) and the marketplace.
Package Version 47:
-
Added the global
Zones
module (which is just this little module handling updates):
I don’t know why but the addition of this module made script activity display 0 activity and 0/s activity at all times (And this is for quite a big zone, 200 parts each size 100)… maybe it’s just because it’s a layer that the script activity display can’t interpret? i dunno.
I’ll just take this as a sign thatSimpleZone
is finally good :V -
Changed the
PlayerLookup
module to use only 1 table (for lookups) instead of 2 (1 for lookups, 1 for checking what parts the player owns.)
This change, of course, reduces memory allocation by half. The next step would be to not register small bodyparts such as the lower torso, arms, etc, like howZonePlus
does (however I kinda forgot to put that in this update so that’ll be included later) -
Changed
AcceptMetadata
inQueryOptions
to be true by default to prevent some odd behaviour regarding.fromBoxes()
zones (as they pass metadata) -
Changed
SimpleZone.fromPartsUpdatable()
to update the zone correctly :V
Anyways, that’s all for this update. It’s alot in a few features!! The script activity used to be insanely high just for a few zones
More optimizations coming soon
The new version can be found on the marketplace or via the latest package link
Seems I have no permissions to your marketplace, do we have to request the plugin here to get access?
I’m confused on how BindToHeartbeat works, I’ve included OverlapParams with it that only includes a folder for character models but every method is still firing whenever any part enters.
local Options = SimpleZone.QueryOptions.new()
Options.FireMode = "Both"
local SearchParams = OverlapParams.new()
SearchParams.FilterType = Enum.RaycastFilterType.Include
SearchParams.MaxParts = 100
SearchParams.FilterDescendantsInstances = {workspace:WaitForChild("Characters")}
for _, part in pairs(WaterParts:GetChildren()) do
local Zone = SimpleZone.fromPartParallel(part, Options)
Zone:ListenTo("BasePart", "Entered", function(part:BasePart)
print(part)
end)
Zone:BindToHeartbeat(SearchParams)
end
Hello, unfortunately I cant check right now because my laptop is brokeb, however Id try using something other than the parallel constructor as it hasnt been updated in a while
Yeah I’ve probably got it working right now thanks, I remember trying ZonePlus ages ago and having trouble with it and coming back to needing this functionality again this modules really clean.
can you share your solution with me? for some reason hitboxes are firing on accessories for me even though the params excludes {char}. only solution i had was not hit:IsDescendentOf(char)
Hello, can you share your code?
yes
local QueryOptions = zone.QueryOptions.new()
QueryOptions.ThrottlingEnabled = true
local params = OverlapParams.new()
params.FilterType=Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances={char}
params.MaxParts=1
params.RespectCanCollide=true
params:AddToFilter(part2)
local start = zone.fromPartParallel(part2,QueryOptions)
start:BindToHeartbeat(params)
part2.Destroying:Once(function()
start:Destroy()
end)
local hitted={}
start:ListenTo("BasePart","Entered",function(hit:BasePart)
if table.find(hitted,hit.Parent) then return end
if hit:IsDescendantOf(char) then return end
start:UnbindFromHeartbeat()
table.insert(hitted,hit.Parent)
part2.CanQuery=false
part2.CastShadow=false
part2.CanTouch=false
local enemy = hit.Parent
if enemy:FindFirstChildWhichIsA("Humanoid") then
local hum = enemy:FindFirstChildWhichIsA("Humanoid")
--do damage
end
end)
part2 is hitbox
I don’t think params are working correctly. I also just ignored other parts.