SimpleZone | A simple, fast and new Zone module!

Yeah seeing about a 300% performance boost with connect parallel mad

I am unable to find this function anywhere in this file

Could you perhaps update the download?

Oh yes, I thought it would automatically update since I have a PackageLink, holdon updating it right now!

Download updated! Feel free to test it out

1 Like

Do you know of a way for modules to remotely get updated, since PackageLinks donā€™t seem to work? I really do not like having to update the download everytime :face_exhaling:

Package links work fine, Its just that they often fail to fetch latest version.

I see I see. Well alright then

Ok guys, so I just did a test with 4800 individual Zones, to compare the performance on :BindToHeartbeatParallel() vs :BindToHeartbeat(), and I think the result is pretty surprising!

I honestly think this is because :BindToHeartbeatParallel() needs its own GetPlayerFromCharacter function as Players:GetPlayerFromCharacter() is unsafe to call from parallel, whereas the normal :BindToHeartbeat() function can just use that.

Iā€™ll try out some things to see if I can maybe change this, for now just keep using :BindToHeartbeat() :sweat_smile:

Yeah I donā€™t think this is fixable, the normal :BindToHeartbeat() works just fine, I am gonna remove the :BindToHeartbeatParallel() method, sorry guys!!

1 Like

To have a workaround, you can just loop through players and check if its a descendant of the character.
image

I got 3x improvement by distributing just the GetPartBoundsInBox between different actors, I think the downgraded performance comes from you searching for a players character for every part inside the zone per frame. You should use PlayerAdded/CharacterAdded and a table to make a lookup eg

local Characters = {
	[PlayerName] = Character
}
local Character = Characters[PlayerName]

Just donā€™t forget to update it on character added and remove any entires using PlayerRemoving. Roblox has a example of distrusting tasks between actors here near the end.

I see, I will keep this in mind, thank you.

Have you done any performance comparisons to ZonePlus? I know ZonePlus has big issues with it but considering you use the same method thought Iā€™d see if itā€™s worth switching over or not / if itā€™s just going to produce the same results.

After I finish implementing the parallel query stuff Iā€™ll do a benchmark and let you know :slightly_smiling_face:

does this accept folders like zoneplus, and can you bring over the ability to get a random position, or better yet a cframe, from a zone?

trying to make a region based spawner, and zoneplus just hasnt been working, throwing errors for things the api claims exists

Since the .Query callback is customizable, you can just do SimpleZone.fromCustom(ā€¦) and provide a query function that queries all parts inside of a certain folder.

And yeah Iā€™m gonna add the second one, just finishing up parallel benchmarks right now :heart:

1 Like

would you be willing to open this on github, would love to be able to contribute to source aswell

2 Likes

Now this is a very good alternative to ZonePlus! And the source code is easier to read too, good job and thank you for this module!

1 Like

Alright guys, here are the results with the new parallel stuff I added!

(Tests are done on PS4 with 313 individual Zones)
(The first one is with the new .fromPartParallel(), the second one is using the normal .fromPart())

As you can see, there is significantly more lag with the second one.

This time, each Zone has its own Actor, which was different the way I implemented it earlier.

I will be adding SimpleZone.fromPartParallel() to the documentation, next up are ZonePlus vs SimpleZone benchmarks :slightly_smiling_face:

3 Likes

Let me know if you havenā€™t recieved the changes in the download yet, could just be the PackageLink acting up again :confused: