Photon Chat

The Photon Chat is a multiplayer chat addon, it implements a dedicated chat connection for multiplayer games, avoiding burdening the realtime multiplayer connection.

It is a fork from the official Photon addon, although improvements are gradually added, including the PlayFab integration, where it becomes from a multiplayer chat plugin into a full fledged networking system.

This has full PlayFab integration, taking advantage of all features from the PlayFab Master Collection. 

 

This integration makes the Photon Chat complete.

 

Intstructions

1. The first step is to add the PlayFab API addon into the project.

2. Then, add the Authentication addon into the project.

3. Finally, add the Photon Chat addon into the project.

4. To start the Photon Chat , create an account on Photon Engine. Then, create a Photon Chat application.

5. Get the App ID of your chat application, labeled below.

6. Once you have the App ID, input it into the AppId property of the Photon Chat.

7. Set your AppVersion, preferably similar to your game application version.

8. If you are using Construct 2, set the protocol to ws since it's ran locally, but if you are using Construct 3, then use the wss protocol.

9. Set the Region to the region of the application you will be releasing that specific application release, it's preferable if you release different application releases for different regions, especially on mobile.

For web, you can either release different states per region or just set this automatically through events. But, technically, you can still do it however you want.

10Lastly, set the Log Level you want Photon Chat to use.

PlayFab Integration

Sample Setup Project

Specifications

  • Instructions - The sample project has comments and instructions on how to use the addon and its features.

  • A.C.E. Coverage - It covers the implementation of each action, condition and expression.

  • Tips and Tricks - It provides some tips and tricks to a better use of the addon and of the event-sheet system alongside it.

Demo Chat

Sample Setup Project

Specifications

  • Instructions - The sample project has comments and instructions on how to use the addon and its features.

  • A.C.E. Coverage - It covers the implementation of each action, condition and expression.

  • Tips and Tricks - It provides some tips and tricks to a better use of the addon and of the event-sheet system alongside it.

Supporters

Only

Actions, Conditions & Expressions

Actions

Actions.png

Connection :

  • Set user id - Set optional user id (required by some cloud services).

    • UserId - User id.

  • Set custom authentication - Enable custom authentication and set it's parameters.

    • AuthParameters - Parameters expected by the used authentication service.

    • AuthType - The type of custom authentication provider that should be used.

  • Set region - Set Master server region.

    • Region - Region.

  • Set app id - Set app id.

    • App id - App id.

  • Set app version - Set app version.

    • App version - App version.

  • Connect - Connect to the name server.

  • Disconnect - Disconnect from all servers.

Chat :

  • Subscribe - Subscribe to channels.

    • Channels - Comma-separated list of channels.

    • History - Controls messages history sent on subscription. 0: no history. 1 and higher: number of messages in history. -1: all history.

    • LastIds - Comma-separated list of last messages IDs.

  • Unsubscribe - Unsubscribe from channels.

    • Channels - Comma-separated list of channels.

  • Publish message - Send message to a public channel.

    • Channel - Channel name.

    • Message - Message.

  • Send private message - Send private message to a single target user.

    • UserId - User id.

    • Message - Message.

  • Add friends - Add entries to the list of users sending you status updates.

    • UserIds - Comma-separated list of user ids.

  • Remove friends - Remove entries from the list of users sending you status updates.

    • UserIds - Comma-separated list of user ids.

  • Set user status - Set user's status and an optional message.

    • Status - Status

    • Custom Status - Custom Status

    • Message Option - Status message option.

    • Message - Status message.


Common :

  • Reset - Disconnects and creates new client instance.


PlayFab :

  • PlayFab Authenticate - Authenticate with PlayFab. A variety of custom authentication.

    • PlayFab ID : - The PlayFab ID you can get from the PlayFab Master Collection.

    • Photon Token : - The PlayFab Photon Token you can get from the "Get Photon Token" action.

  • Get Photon Token - Gets a Photon custom authentication token that can be used to securely join the player into a Photon room.

Conditions

Connection :

  • On connected to Front End - Triggered when client connects to Front End and ready to chat.

  • Is connected to Nameserver - True if client connected to Nameserver.

  • Is connected to Front End - True if client connected to Front End server.

Conditions.png

