#How to have room when using SpatialHash Interest.

1 messages · Page 1 of 1 (latest)

obtuse osprey
#

Hello everyone. My game currently using SpatialHashing for Interest System. And today, my game has to implement some arena, each of it has their logic, fields such as who in it, score, playtime, time,.... (it looks like a room). Those logic and fields will be in a Network object (ArenaController : NetworkBehavior).
It still work good with SpatialHashing but still have some problem:

  • The arena can sync their informations with everyone "around" the arena (instead only to those who inside the arena).
  • My Arena can be very large in world position. So if aplayer run far away the arena instance, the arena instance will be despawned and will cause some bugs. I can change arena's visible to ForceShow but it will worsen the first problem (syncing data to arena's outsider).
  • I found a solution in ChatGPT but i'm not sure this is a correct way or not. ( script included ). Thank you in advanced.
fading patrol
obtuse osprey
#

My game is a headless server + client setup, 2D and top-down.
On the server, the entire world exists in a single scene.
The game world is divided into multiple regions, so I’m separating it into different lands.
Each land is a square area about 500–700 units wide, and these lands can be around 300 tiles apart from each other.

fading patrol
#

Definitely too small for spatial hash...switch to the one I linked above