SimplerZone | Fast & simple spatial zone module, ultra fast successor to SimpleZone

[^#] SimplerZone (stable)

GitHubDocsdisc

donatedonate

Pesde

Find more of my resources in my index


SimplerZone is the official successor to SimpleZone and LessSimpleZone, using almost no spatial query api with the exception of meshes, making it much faster than both.

The api is also structured better (see documentation)

A test place will be available in the GitHub page, if it isn’t then i’m working on it.

Download the module in the GitHub releases
Happy coding!

12 Likes

This is awesome, I’ll definitely be using. Great work! :slightly_smiling_face:

2 Likes

I’m eagerly awaiting the release of SimplestZone™

5 Likes

Hey, I encountered an issue when requiring the module from the client, I created a pull request with a simple fix!

4 Likes

Insanely useful module, solved all the problems with Zone+
The only thing I can recommend: make it able to set models as zone instead of just parts, here’s how I did it:
inside shapeInstanceFromPart change

shapeInstance.cframe = part.CFrame

to

local targetCFrame
if part:IsA("Model") then
	targetCFrame = part:GetBoundingBox()
else
	targetCFrame = part.CFrame
end
shapeInstance.cframe = targetCFrame

and inside createShape add:

elseif part:IsA("Model") then
return {
	ty = "Box",
	transform = CFrame.identity,
	size = part:GetExtentsSize() :: any,
}

now you’ll be able to create zone using model!

3 Likes

Thank you, it’s actually helpful

1 Like

Hi, i’ll be including this in 0.1.0 including other features and some documentation fixes. :heart:

1.0.0

  • trackGroup is now its own namespace (BREAKING CHANGE)
  • Added trackGroup.forTag(tag: string) to create a group that dynamically changes based on CollectionService tags
  • Fixed docs
  • The players and localPlayer TrackGroups are now stored inside the trackGroup namespace instead of defaultGroups (BREAKING CHANGE)
  • shape.fromPart() and shapeInstance.fromPart() now accept Models and use their bounding boxes
  • Requiring from the client no longer causes an error (@Krixiup)

New Contributors:

@Curscs
@Krixiup

2 Likes

Found serious bug! Sometimes :observer doesn’t detect when player exits the zone and doesn’t call the function so game thinks you’re still in zone

1 Like

I can’t seem to replicate the problem. What does your script look like?

Hey, just wanted to say this module is really useful and performant. I’ve been integrating it into my project and its been a great improvement over manual overlap polling.

That said, I ran into something that I think is worth addressing. The documentation around ZoneItem and hitbox usage is a bit unclear, and I think theres a missing feature that would make the module a lot more practical.

Right now when :observe() fires, the callback only receives the item (player/model), but theres no way to know which specific shapeInstance triggered it, and more importantly, there’s no way to attach custom data to a shapeInstance. This becomes a real problem when you have multiple hitboxes with different properties, for example different enemies each with their own damage value.

To show what I mean:

local function attachEnemyHitbox(enemy: Model, damage: number)
    local shapeInst = Zone.shapeInstance.new(hitboxShape)
    shapeInst:syncWithAttachment(rootAttach)
    shapeInst:attach(hitboxZone)
end

Inside :observe(), theres no way to reference which enemy or what damage value belongs to the shapeInstance that triggered the overlap. The enemy and damage variables are out of scope.

The workaround right now is creating a separate Zone and listener per hitbox, but that feels like it goes against the purpose of the module and probably has performance implications at scale

I think the cleanest solution would be adding a way to attach arbitrary data to a shapeInstance, something like:

shapeInst:setData({
    damage = 5,
    enemy = enemyModel,
    hitbox = hitboxPart,
})

Then inside :observe(), that data would be accessible through the item or a second argument so you can handle per-hitbox logic without needing separate listeners. The table contents could be anything the user defines which keeps it flexible.

This would make the enemy hitbox use case (and many others like gas zones, damage areas etc.) work naturally with a single shared listener.

Looking forward to seeing where this goes, the core of the module is solid and just needs this one piece to be complete :+1:

1 Like

Oh yeah i can definitely add shape instance metadata and passing shape instances to listener callbacks, gonna be added in 1.1.0 :+1: Thanks for the feedback!

Hi, can i get more specifics? The code, if your zones are moving, possibly a .rbxl file? Last one would be the best as i’d be able to diagnose the issue directly, thanks for the notice!

1.1.0


  • Added Zone:getShapeWithPoint(point: vector) -> ShapeInstance? and Zone:getShapeWithBox(cframe: CFrame, size: vector) -> ShapeInstance? for people who wish to get the corresponding shape a point/box is inside of.
  • ZoneItems passed to ZoneListener listener callbacks now have a special shape: ShapeInstance? field pointing to what ShapeInstance the item has entered/exited. (This field will be nil during initial callback call in the case of ZoneListener:observe(), but also when the listener unsubscribes from that zone, when the item itself is being destroyed, parented to nil, etc.)
  • Listener callbacks of ZoneListeners will now error if they yield
  • Added ShapeInstance.metadata: {[string]: any} field
  • Zone:rebuild() now uses Bvh.updateBvh() instead of Bvh.createBvh(). This change comes because shapeInst is now a field stored inside leaf BvhNodes and thus it is now possible to update the corresponding branches correctly using comparison.
1 Like

I don’t have that script anymore, but it was bugging when entering and leaving zone at high speed and the script was looking like somthing like this:

local isInZone = false

--...Code
Listener:observer(function(Item)
  isInZone = true
  return function()
    isInZone = false
  end
end)

Hi, i couldnt replicate this even with my character moving at insanely high speeds

Code (unecessary parts removed):

--!strict
local playerGroup = Zone.trackGroup.players

local zone = Zone.forParts(workspace.Zone:GetChildren())
local listener = Zone.listener.new({
	groups = {playerGroup},
	zones = {zone},
	queryShape = "Box",
	precision = "Part"
})

listener:observe(function(item)
	local plr = item.player
	local character = item.model
	if not plr or not character or not item.shape then return end
	
	print(`{plr} entered`)
	return function()
		print(`{plr} exited`)
	end
end)