Chat :

  • On message in channel - Triggered on new message in specified channel.

    • Channel - Channel name.

  • On message - Triggered on new message in any channel.

  • On private message in channel - Triggered on new message in specified private channel.

    • Channel - Channel name.

  • On private message - Triggered on new message in any private channel.

  • On user status update - Triggered when friend changed his status.

  • On subscribe result - Triggered when result of subscription request received.

    • Success - Channel subscription result.

  • On unsubscribe result - Triggered when result of unsubscription request received.

    • Success - Channel unsubscription result.

 


PlayFab :

  • On Get Photon Token - Triggers when the request to get the photon authentication token has succeeded.

  • On Get Photon Token Failed - Triggers when the request to get the photon authentication token has failed.

 


Client :

  • On error - Triggered on error.

  • On state change - Triggered on client state change.

Expressions

Connection :

  • State - Current client state.

  • StateString - Current client state string.

  • UserId - Previously set user id.

Chat :

  • Channel - Channel name set in last condition.

  • Message - Message set in last condition.

  • Sender - Sender set in last condition.

  • UserStatusUserId - Id of user which status was last updated.

  • UserStatus - Last updated user status.

  • UserStatusString - Message sent along with last user status update.

  • UserStatusMessageUpdated - True is message was sent along with last user status update.

  • UserStatusMessage - Message sent along with last user status update.

  • ChannelLastMessageID - Channel last message ID.

    • Channel - Channel name.

 


PlayFab :

  • PhotonToken - Return the "Photon Token" on "Get Photon Token".

 


Client :

  • ErrorCode - Last error code.

  • ErrorMessage - Last error message.

Properties

  • AppId - Application id.

  • AppVersion - Application version.

  • Protocol - Connection protocol.

    • ws

    • wss

  • Region - Master server region.

    • EU

    • US

    • Asia

  • LogLevel - Logging level.

    • DEBUG

    • INFO

    • WARN

    • ERROR

    • OFF

Demo Pool

Sample Setup Project

Specifications

  • Instructions - The sample project has comments and instructions on how to use the addon and its features.

  • A.C.E. Coverage - It covers the implementation of each action, condition and expression.

  • Tips and Tricks - It provides some tips and tricks to a better use of the addon and of the event-sheet system alongside it.

Photon Realtime

The Photon Chat implements a dedicated network chat feature for the game application, although this is only mainly for chat and not recommended for realtime data syncs. The Photon Realtime is the addon that syncs the game data in realtime for the use of all the players in the game.

Supporters

Only

Demo Test

Sample Setup Project

Specifications

  • Instructions - The sample project has comments and instructions on how to use the addon and its features.

  • A.C.E. Coverage - It covers the implementation of each action, condition and expression.

  • Tips and Tricks - It provides some tips and tricks to a better use of the addon and of the event-sheet system alongside it.

Supporters

Only

Supporters

Only

PlayFab Server Setup

The PlayFab's server side integration with the Photon Chat is fairly easy. You just need to have both a PlayFab account and Photon account, which you should already have. And have an application for both services you want to connect. Then the instructions below will walk-through  you to the process.

Addons.png
Photon - PlayFab Addon.png

Step 1 : From the PlayFab Dashboard, select the Add-ons menu option. It will show the lists of PlayFab's partner services. Select Photon from the Multiplayer addons list.

PlayFab Photon Integration - 1.png

Step 2 : The PlayFab's Photon addon integration description will show, please read this, then after proceed to scroll down.

PlayFab Photon Integration - 2.png

Step 3 : Install the PlayFab addon if it's not yet installed, fill the forms if there are any.

Step 4 : Take note of the Photon Secret key and input your Photon Chat App ID. This is the same App ID you've inputted in the Photon Chat addon from Construct.

Realtime - Setup.png

Step 5 : You are almost done, just follow these instructions to configure from your Photon Console.

Step 6 : You are now done with your Photon Chat setup!

That's it for this setup guide, enjoy your new game features and happy game development!

 
 
 
 
 

Get the tools

for your pro games!

Constuct Master Collection - Itch.io
Constuct Master Collection - Discord
Constuct Master Collection - Construct 3

© Construct Master Collection 2020 • All rights reserved

Contact Information: