Improbable Icon

SpatialOS Discourse Forums

Handling entities leaving world boundaries

What is the recommended way for handling entities that leave world boundaries?
I am using the rectangle_grid load balancing strategy (2x2 grid), and when a simulated entity leaves the world boundaries the entity is removed from the server worker, but not from the world, and it still appears on the client and inspector but is no longer simulated by any server worker.

In this case, I’d like to simply destroy the entity, but not quite sure the best way to handle this.

Hi @Matthew-Casey, sorry for the delay on this one. What it sounds like is happening is that the authority is being removed from your managed workers when they leave these bounds.

What you could do if you wanted them to be removed entirely, is on your managed worker to detect when you’re about to send a position update that it out of bounds, and instead send a delete entity request.

1 Like

Thanks for the reply @leuan. I ended up with a pretty similar solution to what you’ve suggested here, so happy we’re on the same page.

Though not a big concern, but I did end up having to hard-code the world bounds as I couldn’t see a way to access the load balancer configuration from the c-api. Just FYI.

Anyway this is resolved now, thanks

1 Like