How "expensive" is Region3 or What Happens When I MegaSpam it?

I am making a lightweight little zone system for my game using Region3. I am going to have a handful of regions, nothing too crazy, the game is not based around this functionality but I want to have a safe zone and a few other safe spots. Ideally I want to have Region3 checks done in a loop that is always running on the server, and set a status for any player inside a region that I can check whenever needed, an event type system.

So the question is, how often can I spam this loop without causing an issue? One time per second seems a little slow, can I go faster without worrying about server resources being affected?

TANKS! :smiley:

1 Like

It’s better to approach the Region3 by looping from client and allowing the client to fire a remote which then checks if the client is actually witihin the Region3, saving resources on the server.

4 Likes

It’s not bad at all in my experience, but you’ll have to actually test it if you want to know for sure. Look up how to use the micro-profiler if you really want to know.

1 Like

If you’re not literally abusing it by doing checks every single second, the only performance intensive feature is the AABB region checking.

I tend to use Region3s to determine if a train is still in the spawning region to prevent models from spawning on-top of each other. The Region3 will only do it’s AABB part check when a new model is requested.

For your use-case, it would be better to handle the regions on the client, and then fire off an event to the server when the region the player in has changed

4 Likes