Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Third Party Photon Room Always Running & Communicating With Website?

Discussion in 'Multiplayer' started by daawsomest, Sep 11, 2014.

  1. daawsomest

    daawsomest

    Joined:
    Dec 4, 2013
    Posts:
    8
    Hello,

    My team and I are developing a multiplayer game with Photon and I have a few questions.

    1) Is there a way to create a room that stays online. Usually after the last player has left room, the room will be removed. I would like to have some permanent rooms that are always running.

    2) Is there a way that I can integrate a website into the game. I would like to have a control panel on a website which users can manage there rooms. They could create a free room with a limit of 10 players, but they can purchase larger rooms. Essentially I would need to send messages/commands from a website and have the photon server handle the request.

    I am not very skilled with networking so I am not to sure how I could do this. Is it possible I could send the message with something like PHP? Also how would I receive and handle the request? I am planning on using the Photon cloud hosting because its ease of use and reliability. I am guessing I would have to have a server running a modified client of my game that would just handle these requests (create room, delete room, kick player, ect)

    I found PhotonNetwork.WebRPC in the API Docs but I don't quite understand it.

    There was another questions but I completely forgot what is was.

    Thanks for any help :)
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,018
    Photon won't keep Rooms alive when all players leave.
    Photon Turnbased (another type of subscription on the same servers) can persist your games, so you can return later and any player can play it asynchronously from the others in the room. It is a lot like a room that never closes.
    This is another SDK download. PUN is not able to return to games that got saved (so far).
    https://www.exitgames.com/en/turnbased/download

    More on Turnbased:
    http://doc.exitgames.com/en/turnbased

    With the WebRPCs, you can call your own web-service (php or otherwise) from the clients and get a response from that server. This enables you to unlock features per player-account. You could fetch a value from a user's account to enable or disable creating bigger rooms with that.
    This should also be explained a bit more in the Turnbased doc pages and the SDK.
     
  3. daawsomest

    daawsomest

    Joined:
    Dec 4, 2013
    Posts:
    8
    Thanks for the info. Do you happen know know of any examples which use WebRPCs?

    Now I think about it I don't need the room to be always running. I could just create my own list of room names and settings and display that. If the room doesn't exist then just create it when a player tries to join.
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,018
    In PUN, there is no sample to use WebRPC but the Turnbased SDK shows it.
    The main reason against showing this in PUN is that you need to configure the server before you can reach any web service. So unless you do extra work, things would fail.
    We wrote a few things about our Turnbased "Memory" Demo. This includes the setup and the WebRPC usage to some degree:
    http://doc.exitgames.com/en/turnbased/current/tutorials/memory-demo