QuickZone | 60 FPS with 1M+ Zones | Ultra Fast ZonePlus / SimpleZone Alternative

[ QuickZone ]

60 FPS While ZonePlus and SimpleZone Drop To 5 FPS

99.6% Memory Reduction Compared To ZonePlus and 5x Smaller Than SimpleZone

*see Benchmarks section for more

Showcase Marketplace Documentation GitHub Discord



Why use QuickZone?

The Physics Bottleneck. Traditional zone libraries like ZonePlus are basically wrappers for Roblox’s physics engine. This results in expensive geometry calculations, unpredictable overhead, low flexibility, and much worse performance as the number of zones grows.

Physics-Free Scaling. QuickZone achieves O(N log Z) scaling using a custom Linear Bounding Volume Hierarchy (LBVH), making the number of zones virtually irrelevant to performance. That, plus the use of SoA and bitwise spatial sorting, makes QuickZone the fastest way to do spatial queries.

Agnostic. Whether you prefer classic event-driven programming, robust lifecycle management, or zero-allocation iterators for ECS architectures, QuickZone can fit your workflow.

Unit Tested. A rigorous unit testing suite ensures stable and predictable behavior across all systems.


Core Features

  • Endless Scale: The number of zones has zero impact on performance. Maintain 60 FPS even with over a million zones in your game.

  • Track Anything: Track Players, BaseParts, Models, Attachments, Bones, Cameras, or even custom tables. If it has a position, QuickZone can track it.

  • Budgeted Scheduler: Set a hard frame budget (e.g., 1ms) to completely eliminate lag spikes. Workloads are smeared across frames to maintain a flat, predictable performance profile.

  • Shape Support: Built-in for Blocks, Balls, Cylinders, Wedges and CornerWedges without relying on physics collision meshes. MeshParts and Unions are supported through their collision geometry.

  • Declarative Lifecycles: Replace event-based logic with the observe pattern for declarative logic. There is no need to manually track onEnter and onExit states.

  • Decoupled Architecture: Separate where tracking happens (Zones) from who is being tracked (Groups) and how the system responds (Observers). Bind complex behaviors to groups of entities with zero boilerplate.

  • ECS-Ready: Built-in support for zero-allocation iterators and deterministic manual stepping, making it a perfect fit for ECS architectures and data-oriented workflows

  • Zero-Allocation Runtime: By utilizing contiguous arrays and object pooling, QuickZone produces virtually zero GC pressure to avoid memory-related stutters.

  • Dynamic Zones: Use moving zones at very little cost. QuickZone maintains separate Static and Dynamic LBVHs for maximum efficiency.


Quick Setup

Getting started takes very little time. This is all you need to track every player across all zone parts tagged with ‘Checkpoint’.

-- Create and set up a checkpoint observer
local checkpointObserver = Observer.new({
    zones = { Zone.fromTag('Checkpoint') }, -- create zones on parts with the 'Checkpoint' tag
    groups = { Group.players() } -- tracks all players automatically
})

-- Observe players entering and exiting in just one block of code
checkpointObserver:observe(function(player, zone)
    print(`{player.Name} entered checkpoint zone {zone:getId()}!`)

    -- Return an optional cleanup function that runs automatically on Exit
    return function()
        print(`{player.Name} left checkpoint zone {zone:getId()}!`)
    end
end)

Familiar with ZonePlus?

If you prefer a more imperative coding style or are migrating logic from other libraries, QuickZone supports method chaining and standard events.

-- Create and configure your observer in a single chain
local checkpointObserver = Observer.new()
    :attach(checkpointZones)
    :subscribe(playerGroup)

-- Use traditional events for one-off actions
checkpointObserver:onPlayerEnter(function(player, zone)
    print(`{player.Name} entered`)
end)

checkpointObserver:onPlayerExit(function(player, zone)
    print(`{player.Name} left!`)
end)

How It Works

QuickZone is not instance-bound. It uses a Group-Observer-Zone topology, separating who is being tracked from where the tracking occurs and how the system should respond.

Expand

The Secret to Performance

