Type library Revision Release 2024.3703 Keywords photon Platforms Android, iOS, macOS, Windows
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.
This 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.
local photon = require "plugin.photon" local serverAddress = "ns.exitgames.com:5058" -- Photon Cloud Nameserver address local appId = "<app-id>" -- 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(serverAddress, appId, appVersion) client:connectToRegionMaster("EU") -- connect to Nameserver, get Master server address for "EU" region and connect to it
To use this plugin, add an entry into the plugins
table of build.settings
. When added, the build server will integrate the plugin during the build phase.
settings = { plugins = { ["plugin.photon"] = { publisherId = "com.exitgames", }, }, }
Using Corona Photon Plugin in a Solar2D Native 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.
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
.