send messages between clients in island demo

Options
thetnswe
thetnswe ✭✭
edited February 2011 in DotNet
Hi,
How do I send messages between clients in the island demo application. I would like to implement simple ingame chat where the user can chat with other users in the same world... I saw the chat demo but its architecture is quite different from MMO island approach.. How can I raise and receive events on Island MMO demo and also send events between clients?

Comments

  • thetnswe
    Options
    I've managed to integrate the chat system to the island demo .. I am not quite sure why the source are different from one another... For example, in the chat example, the peerstatuscallback use status code as a callback type where the iPhotonPeer in islanddemo use int as a callback return type.... can you please guide me which one is the right choice and latest ones?
  • Tobias
    Options
    I'm not into the MMO application as much as Boris is, but I think RaiseGenericEvent() should do the trick. It's not used in the demo, so that is hard to find but it should mimick RaiseEvent from the realtime demo. From the looks, the event also goes through interest management. So this would only work for a regional chat.
    Boris should know (and tell later on) a good way to make a global chat.
  • thetnswe
    Options
    Hi, I couldn't find RaiseGenericEvent() function in the MMO demo .. where is it? I've got one question, i found LitePeer class which is an extension of Photon class from ExitGames.Client.Photon which is different from Photon.MmoDemo.Client ..... they perform same operations but some differnt in features of what they can do.. LitePeer class include interface to OpRaiseEvent and others where the MMODemo doesn't provide... Where can I find RaiseGenericEvent() in MMO demo and how can I use it? How can I listen messages coming fomr other clients using this generic event
  • thetnswe
    Options
    HI, did you mean the RaiseGenericEvent() from Operations?? Can you give me a sample of how can I use this operations. How can I listen to that even from other clients?
  • thetnswe
    Options
    So.. no one can help me how can I use RaiseGenericEvent() :(
  • Boris
    Options
    To call RaiseGenericEvent from the client use Photon.MmoDemo.Client.Operations.RaiseGenericEvent().
    To see what the server does with it look at MmoActor.OperationRaiseGenericEvent().
    For a global chat you need to do provide a channel all peers subscribe to like the MmoRadar.
    You can either do this exactly like the MmoRadar or by using an Item that you don't spawn (don't call UpdateInterestManagement) and have all clients manually subscribe to it. Then use RaiseGenericEvent targeting this item to exchange chat messages.
  • thetnswe
    Options
    Do you have an example applications of showing how to implement this? just small bit of code will be really helpful.. please
  • Tobias
    Options
    Client side, we implement operations in the demos. Check the LitePeer.cs in the Unity Realtime Demo. It implements RaiseEvent in several flavours...
    Check which "parameters" are defined in the OperationRaiseGenericEvent class (via attributes). Then create client side code that supplies these parameters (by using a fitting byte key in the parameters hash, as shown in LitePeer.cs). The result of the operation is something you could then print out to a log via SupportClass.HashtableToString(returnValues). Same for the EventAction you get.

    I currently don't have a sample for OperationRaiseGenericEvent and not the time to do it right now :(
  • thetnswe
    Options
    Thanks for the information.... I will try to do it by my self
  • thetnswe
    Options
    which version of code is that I need to focus on? MMO code from island demo or LitePeer class from Chat demo and realtime Demo?
  • Tobias
    Options
    We think it's best to start with Lite and the Realtime Demo. Do some work in it, extend it with a Move operation or interpolation. Just any custom operation should do. Call it from the client to get a knack for the workflow.

    When you get the general idea and you need to have a seamless world (and only then), you should switch to the MMO application and it's demos. This implements interest management, items and some more. It's fairly complicated but again: it's not a complete MMO game. It's just one way to implement those features.