saltysystems / overworld

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

Document and refactor protocol #57

Open cmdrk opened 2 weeks ago

cmdrk commented 2 weeks ago

There's somewhat of an asymmetry with encoders and decoders. Decoding is hard because we route messages based on a prefix, but we only assume 1 'app prefix' per Overworld application. need to reconcile that somehow.

Encoding is easier because we can easily check if an encoding function exists..

  2> ow_protocol:apps().
  [{100,
    #{modules => auto,prefix => 100,app => overworld,
      router => ow_msg,encoder => overworld_pb}},
   {101,
    #{modules => auto,app => chat, router => ow_msg,
      encoder => chat_pb}}]

This whole thing needs to be thoroughly documented because I suspect there's some goofiness in here.