number of channels - how to set them?

Options
Vikarti Anatra
edited March 2011 in Native
Hi,

API Reference mentions it's possible to have several channels(movent in one channel,chat in other,etc)
and says it's 2 channels _by default_.
(and PhotonConstants.h has CHANNEL_COUNT_DEFAULT 2 // default number of channels per peer)

But how to change this default value?it's not noted anywhere

Also, how to send events only to some(and not all) peers connected to channel on server?

Comments

  • Kaiserludi
    Options
    Hi Vikarti Anatra.
    Setting the amount of channels currently is only possible at compiletime of the lib. It is already on the todo-list, to change that, but with the current client release you can't change the default in the native clients.

    Raising events for only some, but not all peers as targets is also on the todo-list. It has recently been added to the .NET API and will be added to the native APIs soon. However you can write your own operations of course, which you have to do anyway, if you want to add custom server-behavior. For custom operations you can of course set the target-actors freely.
  • thanks.

    yes,I will have to do custom server-side anyway..
    Correct way for send events to specified peers only will be to store PeerClients in some list, and later decide which ones to use?or it's possible in custom operation just say "send this event to client with actorNumbers 1,4,7"?
    How for example MmoDemo does that(it have to - for send only to objects in interest area)?(I couldn't find this in MmoDemo's server sources)
  • Kaiserludi
    Options
    It is up to you, how to communicate to the server, to which clients it should send the event triggered by your custom operation.
    The PhotonPeer only sends an operation which a code and some custom data to the server and on the serverside the Photon core only checks, if the code is implemented and passes the operation to the application layer in this case or raises an exception otherwise.
    LitePeer on the client side and the Lite Aplication on the server side implement some often needed standard behavior on top of the Photon core functionality, like raising events, setting and getting properties, joining and leaving rooms, etc.
    All these LitePeer standard operations just call PhotonPeer::opCustom() with the parameters the Lite application is expecting for the passsed operationCode on serverside.
    In raiseEvent case the Lite application has the built in behavior to trigger an event for all actors in the room except the one, who has sent the operation.

    Your own app now can use a LitePeer (or define a subclass of it) or it can directly use the pure PhotonPeer, if it does not need any Lite behavior.

    So for sending operations to certain actorNrs, you have to send a key via opCustom() and to send the actorNrs as value for that key. On the server side you would read out this key again.
    How the value should be interpreted is completely determined by you.
    For example you could add an int-array of actorsNrs, but you could also send just a bytevalue indicating a certain player group (for example 0==all players in room, 2==allies only, 3==friends only, 4==all in room and in friendlist, 5=="I have passed an list of receivers with another custom key", 6==all but the passed list, 7==all in room x(roomid passed as a separate key, 8==all players who can see the sending player, etc.) or use a totally different approach depending on the needs of your game. Your server of course has to read out and interpret the values depending on your custom logic then.
  • Boris
    Options
    How for example MmoDemo does that(it have to - for send only to objects in interest area)?(I couldn't find this in MmoDemo's server sources)
    each avatar item has an event channel (100% unrelated to the enet channel that you asked about earlier), and the clients just publish the event on their own channel. Other players in view distance subscribe to this channel and then get the event.
    The same approach is used here: http://developer.exitgames.com/blankserversetup/partone
  • Tobias
    Options
    Correct way for send events to specified peers only will be to store PeerClients in some list, and later decide which ones to use? or it's possible in custom operation just say "send this event to client with actorNumbers 1,4,7"?
    How for example MmoDemo does that(it have to - for send only to objects in interest area)?(I couldn't find this in MmoDemo's server sources)

    In yet other words: The MMO Application has a different logic than Lite.
    In Lite the client can define the recipients of an event by sending their actorNumbers along. The Lite logic just does what it's told to do.
    In the MMO application, the server's logic decides who receives which events. We didn't implement "messaging" there yet.

    Just in case: We think it's best to start with our new "Hello World" tutorial, Realtime Demo and Lite Lobby Chat. You learn a lot about Photon, which is also true for the MMO application, which just isn't a good starting point.

    Check out:
    http://developer.exitgames.com/demos/demolist for the "Learning Trail"
    http://developer.exitgames.com/quicksta ... worldpart1