Experimenting with Loadbalancer SDK (Questions)

Options
ody
ody
edited April 2017 in Photon Server
So I finally started to experiment with the Loadbalancer API (SDK) and now I have a few questions which I couldn't find in the documentation.

1) So on default - you can join with multiple identical UserIDs - even when using custom authentication. Since you could login multiple times and join different rooms with them - I was really surprised, why is this like that?

Since my Master Server will be in authoritative control of everything - I have to ensure that each player will only be available once. Sure you could do this in custom authentication - but updating values based on connection status in a database would be very troublesome to keep consistent.

So what I did now is I am checking the PlayerCache in the DoCustomAuthenticationResult - here I know the user has validated itself but then I do:

((MasterApplication)ApplicationBase.Instance).DefaultApplication.PlayerOnlineCache.playerDict.ContainsKey(this.UserId)

to check if the user is already available and if yes - I change the ReturnCode to something like UserBlocked.... (i made the playerDict public)

Now I wonder if this is the best approach in case I don't want the same user logged in multiple times?

2) Since I will only use the rooms for the actual battles between players and AI 0- the main logic will all be handled authoritative in the master client. So actually once the user logged in I don't need to tell them about rooms - this is something I will handle on the server - so a player initiates a "battle" (e.g. clicking on the npc) and then Ill create a room and the player will be transferred to the game server fighting against it and then be returned to the lobby/master afterwards.

So now I wonder if this is something feasable to achieve with the loadbalancer setup - or am I working completely against the basic design of the loadbalancer approach and their rooms? BUt I thought that I could greatly misuse the rooms for the battles which are in slow realtime and handle the game events on the master.

3) Is there anyway I could transfer some properties after redirecting back from game server to master server - so that the master server knows e.g. the battle succeeded - or do I need to handle this over the database - so that both game and master have access to it and update values there etc.?

4) In order to get my rooms hidden - I tried to override the default IsVisible Property server side. However since the client is still able to override this and the logic is not in loadbalancer API, rather in Hive itself - the most easy way to prevent players from changing this property - I guess I can simply override it in the GameClientPeer OnOperationRequest method like this:

if( request.Parameters.ContainsKey(248) && ((System.Collections.Hashtable)request.Parameters[248]).ContainsKey((byte)254))
((System.Collections.Hashtable)request.Parameters[248])[(byte)254] = false;
Would this be the correct way?

Thanks in advance for your time,
Oliver

Comments

  • chvetsov
    Options
    Hi, Oliver

    1) yes, you may use this trick. but be aware about master restarts. i mean it may happen that this server also might be restarted and you should restore all info on it

    2) here is basic concepts for LoadBalancing: https://doc.photonengine.com/en-us/onpremise/current/applications/loadbalancing/application. LoadBalancing just basic tool. and as far as i may see it perfectly fits to what you need whitout rewriting. just use what you already have and extend a little to get what you do not have. here i mean next thing. it does not matter how client will select games to play. when choose is done workflow is always same - select game server and redirect client there. that is it. this is already in LoadBalancing.

    3) GameServer send events to Master with game updates. Look at GameServer.Game class. you may extend this part

    4). yes, your modification ok.

    best,
    ilya