If you are coming from ZonePlus or SimpleZone, you are used to a “Zone-Centric” model where the Zone itself handles the logic. QuickZone flips this:

  • ZonePlus: “Hey Zone, tell me when a player enters you.”
  • QuickZone: “Hey Observer, tell me when this Group enters any of these Zones.”

The Three Pillars

  1. Zones (Where): Mathematical boundaries (Static or Dynamic).
  2. Groups (Who): Collections of entities (Players, NPCs, Projectiles) with shared update rates.
  3. Observers (How): The logic bridge. Define behavior once (e.g., “SafeZone Logic”) and attach it to as many zones as you need.


Anti-Gravity Example (Including ECS Style)

This section showcases an anti-gravity system. QuickZone supports three coding styles, so choose the one that fits your architecture.

Expand

Option A: The Lifecycle Approach (Recommended)

Best for clean, modern code. You define relationships in a configuration table (Declarative) and use a single function to manage the active state (Lifecycle)

local QuickZone = require(game.ReplicatedStorage.QuickZone)
local Zone, Group, Observer = QuickZone.Zone, QuickZone.Group, QuickZone.Observer

-- Create a group that automatically tracks the client's character (including respawns)
local myPlayer = Group.localPlayer()

-- Find all current and future instances with the 'Water' tag.
local zones = Zone.fromTag('AntiGravity', {
    metadata = { GravityMultiplier = 0.4 }
})

-- Create an observer subscribed to the group and attached to the zones.
local gravityObserver = Observer.new({ 
    groups = { myPlayer },
    zones = { zones }
})

-- Define behavior
gravityObserver:observe(function(player, zone)
    local character = player.Character
    local hrp = character and character:FindFirstChild('HumanoidRootPart')
    if not hrp then return end
    
    -- Get the zone's gravity multiplier using metadata.
    local meta = zone:getMetadata()
    local multiplier = meta and meta.GravityMultiplier or 1
    
    -- Create the Anti-Gravity force on enter
    local force = Instance.new('BodyForce')
    force.Name = 'AntiGravityForce'
    force.Force = Vector3.new(0, hrp.AssemblyMass * workspace.Gravity * (1- multiplier), 0)
    force.Parent = hrp

    -- Automatically destroy the force when the player exits the zone
    return function() 
        force:Destroy()
    end
end)

Option B: The Event-Driven Approach (ZonePlus / SimpleZone Style)

Best for familiarity or for migrating ZonePlus code to QuickZone. You manually ‘wire’ objects together (Imperative) and use standard events like onEnter to trigger one-off actions (Event-Driven).

local QuickZone = require(game.ReplicatedStorage.QuickZone)
local Zone, Group, Observer = QuickZone.Zone, QuickZone.Group, QuickZone.Observer
local localPlayer = game:GetService('Players').LocalPlayer

local myPlayer = Group.localPlayer()
local zones = Zone.fromChildren(workspace.AntiGravityParts)
local gravityObserver = Observer.new():subscribe(myPlayer):attach(zones)

-- Connect events
gravityObserver:onLocalPlayerEnter(function(zone)
    local character = localPlayer.Character
    local hrp = character and character:FindFirstChild('HumanoidRootPart')
    if not hrp then return end

    local ref = zone:getReference() -- This returns the zone's part
    local multiplier = ref and ref:GetAttribute("GravityMultiplier") or 1 -- You can use attributes!

    local force = Instance.new('BodyForce')
    force.Name = 'AntiGravityForce'
    force.Force = Vector3.new(0, hrp.AssemblyMass * workspace.Gravity * (1- multiplier), 0)
    force.Parent = hrp
end)

gravityObserver:onLocalPlayerExit(function(zone)
    local character = localPlayer.Character
    local hrp = character and character:FindFirstChild('HumanoidRootPart')

    if hrp and hrp:FindFirstChild('AntiGravityForce') then
        hrp.AntiGravityForce:Destroy()
    end
end)

Option C: The Polling Approach (Data-Oriented / ECS)

Use iterators to poll state for continuous logic. To enhance ECS workflows, you can also turn off auto-updating and update QuickZone manually. It is even possible to manually link entities to a reference like an Id or an object.

local Players = game:GetService('Players')
local RunService = game:GetService("RunService")
local QuickZone = require(game.ReplicatedStorage.QuickZone)
local Zone, Group, Observer = QuickZone.Zone, QuickZone.Group, QuickZone.Observer

-- Disable auto-update for deterministic, manual stepping (optional)
QuickZone:setEnabled(false)

local localPlayer = Players.LocalPlayer
local characterModel = localPlayer.Character or localPlayer.CharacterAdded:Wait()

-- Track this Model's physical position, but return the local player in queries
QuickZone:setReference(characterModel, localPlayer)

-- Add the local player to the spatial group (QuickZone tracks the mapped model automatically)
local playerGroup = Group.new():add(localPlayer)
local zones = Zone.fromTag('AntiGravity', {
    metadata = { GravityMultiplier = 0.4 }
})
local gravityObserver = Observer.new({ 
    groups = { playerGroup },
    zones = { zones }
})

-- Process all spatial movement and LBVH tree updates in a specific order (only needed if :setEnabled(false))
local function spatialSystem(dt)
    QuickZone:update(dt) 
end

local function gravitySystem(dt)
    -- Instead of creating a BodyForce, we apply continuous math statelessly.
    for player, zone in gravityObserver:iterEntitiesInside() do
        local character = player.Character
        local hrp = character and character:FindFirstChild('HumanoidRootPart')
        if not hrp then continue end

        local meta = zone:getMetadata()
        local multiplier = meta and meta.GravityMultiplier or 1
        
        local upwardForce = hrp.AssemblyMass * workspace.Gravity * (1- multiplier)
        hrp:ApplyImpulse(Vector3.new(0, upwardForce * dt, 0))
    end
end

RunService.Heartbeat:Connect(function(dt)
    spatialSystem(dt)
    gravitySystem(dt)
end)

Usage Guide

QuickZone is designed around a three-tier architecture: Zones (where), Groups (who), and Observers (how).

Expand

1. Zones (Where)

Zones represent physical areas in the world. They are mathematical boundaries that can be static (fixed in space) or dynamic (following a part). They can be created from existing parts or defined manually with a CFrame and Size.

Bulk Creation

The easiest way to create zones is using the bulk constructors. The fromParts, fromDescendants, fromChildren, and fromTag return a Zones collection object, which acts as a logical unit allowing you to manage multiple zones at once.

-- Create zones from a CollectionService tag
local lavaZones = Zone.fromTag('Lava', {
	metadata = { damage = 10 }
})

-- Create zones from an array of parts
local safeZones = Zone.fromParts(workspace.SafeZones:GetChildren())

-- Create zones from all BaseParts inside a Model or Folder (Deep search)
local hazardZones = Zone.fromDescendants(workspace.TrapModel)

-- Create zones from only the direct children of a Folder (Shallow search)
local flatZones = Zone.fromChildren(workspace.FlatFolder)

Manual Creation

Useful for procedural generation or areas without physical parts.


local zone = Zone.new({
  cframe = CFrame.new(0, 10, 0),
  size = Vector3.new(10, 10, 10),
  shape = 'Block',
  isDynamic = true,
  metadata = { Name = 'Lobby' }
})

Single & Dynamic Creation

For maximum perfomance, use isDynamic = true for zones attached to moving platforms, vehicles, or projectiles.

local trainZone = Zone.fromPart(workspace.TrainCarriage, {
  isDynamic = true,
  metadata = { route = 'North' }
})

Updating Zones

Dynamic zones need to know when their physical reference moves. You can let QuickZone handle this automatically or control it manually.

You can quickly create a dynamic zone from an existing physical part. If you set autoSync = true, QuickZone will automatically update the zone’s position in the spatial tree every frame to match the part.

local truckZone = Zone.fromPart(workspace.Truck.Hitbox, { 
    isDynamic = true,
    autoSync = true
})

Because Zone.fromPart requires an object with a physical volume (like a BasePart), you cannot use it for abstract references like an Attachment or a Bone. Instead, you manually create the zone with a specific size and declaratively set its reference and autoSync.

local trainZone = Zone.new({
    cframe = train.CabinAttachment.WorldCFrame,
    size = Vector3.new(15, 10, 30),
    shape = 'Block',
    reference = train.CabinAttachment,
    autoSync = true, -- QuickZone automatically moves the dynamic zone with the attachment every frame!
    metadata = { route = 'North Express' }
})

Manual Syncing

If you prefer strict control over when spatial updates happen, leave autoSync off and update the zone manually.

-- Manually move a dynamic zone
dynamicZone:setPosition(Vector3.new(0, 50, 0))

-- Sync a dynamic zone to references's current CFrame, Size, and Shape
dynamicZone:sync()

2. Groups (Who)

Groups are collections of entities (Parts, Models, Players, etc.).

Specialized Groups

QuickZone provides built-in abstractions that automatically handle player lifecyles.

-- Tracks all players in the server
local allPlayers = Group.players()

-- Tracks only the local player (client-side only)
local myPlayer = Group.localPlayer()

Custom Groups

For NPCs, projectiles, or vehicles, create a standard Group.

local projectiles = Group.new({
    entities = workspace.Projectiles:GetChildren()
})

Managing Entities

You can add BaseParts, Models, Attachments, Bones, or tables with a Position.

-- Add a Model (tracks the PrimaryPart or Pivot)
enemies:add(npcModel)

-- Add a specific Attachment (tracks the exact point)
-- This is great for offsets if you do not want to track the middle of a part (e.g. sword tip)
enemies:add(sword.TipAttachment)

-- Add a table
local spell = { Position = Vector3.new(10, 5, 0) }
enemies:add(spell)

-- Clear the enemies group when done
enemies:clear()

3. Observers (How)

Observers act as the logic layer. They subscribe to Groups and attach to Zones to bridge spatial data with game behavior.

Setup

An Observer listens to its subscribed Groups and checks if they overlap with its attached Zones.

local observer = Observer.new({
	updateRate = 60,   -- Check up to 60 times a second
	precision = 1.0,   -- Only query if the entity moves more than 1 stud
	priority = 5       -- Used to resolve overlapping zones
})

observer:subscribe(allPlayers)
observer:attach(healingZones)

Lifecycle Management

For logic that should persist while an entity is inside a zone (e.g., UI, music, status effects), use the observe methods. These accept a callback that returns a cleanup function, which runs automatically when the entity exits.

-- Generic observation
observer:observe(function(entity, zone)
	print('Entered', entity)
	local highlight = Instance.new('Highlight', entity)
	
	return function()
		print('Exited', entity)
		highlight:Destroy()
	end
end)

-- The callback fires when the first entity of a group enters, and the 
-- returned cleanup function fires when the last entity of the group leaves.
observer:observeGroup(function(group, zone)
	print('Group ' .. group:getId() .. ' has arrived!')
	local boss = workspace.Boss:Clone()
	boss.Parent = workspace
	
	return function()
		print('The group has been wiped out or left.')
		boss:Destroy()
	end
end)

-- Player specific
observer:observePlayer(function(player, zone)
	local forceField = Instance.new('ForceField', player.Character)
	
	return function()
		forceField:Destroy()
	end
end)

-- LocalPlayer specific
observer:observeLocalPlayer(function(zone)
	local sound = workspace.Sounds.SafeZoneAmbience
	sound:Play()

	return function()
		sound:Stop()
	end
end)

Events

For logic that happens exactly once on entry or exit (e.g., playing a sound effect, dealing damage, analytics), use the event listeners.


-- Individual entity events
observer:onEnter(function(entity, zone)
    print(entity.Name .. ' entered ' .. zone:getId())
end)
observer:onExit(function(entity, zone)
    print(entity.Name .. ' exited ' .. zone:getId())
end)

-- Transition event (Fires when swapping between overlapping zones within the same observer)
observer:onTransition(function(entity, newZone)
    print(entity.Name .. ' seamlessly moved to a new zone without leaving the area!')
end)

-- Group-level events
observer:onGroupEnter(function(group, zone)
    print('The first member of group ' .. group:getId() .. ' entered!')
end)
observer:onGroupExit(function(group, zone)
    print('The last member of group ' .. group:getId() .. ' left!')
end)

-- Convenient player events
observer:onPlayerEnter(function(player, zone) ... end)
observer:onPlayerExit(function(player, zone) ... end)
observer:onPlayerTransition(function(player, newZone) ... end)
observer:onLocalPlayerEnter(function(zone) ... end)
observer:onLocalPlayerExit(function(zone) ... end)
observer:onLocalPlayerTransition(function(newZone) ... end)

Handling Overlapping Zones (Transitions vs. Priorities)

When zones physically overlap in the world, QuickZone offers two distinct architectural patterns to handle them, depending on your goal.

Observers use a priority system to handle overlapping zones. An entity ‘belongs’ to only one zone state per observer at a time when using priorities.

Pattern 1: The Data-Driven Pattern (Single Observer + Transitions)

Best for: Systems that share the exact same logic, but use different values (e.g., all Environmental Hazards, all Healing Zones, all XP Zones).

If a player walks from a Lava zone into an overlapping SuperLava zone attached to the same observer, they never actually “left” the observer’s overall coverage area. Therefore, onExited and onEntered will not fire. Instead, the engine fires an onTransitioned event.

This allows you to update metadata instantly!

hazardObserver:observePlayer(function(player, initialZone)
    local currentDamage = initialZone:getMetadata().Damage or 10
    local active = true

    local disconnectTransition = hazardObserver:onPlayerTransitioned(function(transitioningPlayer, newZone, oldZone)
        if transitioningPlayer ~= player then return end
        
        currentDamage = newZone:getMetadata().Damage or 10
        print(player.Name .. " transitioned. New damage: " .. currentDamage)
    end)

    task.spawn(function()
        while active do
            player.Character.Humanoid:TakeDamage(currentDamage)
            task.wait(1)
        end
    end)

    return function()
        active = false
        disconnectTransition() -- Clean up the listener
    end
end)

Pattern 2: The State-Machine Pattern (Multiple Observers + Priorities)

Best for: Systems with mutually exclusive logic that need to strictly override each other (e.g., Camera Filters, Music Tracks, UI States).

If you have overlapping zones that do fundamentally different things, you should attach them to different observers and assign them a Priority. QuickZone’s engine will automatically force the entity out of the lower-priority observer and into the higher-priority one.

local lowPriority = Observer.new({ priority = 0 })
local highPriority = Observer.new({ priority = 10 })

-- If a player is inside Zone A (Low) and Zone B (High) simultaneously:
-- 1. highPriority:onEntered() fires for Zone B.
-- 2. lowPriority:onExited() fires for Zone A.

Observer State

Observers can be toggled to pause logic without destroying the configuration.

observer:setEnabled(false) -- Fires 'onExited' for everyone inside
task.wait(5)
observer:setEnabled(true) -- Fires 'onEntered' if they are still there

Benchmarks

QuickZone significantly outperforms the most popular zone libraries. We benchmarked it in two distinct scenarios: High Zone Count and High Entity Count.

Expand

Scenario 1: High Zone Count

Scenario: 500 moving entities, 10,000 zones, recorded over 30 seconds.

This test highlights the fundamental flaw in traditional Zone-Centric libraries. As map complexity grows, their performance degrades massively.

Metric QuickZone ZonePlus SimpleZone QuickBounds Empty Script
FPS 59.33 3.84 5.53 58.95 59.28
Events/s 648 627 519 328 0
Memory Usage (MB) 18.57 4230 99.79 17.62 0.65

The Result: QuickZone maintained a perfect 60 FPS.

  • ZonePlus and SimpleZone imploded, dropping to 3-5 FPS, making the game unplayable.

  • ZonePlus consumed over 4 GB of memory, which would crash most mobile devices instantly.

  • QuickZone vs. QuickBounds: Both libraries scaled well by maintaining ~60 FPS. However, QuickZone still maintained a slight FPS lead and, more importantly, delivered double the event throughput (643 vs 328) compared to QuickBounds.

Scenario 2: High Entity Count

Scenario: 2,000 moving entities, 100 zones, recorded over 30 seconds.

Metric QuickZone ZonePlus SimpleZone QuickBounds Empty Script
FPS 42.37 29.88 37.23 41.31 42.73
Events/s 2271 2482 2518 566 0
Memory Usage (MB) 2.13 159 1.77 2.60 1.04

The Result: QuickZone is the only library that maintained near-baseline FPS (-1% impact).

  • ZonePlus caused a 28% drop in framerate, and SimpleZone decreased by 13%.

  • QuickZone handled the load with 98% less memory than ZonePlus.

  • QuickZone vs. QuickBounds: QuickZone averages ~1 FPS higher than QuickBounds. More importantly, QuickZone processed 4x the volume of events (2,271 vs 566).

Note: For the QuickZone benchmark, we used a frame budget of 1ms, the entities’ update rate was set to 60Hz, and precision was 0.0.


Limitations

Expand
  • Point-Intersection: QuickZone tracks the precise coordinate of an entity. It does not account for the full volume of the entity itself.
    Note: Ensure that zones encapsulate the center of the entity like a player’s HumanoidRootPart. Otherwise, the onEntered and onExited events will not fire.

  • Budgeted Latency: To prevent frame drops, QuickZone ‘smears’ workload across multiple frames. In high-load scenarios (e.g., thousands of active entities), there may be a slight delay (like 1-2 frames) between an entity physically entering a zone and the event firing.


Installation

Expand

Wally

Add the following to your wally.toml file:


ldgerrits/quickzone@1.4.7

NPM

For roblox-ts projects, install the package as follows:


npm i @rbxts/quickzone

Manual

Get QuickZone from the Creator Store. Alternatively, download the latest .rbxm model file from the Releases tab and drag it into ReplicatedStorage.


If you want to read more about QuickZone’s technical details, read ‘why use quickzone’ in the docs.

Showcase Marketplace Documentation GitHub Discord

177 Likes

Is there any demand for box intersections instead of point intersections to trigger events? If so, I may implement that in the future.

3 Likes

This library was made for the game @Clinkety and I are currently working on. Contributions are super welcome!

2 Likes

Looks very cool, a very good alternative to ZonePlus and SimpleZone

2 Likes

This is really nice, It’s definitely an improvement on the SimpleZone thing i had going on which was pretty much structured badly and didnt use the correct data structures. I’m considering reworking SimpleZone in the future before the devforum age checks get implemented cause it’s one of my most popular resources and i do think it deserves a reboot :V

Also, if you do end up using volume intersections instead of points, i must warn you that i spent a reaaally long time trying to make good volume intersection checking functions for all ShapeTypes, the hardest ones to make being Cylinder and Wedge (Cylinder was courtesy of Proffessor because the only thing i could find relating to it was a long research paper written in pseudocode, he helped me out because hes insanely good at math unlike me lol), though i never ended up implementing it into LessSimpleZone because i decided to archive SimpleZone before then.

if you do manage to make these volume intersection functions correctly i’d actually be pretty impressed :V Good luck

4 Likes

QuickZone v0.3.0 - Lifecycle Management Made Easy

Additions

  • Observer:observe()
  • Observer:observePlayer()
  • Observer:observeLocalPlayer()

Details

QuickZone now supports the observe pattern for 100% reliable cleanup. Instead of juggling onEntered and onExited events, you can now define your logic and cleanup in one place.

For logic that should persist while an entity is inside a zone (e.g., UI, music, status effects), use the observe methods. These accept a callback that returns a cleanup function, which runs automatically when the entity exits.

-- Generic observation
observer:observe(function(entity, zone, metadata)
    print("Entered", entity)
    local highlight = Instance.new("Highlight", entity)
    
    return function()
        print("Exited", entity)
        highlight:Destroy()
    end
end)

-- Player specific
observer:observePlayer(function(player, zone)
    local forceField = Instance.new("ForceField", player.Character)
    
    return function()
        forceField:Destroy()
    end
end)

