photon.*

Type library
Revision 2014.2478
Keywords photon
Sample code
See also
Availability Starter, Basic, Pro, Enterprise

Overview

Photon is a multiplayer-game development framework that is fast, lean and flexible.

Photon consists of a server and client SDKs for all major platforms. The Photon Cloud is a fully managed service of Photon Servers. Exit Games is running them in several regions, ready to use instantly.

The Corona Photon Plugin provides a simple to use Lua api to find games, communicate with other clients through Photon Cloud or Photon Server and a lot more.

Platforms

The following platforms are supported:

Syntax

local photon = require "plugin.photon"
local masterAddress = "app-eu.exitgameslcoud.com:5055" -- using Photon Cloud EU region as default
local appId = "" -- each application on the Photon Cloud gets an appId
local appVersion = "1.0" -- clients with different versions will be separated (easy to update clients)
local client = photon.loadbalancing.LoadBalancingClient.new(masterAddress, appId, appVersion)
client:connect()

Modules

Project Settings

SDK

When you build using the Corona Simulator, the server automatically takes care of integrating the plugin into your project.

All you need to do is add an entry into a plugins table of your build.settings. The following is an example of a minimal build.settings file:

settings =
{
    plugins =
    {
        -- key is the name passed to Lua's 'require()'
        ["plugin.photon"] =
        {
            -- required
            publisherId = "com.exitgames",
        },
    },      
}

Enterprise

Using Corona Photon Plugin instead of Photon Corona SDK in your Enterprise project can reduce time which client spends on establishing connection to the server (with encryption enabled for authentication phase).

Download plugin library for your platform and link it into app executable.

iOS

Sample Code

The Basic Sample is a simple app that demonstrates creation of the room and events exchange in the room.

The Particle Demo automatically joins players into a room, where it syncs the players' positions on a grid. It also uses some advanced features like properties, event caching and it splits the "world" grid into four Interest Groups.

The Chat API Demo is a chat client sample.

Note: The samples are Photon Cloud enabled - no need to setup any server! Register (for free), check your mail to access the Photon Cloud Dashboard and copy and paste your AppID into the AppId field in cloud-app-info.lua.

Support

More support is available from the Exit Games team: