Photon Server + Plugins + PUN

Hi there,

I'm currently using PUN for my game, which is limiting to my case since I want to be able to have dozens/hunderds of players in the same world (MMoish)..

Atm I limit the number of players per room to 10. Also cheating is relatively simple since the authority is at best a master client.

My question is, can I use Photon Server + Plugins + PUN to run an a server that hosts hundreds of players? Or do the plugins stuff with the callbacks on the server work on for room based stuff?

Thanks ahead,
Michael.

Comments

  • Hi, @StarKist

    well, yes, plugin stuff was developed to work with rooms, but that does not mean that you can not use it. The Room can be base for your Worlds. you may use the plugin to do interests management and all the logic.

    best,
    Ilya
  • hi @chvetsov,

    I see, so basically I can have just a few rooms or even just one and each room can support a lot of players in it, is that what you are saying?
  • @StarKist yes, that is what I'm saying, but do not forget about interest management otherwise your clients will be overwhelmed by the number of messages
    And one more note, there is no support for this in default implementation, you have to intercept messages and rebroadcast them your self

    best,
    ilya
  • StarKistStarKist
    edited September 3
    @chvetsov I see, nice, yes I'm aware of interest management...
    I saw something about intercepting RPCs from PUN using Photon Server by implementing custom decoding of RaiseEvent on the server side..

    Any idea how hard it would be to convert from PUN where the master client is the authority to having the master server intercept RPCs and Call RPCs on the clients instead?

    Instead of implementing a completely custom protocol from scratch?

    Thanks for the info,
    Michael.
  • StarKistStarKist
    edited September 16
    @chvetsov Bumping this with a new question:

    If I want to control bots on the server, is it a good idea to use a Timer:
    timer = PluginHost.CreateTimer(
    ScheduledEvent,
    1000,
    2000);

    To implement the bots behavior? for example let the Timer run 30 times a second or so?
    looping through the bots and have them broadcast updates to the recipients according to the interest management?

    Another option is to run a headless unity client along the server that will control the bots, that will make a lot of things easier, however, I wonder how much worse would the performance be in relation to running is purely on photon server..

    Thanks,
    Michael.
  • In general, you may go in either way. Timers and Unity Host will work because you want just one world per GS. The current version of self-hosted unity takes a lot of resources, but they are going to make it better.

    With timers, I would probably use a slightly different way. I would create the timer at the end of logic. Timers are calling your method slightly irregular plus your logic also may take different time. You may take all this into account and schedule timer to a shorter time, for instance. So that calculation will be more smooth.
    Check what does better suit your needs

    best,
    ilya
  • Hmm so creating a timer 30 times a second is ok?
    From what you are saying I understand that the timer calls my function and then waits for it to end before timing the next call (in the case of a periodical timer), rather than an interrupt like timer, is that right?

  • Well, to be honest, 30 times per second on the server is too much. I mean from the server logic point of view. usually, it is ok if it ticks 10 times per second
    >From what you are saying I understand that the timer calls my function and then waits for it to end before timing the next call (in the case of a periodical timer), rather than an interrupt like timer, is that right?
    yes, that is right. every new timer callback will be executed only when previous finishes

    best,
    ilya
  • When I say 30 ticks per second I mean the server-side only calculations, rather than broadcast to clients...
    I need to think if it makes sense to run the server-side calculation faster than the sending rate at all, since updates like position can be as slow as 5-10 updates per second, while other events, like "attack" can be handled in an "event driven" manner - meaning immediately on arrival without waiting for the next tick.
  • that all makes sense

    best,
    ilya
  • StarKistStarKist
    edited October 12
    @chvetsov

    New question:

    What would be a good way to store the player list on the server in the plugin?

    I can see the pluginHost.GameActors, now I want to extend that for much more information related to the game, like positions, rotations, hp, and all that.

    Is creating a List/Array of players with my information and a pointer to the IActor for each of them ok? or is there a better way?

    Thanks,
    Michael.
  • >Is creating a List/Array of players with my information and a pointer to the IActor for each of them ok? or is there a better way?

    no, there is nothing built-in. Except for properties, but they are not quick enough to access them.

    best,
    ilya
Sign In or Register to comment.