saltysystems / overworld

Open source framework for scalable multiplayer games.
Mozilla Public License 2.0
20 stars 3 forks source link

Player registry #8

Closed cmdrk closed 2 years ago

cmdrk commented 2 years ago

I got tired of schlepping around a Players variable that had no meaningful way to be updated by implementers of the ow_zone behavior. Instead I simplify the behaviour by moving the player information to an ETS table that can be accessed from both the zone gen_server and the callback module.

This PR removes players from the local state of the ow_zone server and adds a new ow_player_reg module that provides an API for the #player{} record and provides kv-store-like operations for the registry. The registry has a simple get/1, put/2, list/1, delete/1, and update/1 API.

I expect ETS performance to be good enough ™️ for now with default options. To be profiled later if it causes problems.