LoadBalancing.ServerToServer.Events.ServerParameterCode

Options
escjosh
edited January 2012 in Photon Server
Why are the values in this enum non-contiguous? And why don't they start at zero? I want to add more values to it, but I don't understand why the values are the way they are.

Comments

  • Also, why does the ErrorCode enum have the values that it does? Why not just use it as a normal enum rather than specifying seemingly arbitrary values? Or do the values have some kind of meaning elsewhere that I'm not aware of?
  • Tobias
    Options
    For Photon 3, we tried to re-number the codes we are using in Lite, LiteLobby and Loadbalancing. I'm not entirely sure if that's done for the server to server communication, too.
    The idea was to use the "highest numbers" of the respective type. This gives you as developer the most room to start event codes with 0 and go up.
    If we started with 0 and used 10 codes, then you first would be 11. If we ever wanted to add a new feature, we would use 11 and clash with your codes.
    Lite's event codes are byte, so we started with 255 and went down, e.g.. Maybe there are gaps but most likely these are used in Lite, LiteLobby or Loadbalancing.
  • Ok, that makes sense. Since I'm not using Lite and I'm rearranging Loadbalancing quite a bit, I'll probably reorganize things. Thanks!
  • dreamora
    Options
    I would consider to expand LoadBalancing and leave the original project intact so you can easily upgrade it in the future. It otherwise can get a major pain as the Photon codebase in the past had a quite good chance to change in non-mergable forms which forced you to port to the new version or not go there at all
  • I appreciate the advice, and normally I would agree. But the changes I need to make are going to make it impossible to merge in any case. For example: I can't use Lite, I need the GameServer portions to be in a shared library, and I don't want clients to stay connected to the master. We have a lot of custom server-side code. I'm going to end up with something very different from the original LoadBalancing code, so I should be able to simply diff the releases that ExitGames makes and see if any changes need to be carried over. Those kinds of changes should be minimal, but, yes, I'm expecting some merge headaches.
  • dreamora
    Options
    I see :)
    Then you are right, extending it wouldn't make sense anymore.