Bolt now has full support for Photon's industry proven matchmaking and global relay network.
The "NEW-PhotonCloud" folder contain example scripts showing how you can start using Bolt + Photon Cloud. You will be able to create Bolt servers and connect clients to it using the same API you'd use for Bolt on LAN, but using our cloud services.
First you need to install the Photon Cloud packages and the example games. Follow the next steps to accomplish the installation:
Before proceeding, please register and create an Bolt Photon App ID on Photon Engine Dashboard. You'll need to fill the App ID on "Window/Bolt/Settings", under the Photon Relay category.
On this example, we show the simplest way to use Bolt with Photon Cloud services.
Navigate to the folder "Assets/bolt_samples/NEW-PhotonCloud/demo_simple", you will find two folders:
- "Scenes": contains a basic scene that will show the menu to create a server or client player.
- "Scripts": folder with all scripts needed to make the demo work:
- "PhotonInit.cs": entry point class to use Photon Cloud integration, more details below.
- "PhotonTokens.cs": class to register some "Tokens" necessary to run the demo.
- "PhotonServerCallbacks.cs": class that extends from
Bolt.GlobalEventListenerand show debug messages about the connection between server and clients, like "connect", "disconnect" and "connection requests".
Open the "PhotonInit.cs" script and take a look at some topics:
Register all Tokens. Some "Tokens" are necessary to build the sample, the registration is make as usual. To know more about "Tokens" follow this link.
Configure Bolt to use the Photon Cloud platform. This will setup Bolt to use Photon as a relay service in order to publish rooms to the cloud and listen for updates.
Starting Bolt. Initialize the player as usual:
Create and publish a room. As a server player, you can create a room and publish to the cloud, later the clients will be able to connect to it.
List all available rooms to connect. As a client, you can get the list of rooms, the information associated with it and try to connect to it's server.
Playing the Game
After you know what to do in order to make Bolt run with Photon Cloud, we will run the current demo code. Follow the next instructions to run the game.
- Compile Bolt. Before anything, you need to compile Bolt to make it aware of all yours Prefabs/Entities. Please run "Assets/Bolt/Compile Assembly".
Setup the scenes. Go to "File -> Build Settings" and in the "Scenes in Build" drag and drop two scenes:
- (0) "Assets/bolt_samples/NEW-PhotonCloud/demo_simple/Scenes/PhotonTutorial"
- (1) "Assets/bolt_samples/AdvancedTutorial/scenes/Level1"
Build the player. Go ahead and build a standalone version of the game.
Running the players. Open two instances of the game.
- On the first one click on "Start Server", then "Publish HostInfo And Load Map". This will load the game scene and publish the room to the cloud.
- On the other player, click on "Start Client", then wait for a few seconds, then the list of rooms will be updated and you will get one room listed with some descriptive information. Click on the room's name, the client should connect to server and load the in-game scene.
- Have fun.
If you have any inquiry on this, contact us through our support channels: