SimpleZone | A simple, fast and new Zone module!

Hey wsp idk if u remember me But I was having issues with performance when trying to detect players entering and leaving a zone and then doing stuff. I was on a break and I’m back after a while there are a lot of new messages I’m this thread, if u don’t mind could u sum up the changes in the latest version and where can I get it? Would it be possible to access the individual part a player has entered? i want to pass on that part into my own functions and do stuff with it
image

1 Like

Yeah, the latest version is on the main post, I replaced the download link with it. Also yes, if you have queryOptions.AcceptMetadata enabled, you can do this:

Zone:ListenTo("Player", "Entered", function(player: Player, metadata)
     print(`{player.Name} entered {metadata.part}!`)
end)

Also I’ve improved performance a ton for big zones by introducing the concept of QuerySpaces, you just have to set queryOptions.InSeperateQuerySpace to true and add items (such as player character parts) to the query space via Zone:CopyToQuerySpace() (Note that the table doesn’t necessarily have to be a table of baseparts, just a table of instances)

Can u explain the concept of query spaces? And how would u define a big zone?

A query space is just a dedicated area for zones to query, instead of the entire world. This can considerably speed up queries because the world model is only doing checks for the things it needs to

A query space is split up into static and dynamic BaseParts so that the module only has to check on dynamic instances for query (This means query spaces are fastest with static unmoving zones, because the structure does use BVHs. Might switch to spatial hashmaps in the future)

Also I’d define a big zone as anything with a combined volume of more than 10k studs cubed, so for example 200 cubes of size 90x90x90 would be considered a “big zone”

Oh alright well i got a combination of big and you could say medium zones that I’m passing into the
.fromparts() constructor Ill try using query spaces.

Also

I have different kinds of zones in different folders that perform specific functions like “work-zones” and “duty-zones” I’m thinking of merging it all into 1 query options and constructor since all they do is detect player entry and leave and do stuff, I think ill use the metadata to access the part and check for their ancestor folder and then perform functions. This should further use less resources lol.

Also I noticed before the script was running on 4-5% but after grabbing your latest model its close to 0% and I have not changed a single thing in my script or game infact I halved the update intervals, huge thanks for the great performance tweaks!

1 Like

Package Version 79:

  • Added a new, not-taken-down marketplace link for the main post
  • Optimized SimpleSignal a bit further by inlining disconnection
1 Like

Package Version 85:

  • :BindToHeartbeat() now can accept a generator function in place for OverlapParams
    image
    It also now returns a QueryInfo which contains the OverlapParams/OverlapParams generator function, aswell as a reference to the Zone’s QueryOptions

    Also, if you don’t pass anything, it’ll only include all player characters by default
1 Like

When will the repo be available please?
Package updates are taking a long time and sometimes even crash studio.
I’m on a high end PC so this is a roblox issue.

1 Like

Hi, most likely sometime within this week if I can learn how to make it work, honestly I’ve been struggling alot with github lately tho i think that’s just me being unfamiliar with the interface :V, I’ll let you know when it’s done

Alright thanks!
It’s so easy to use; commit code and push to repo :ok_hand:t2:

1 Like

Actually, one thing I’ve been struggling to do is on how to convert a .rbxm into a file tree, so I can upload it to a github repo; I do all development in Studio and so far I haven’t really found a good way to do this :confused:

I recommend this rbxl to rojo filesystem

1 Like

Unfortunately this only works for place files, I need a way to turn rbxm/rbxmx → file tree :frowning:

I’ll keep looking for a way

Just save as a place then extract the library folders?
It’s 1 extra step from rbxm/x, but works

It would be ideal to just extract the .rbxm because the place where I develop stuff in has quite alot of… stuff

Honestly I’ll probably just use rojo actually

Why not save 1 place just for this?

1 Like

Switching places takes quite a bit on my device (around 5 minutes or so) and I tend to work on other stuff while in Studio so preferrably I like to not switch places as much as possible :sweat_smile:

1 Like

Hi, I’ve made a github repo for the module! I manually copied over every file uhh xd

Let me know if I did anything wrong, this is my first time making a proper repo

1 Like

What do yall think about switching from BVHs to Spatial Hashmaps for doing queries? I’m considering it because it’d be alot better than the static & not really good at early culling system of BVHs

2 Likes

Hey @athar_adv thanks for fixing the infinite character added yield inside of PlayerLookup.lua!

1 Like