Is there a possible way to challenge a friend and popup to his screen?

Is there a possible way to challenge a friend knowing his userid, then when you click challenge button, in your friends app it will popup a screen that will will let him join your room.?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @tataygames,

    There are three sides to your question:

    1. how to send a challenge to a friend via his UserID
    2. how to implement challenge system (load list of challenges, process received challenge, save list of challenges, update status of challenge, push notification, etc.)
    3. how to implement the UI for the challenge logic: button + overlay/modal/popup

    We can answer 1:

    You need a service that allows sending messages directly to users without the need for being in the same room. Photon Chat can do that. Or you could use another third party systems or combine two or more with each other or with Photon Chat. You could also build your own backend.

    However even with Photon Chat, you need to consider:

    • Photon Chat does not store friends lists and friends UserIDs
    • Photon Chat does not store lists of challenges or status of challenges
    • users connected to Photon Chat needs to be in the same region (servers) and same virtual application (AppId, AppVersion) to be able to communicate
  • tataygames
    edited December 2019

    thank you for your reply,

    I looking now on photon chat thing I hope I can figure it out.

    Im thinking Im going to send the roomname when I created a room, and send to my friend trough chat so when my friend press the accepted button he can join the room which I send to him.

    is that a good idea?

  • JohnTube
    JohnTube ✭✭✭✭✭

    is that a good idea?

    Yes.

  • Hi,

    I see this code:

       this.chatClient.SendPrivateMessage(privateChatTarget, inputLine);

    to send message right?

    but where is the code or event callback when your going to recieve it?

    because thats were Im going to put the challenge popup screen.

  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @tataygames,

    Take a look here and here.

  • hey thank you very much!

  • Hi again, Im almost done in completing my 1st multplayer game

    1 thing which is not working or having a callback is this code

    public override void OnPlayerEnteredRoom(Player other)
    {
    Debug.Log("OnPlayerEnteredRoom() " + other.NickName); // not seen if you're the player connecting

    if (PhotonNetwork.IsMasterClient)
    {
    Debug.LogFormat("OnPlayerEnteredRoom IsMasterClient {0}", PhotonNetwork.IsMasterClient); //
    called before OnPlayerLeftRoom
    }


    }

    Its not calling when I entered the room, any suggestions?


  • JohnTube
    JohnTube ✭✭✭✭✭
    when the local player enters rooms, another callback is called, from another interface:
    IMatchmakingCallbacks.OnJoinedRoom
    
    . So override
    OnJoinedRoom
    
    instead.
  • Hi, yes that one is triggering, So I dont need to use the OnPlayerEnteredRoom?
  • how can I detect if player enter leave or quit the room if its not working :neutral:
  • Btw its working now! :)
    I attached the photonView script, and make a variable and use getcomponent like on the sample.

    private PhotonView photonView;
    photonView = GetComponent<PhotonView>();

    and Only you enemy can trigger call back not myself