-- Local Player specific
observer:observeLocalPlayer(function(zone)
    local sound = workspace.Sounds.SafeZoneAmbience
    sound:Play()

    return function()
        sound:Stop()
    end
end)
2 Likes

Thank you very much!

I’ve already got most of the code related to volume intersection thanks to @unityjaeger (the creator of QuickBounds) and got it to work before I drastically overhauled QuickZone. It supported the box, cylinder and ball shapes. However, the wedge wasn’t implemented, and that one seems very difficult to do. I could simply make wedges use the box shape, but that would make QuickZone’s behavior a little inconsistent.

Also, due to my optimizations, I introduced an edge-case for box intersections: if an entity rotates while remaining in the same position, it will not perform a recalculation. To fix that, I would need a rotational check in addition to a positional check which seems a little wasteful.

Also, I question how much utility volume intersections would really have. It would complicate the library, and you can probably just get away with having multiple points (tracking the Attachments) instead which would be more performant in most cases.

3 Likes

QuickZone v0.3.11 - Optimization and Bug Fixes

Fixes

Fixed issue where metadata of entity was not passed down, resulting in ObservePlayer() and ObserveLocalPlayer() not working.

Thank you, @RoyzerM, for the Issue!

Improvements

Reduced memory by 20% and increased processing speed around 10% in initial testing.

4 Likes

QuickZone v0.4.0 - The Declarative Update

This is a major architectural rework designed to future-proof the API. With this update, QuickZone moves towards a more stable, professional and declarative design pattern that significantly reduces boilerplate code.

Key Highlights

1. Declarative API (New)

You can now define your entire spatial topology (Groups, Observers, and Zones) purely through configuration tables. This removes the need for calling :attach() or :subscribe() manually on initialization, but you can still do that if you want.

Old Way (Imperative)

local localPlayerGroup = QuickZone.LocalPlayerGroup()
local enemyGroup = QuickZone.Group()
local observer = QuickZone.Observer()
local zone = QuickZone.ZoneFromPart(part)

observer:subscribe(localPlayerGroup):subscribe(enemyGroup)
zone:attach(observer)

New Way (Declarative)

local localPlayerGroup = QuickZone.Group.localPlayer()
local enemyGroup = QuickZone.Group.new()

local observer  = QuickZone.Observer.new({
    groups = { localPlayerGroup, enemyGroup } -- immediately subscribes to localPlayerGroup and enemyGroup
})

QuickZone.Zone.fromPart(part, {
    observers = { observer } -- Immediately attaches to observer
})

2. Class-Based API (New)

As you can see in the previous example, we have moved away from global factory functions (ZoneFromPart, PlayerGroup) to static constructors located within their respective classes.

  • ZoneFromPart(...) → Zone.fromPart(...)
  • ZoneFromParts(...) → Zone.fromParts(...)
  • PlayerGroup(...) → Group.players(...)
  • LocalPlayerGroup(...) → Group.localPlayer(...)

3. Batch Creation (Zone.fromParts) (New)

A brand new constructor designed for map loading.

  • Zone.fromParts(parts): Creates multiple zones from a list of parts in a single call. This is significantly cleaner than looping through a list of parts to create individual zones.

4. Bulk Entity Operations (New)

New methods for Groups, useful for heavy gameplay elements like projectiles.

  • Group:addBulk(entities): Adds a list of entities to a group in one call
  • Group:removeBulk(entities): Removes a list of entities.
  • Group:clear(): Removes all entities from a group.

Breaking Changes & Migration

This update deprecates imperative factory patterns in favor of the new Class-Based API and Config tables.

1. Constructors

  • Global Functions Removed: ZoneFromPart, ZoneFromParts, PlayerGroup, and LocalPlayerGroup have been removed. Use their Class.method equivalents.

2. Configuration

  • Observer.new: Now accepts a single config table instead of individual arguments.
  • Group.new: Does not have the ‘safety’ property anymore in the config. This has been moved to Observer.new.

3. Zone:update() → Zone:syncToPart()

