saltysystems / overworld

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

Session PIDs as a primary identifier #51

Closed cmdrk closed 2 weeks ago

cmdrk commented 3 weeks ago

Change Overworld sessions to use process PIDs as the primary identifier, such that invocations like:

{ok, PID, SessionID} = ow_session_sup:new([]),
my_zone:join(Msg, SessionID)

are now more like this:

{ok, PID} = ow_session:sup:new([]),
my_zone:join(Msg, PID)

This, I think, is a bit more natural to the OTP environment, since all of the code works with PIDs instead of our arbitrary session IDs. We should save a few calls to gproc and back this way, though performance-wise I'd estimate this is in the noise.

The session ID is still generated and can be looked up via ow_session:id/1, since it is useful when dealing with the wire format.

I also chipped away at reconnecting sessions a bit more. It's more complete but not function, I'd guess.