demo-lobby question

Options
pianka
edited May 2011 in DotNet
Hello,

In the demo code, the Game and LobbyHandler classes both implement IPhotonPeerListener. They also both instantiate and connect a LitePeer. Is it common practice to have multiple connections to a Photon server, or am I misunderstanding the mechanism behind how these classes interact? It seems to me that maintaining multiple peers would be redundant and a waste of resources.

Thanks in advance and please forgive my naiveté; this is my first time using Photon.

Rick

Comments

  • Tobias
    Options
    Hi,
    Sorry you had to wait a while for your answer.
    Your question is not naive. We didn't explain this anywhere!

    Usually, you can do everything that's related to one client/user with just one peer. However, in most of our demos, we wrap the peer up so it can be used multiple times, simulating multiple peers.
    In this case, it's not even simulating another player. The second connection is there to keep an eye on the room-listing while you can use the other connection to join a game or another. By default, Lite and LiteLobby logic will remove you from a room when you join another. This is fine as logic and keeps things simple, but it lacks to showcase updates by the lobby.

    I hope you got along with Photon despite this?
  • Is it common practice--or does it present some advantage--to use multiple peers for a single client/user? I just want to make sure that given a similar situation it wouldn't be a bad choice to handle both the game and the lobby list on the same connection.

    Otherwise, yes, I'm very pleased with Photon so far. We're using it as the networking (obviously) component of a boss-battle prototype alongside Unity for my senior project. Long story short, we're using genetic algorithms to produce unique behavior trees to be the outputs of a neural network. When computed, the trees make decisions and blend animation primitives (that we get using motion capture) to allow the boss to perform new complex actions. It analyzes the effect of the behavior and determines the fitness for the genetics or backpropagates the neural net. All of this runs as a single instance (i.e. not per game) on the server side.

    Sorry for the huge paragraph; I just figured I'd give you a quick background on what we're doing with your product. Anyways, I'm sure you'll be hearing from me again at some point over the next 8 months or so :D. Thanks for your time.
  • Boris
    Options
    pianka wrote:
    Is it common practice--or does it present some advantage--to use multiple peers for a single client/user? I just want to make sure that given a similar situation it wouldn't be a bad choice to handle both the game and the lobby list on the same connection.
    depending on how many users you get it's much easier to distribute the game load to other servers if you use a second connection from the beginning on.
    If you do not think that you will ever need this you could use just one connection - the server code might need some changes though as it allows just one room per peer right now (lite lobby and lite game are both "rooms").
  • We only plan to run one server, so I think I'm safe with just a single connection. I'm using the demos as a guide and building the server and a client library from the ground up. Thanks again!
  • Boris
    Options
    if you build your own server from the ground-up check-out the blank server setup guide (in the doc folder).
    The demos are still good to get a few ideas on how to deal with the server side threading.
  • I did, actually. It was helpful and I've currently got a server going that accepts connections from a dummy application that implements our client lib. I'll be working on operations and events now. If I have more questions on that topic, should I just continue in this thread or would you prefer I make a new one that's on subject?
  • Boris
    Options
    i think it would be a better reference for other users that might have similar questions if you started a new thread for each question.
    Thanks for asking!
  • Baronium
    Options
    I'm running in the same idea as pianka, I think my question is also related to this thread.
    Boris wrote:
    The second connection is there to keep an eye on the room-listing while you can use the other connection to join a game

    I will need the second connection, because you mentioned the "distribute the game load to other servers"-part,
    but will every further connection ( peers ) count as a concurrent connection?
    So with my 100 CCU license, I can only have 50 Clients, each one with 2 peers?

    I did try to find the answer myself, but got confused with the dashboard counters.
    In the dashboard gui, 2 Clients are creating 4 UDP peers, so does this means I have 4 CCUs...?

    Thanks,
    Greetings
  • Boris
    Options
    exactly. You can only have 50 game clients with a 100 CCU license if each game client uses 2 connections.