Integration with Photon Cloud: Multiplayer

From the Asset Store
This is a simple login feature to access Metamask in construct 3. Requires a Chrome Browser and Metamask Extension.
  • The plugin is not intuitive at all and really hard to use for someone who doesn't know what each events do code-wise , and without a join and leave command , it doesn't help too , to be honest , you should re-work the structure ( You could take the official websocket plugin as an inspiration) , for now , the plugin is not useable for other than you .

    I would suggest restarting the plugin from ground-zero and concentrating on those CAEs

    On closed

    Triggered when the connection is closed, either deliberately or due to an error.

    On connected

    Triggered when the connection is successfully established and the communication channel is now open.

    On message

    Triggered when a text message arrives from the server over an open connection. Use the MessageText expression to retrieve the content of the message.



    Close any active connection. No more messages can be sent or will be received after closing.


    Connect to the server

    Send text

    Send a text string to the server. This is ignored if the connection is not currently open.



    In On message, the text content of the message just received from the server.

    Examples of the uses

    You could send a message as "Object|UID|X|Y"

    And you wouldn't need webplayer.X/Y

    That would be all the essential conditions for a game , and would largely sufficient

    I'm sorry , but I gave it all what I could and I hope you can make this happen !

  • Whiteclaws

    Tx for yr feedback.

    I think you're expecting it to be a sort of websocket plugin, but that wasn't my aim, which was to make a higher-level behavior, that doesn't require the C2 game developer to decode low-level text strings.

    As for the join and leave events, I followed the ExitGames Photon Cloud JS SDK examples, where the 'Join' and 'Leave' buttons are embedded in the index.html web page (my PhotonClient runtime modifies the C2 index.html to enable this). The effect is to remove from the C2 edittime the ability to modify those buttons.

  • Velojet ,

    That would be pretty basic , but easier to get started with and to control the flow of the game with.

    As for now , I can't define how hard it is to create a new player

    On joigned - Send message - "Creation|Webplayer.ID|X|Y"

    On message

    -- tokenat(message,0,"|")= "Creation"

    Create Player at tokenat(message,1,"|"), tokenat(message,2,"|")

    Set Id to Webplayer.ID

    Every tick

    Send message "Movement|Webplayer.Id|X|Y"

    -- On message

    --- tokenat(message,0,"|")= "Movement"

    ---- Player.ID = tokenat(message,1,"|")

    ----- Set player position to tokenat(message,2,"|"),tokenat(message,3,"|")

    It may be a bit low-level , but it's way more intuitive and easy-to-understand than the current "high-level" behavior

    As for the join events , is there a way to auto-join the game without having an ugly join button ?

    Finally ,

    You could setup the messages to be multiple parameters ( function-ish ) Messages

    So the dev could check the first parameter ( state ) , the second parameter ( X ) and third ( Y ) without having to use tokenat

    I think this plugin has a lot of potential , and I don't want it to be flushed down in the servers of the scirra forum

  • Whiteclaws

    Thx very much for your continuing interest in this behavior!

    As for now , I can't define how hard it is to create a new player.ave a look at function MakeWebPlayer() in my demo. All you need are the coords of the remote web player, which my PhotonClient behavior will give you directly without any need for low-level tokenat() text string deconstruction.

    Then all you have to do is to use my PhotonClient's Set WebPlayer's ID action and the standard C2 Create object action to have the web player appear. Much easier than your proposed code ;)

    As for the join events , is there a way to auto-join the game without having an ugly join button ?till waiting on the ExitGames people to come through with this!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here's a direct comparison:

    Whiteclaw's low-level code:

    tokenat(message,1,"|"), tokenat(message,2,"|")

    My high-level PhotonClient expressions:

    WebPlayerX, WebPlayerY

    I rest my case!

  • The request information from servers and all , just to create player

    As of , you could just do

    On joigned ,

    Create player

    Set player.ID to Webplayers.ID

    On webplayer joigned :

    Initialise data of web player to create (i.e. data to be used by C2 in creating web players)

    Create Player

    Set Player.Photon.WebplayerId to player.uid

    All of this is pretty confusing and description doesn't give a lot of help

    I know you want to make a high-level plugin , but all of this is really complex and not really intuitive for a person that doesn't know what each line does

    I wouldn't trade simplicity and intuitivity for low event-count and complexity

  • Whiteclaws

    ... All of this is pretty confusing and description doesn't give a lot of help ...ave good study of my Workout demo. You'll find it pretty fully commented e.g.

    <img src="" border="0" />

    Also, you'll get the usual C2-type prompts with all the PhotonClient ACEs.

    And feel free to ask if there's not enough info there.

  • Hi, Velojet, any news about your script and photon?

    Are you guys familiar to the Bloons TD matchmaking system for getting 2 clients in a server?

    Bloons TD or this one

    I need this Multiplayer System is it possible to make?

    Velojet could you help me?

  • <font size="2"><font face="Verdana, Arial, Helvetica, sans-serif">I'm trying to make a Plugin based in the Behavior (a simple plugin version of the behavior). For now the plugin can create/join/leave a room, and send/receive a message. It is very basic... <img src="smileys/smiley12.gif" border="0" align="middle" />


  • I made a simple Photon Plugin for my game, but I hesitate to post it in the forum. I will share it if anyone is still interested with Photon. Here is the ACEs:

    <font face="Courier New, Courier, mono"><font size="2">

    ACTIONS                 CONDITIONS                 EXPRESSIONS

                          On connected, On error       ClientError

    Set name              On room list update          RoomPropsList

    New Game              On join room                 MyPlayerIDinRoom

                          On player join               PlayerJoinedID, PlayerJoinedName

    Quit Game               On player leave            PlayerRetiredID, PlayerRetiredName

    Send message by event   On message by event        LastMessageBy, LastSenderIDby


    (A player first try to join a random room, an unsuccesful matchmaking creates a room with automatic name. Once in a room you can raise and receive diferent events, also to know who sent a message.)

  • Deko

    Glad to see someone is working towards this again.

    I know that Velojet has stopped working on the project, but that doesn't mean you should hesitate trying to make a plugin that uses PhotonCloud. I think that someone taking up the mantle would be good in order to get the people who make PhotonCloud to want to support Construct 2 development.

    There should be multiple ways of doing something, and currently Simple Online Multiplayer is a bit lacking for C2 at the moment.

    I do suggest that once you have it more complete to make your own thread about it rather than use this old one. This thread has a lot of information that could confuse newcomers that would use your plugin instead.

  • This sounds awesome since webRTC isn't supported yet on iOS I think this is what I will be using for iOS multiplayer. I will try to get some time to test it out after Christmas.

  • Deko if it will work on iOS and Android, please post. I am very interested! I won't have to write a server application and use nasty websockets.

  • We now officially support Photon Cloud and Construct 2. Find our plugin here:

    Feedback appreciated.

    enjoy, Chris

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)