The generic :update() method has been removed to reduce ambiguity.

  • Old: zone:update() (synced to part) or zone:update(cframe, size) (manual update).
  • New:
    • Use zone:syncToPart() if you want the zone to read properties from its attached BasePart.
    • Use zone:setCFrame() or zone:setSize() if you want to manually modify the zone.
3 Likes

If you’re not on v0.4.0 already, you should really upgrade
You only need to change some minor things to make your code work again, and it will future-proof your code as QuickZone’s API will be quite stable from now on.

2 Likes

QuickZone v0.4.1 - The Group Presence Update

This update introduces high-level logical aggregation, allowing Observers to treat entire Groups as single units. It also resolves a critical synchronization bug in LocalPlayer observations.

Additions

1. Observer:observeGroup()

You can now observe a Group’s presence as a singular state. This could useful for capturing objectives, queue areas, etc.

observer:subscribe(myGroup):observeGroup(function(group, zone)
    local roomLights = workspace.LargeBuilding.InteriorLights:GetChildren()
    for _, light in roomLights do
        if light:IsA("Light") then light.Enabled = true end
    end

    -- Cleanup runs when the group left the area
    return function()
        for _, light in roomLights do
            if light:IsA("Light") then light.Enabled = false end
        end
    end
end)

2. Observer:onGroupEntered() and Observer:onGroupExited()

If you don’t need persistent lifecycle management and just want one-off triggers, use the standalone event listeners for groups.

observer:onGroupEntered(function(group, zone)
    print("Sector " .. zone:getId() .. " has been entered by Group " .. group:getId())
end)

Fixes

1. Observer:observeLocalPlayer()

Due to a typo, the cleanup function would incorrectly fire if any player exited the zone, rather than strictly waiting for the LocalPlayer to exit.

3 Likes

Wow! Inredible! This looks cool and nice! How longf did it take to make? I rate it a 9.9999/10!

I may use this in the incoming future! Wow!!!.!!!

1 Like

Haha, I’ll take that 9.9999! I hope I’ll ever get that missing 0.0001, though. Maybe in a future update?

All in all, it took about 2 weeks. The first week was spent on designing the library and writing the code. In the second week, 1 day was spent on improving the API, 2 days were spent on the lifecycle and declarative updates, and I worked for 2 days on the documentation (it takes longer than you think). There were definitely some long nights in the past 2 weeks.

Thanks for the comment!

3 Likes

you create a astounding product. Maybe you get real big game which will be use this incredible library

Thank you! I certainly hope my game will be succesful.

By the way, I have one more big update planned for QuickZone which would improve Group significantly, making it even easier to work with. It could very well be the best one yet. But after that, I don’t really have any other major updates planned. There’s just not much to improve anymore.

Or, perhaps, the community will come up with good suggestions.

1 Like

it seems like " QuickZone:visualize(true) " is bugged

Noted! Will be fixed in the upcoming release!

Edit: It seems to work correctly on my end. Can you provide more information? Are you on v0.4.1?

yes version 0.4.1 and this is the script , I’m sure I made a stupid mistake…

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local QuickZone = require(ReplicatedStorage.Core.Shared.QuickZone)

QuickZone:visualize(true)

local Group = QuickZone.Group
local Observer = QuickZone.Observer
local Zone = QuickZone.Zone

local players = Group.players()

local observer = Observer.new()
observer:subscribe(players)

observer:onPlayerEntered(function(player, zone)
	print("entered")
end)

observer:onPlayerExited(function(player, zone)
	print("exited")
end)

local zone = Zone.new({
	cframe = CFrame.new(0, 10, 0),
	size = Vector3.new(10, 10, 10),
	shape = "Block",
	isDynamic = false,
	metadata = { Name = "Lobby" }
})

zone:attach(observer)

Your script is fine! But I do know where the issue is now.

Visualizations work well while running it in a local script. However, if you run :visualize() on the server and simulate the experience through ‘Test’ or ‘Test Here’, the visualization won’t show up anymore. Weirdly enough, if you do ‘Server & Clients’, it works again. So, there seems to be an inconsistency in how Roblox handles BoxHandleAdornments.

I’ll probably switch to a BasePart for visualization purposes. You’ll see it in the next update.

Nice one! interest for contributions