Best Of
Re: Failed Creating room when using PlayFab
UPDATE:
The issue should be resolved now.
From Photon side: we added a fix and started rolling out to a separate cluster and moved affected apps from customers that reported this there. We will continue rollout of this update slowly now to all servers.
From PlayFab side: they reverted a CloudScript related change to last week's version and the BOM causing this is gone for now for all applications. They will make sure it won't cause problems when they update again the next time.
Thank you for your patience and understanding!
The issue should be resolved now.
From Photon side: we added a fix and started rolling out to a separate cluster and moved affected apps from customers that reported this there. We will continue rollout of this update slowly now to all servers.
From PlayFab side: they reverted a CloudScript related change to last week's version and the BOM causing this is gone for now for all applications. They will make sure it won't cause problems when they update again the next time.
Thank you for your patience and understanding!

5
Re: Transform View Not working
@MadFerret, sorry for the late reply.
You should possibly not sync each piece of a car by itself. This adds overhead, compared to just telling the other players where the car is and where it moves. The wheel rotation can be derived from that, instead of explicitly sending that as data on it's own.
How far did you get with this, aside from the setup?
You should possibly not sync each piece of a car by itself. This adds overhead, compared to just telling the other players where the car is and where it moves. The wheel rotation can be derived from that, instead of explicitly sending that as data on it's own.
How far did you get with this, aside from the setup?

5
Re: Keeping an empty room alive?
Hi @LucasSQ,
Thank you for choosing Photon!
For completeness and future reference:
I wanted to add that you can keep a room alive for up to EmptyRoomTTL milliseconds.
The maximum value being 300000 milliseconds (5 minutes) on the Photon Public Cloud.
Thank you for choosing Photon!
For completeness and future reference:
I wanted to add that you can keep a room alive for up to EmptyRoomTTL milliseconds.
The maximum value being 300000 milliseconds (5 minutes) on the Photon Public Cloud.

2
Re: iOS opRaiseEvent -> customEventAction loss parameter passing NSData
Hi @AlexeyZhukov.
Yes, this is supported.
objective C: nByte - C++: nByte
objective C: short - C++: short
objective C: int - C++: int
objective C: int64 - C++: int64
objective C: bool - C++: bool
objective C: float - C++: float
objective C: double - C++: double
objective C: NSString - C++: JString
objective C: EGArray of type x - C++: x* - (i.e.: EGArray of type nByte - nByte*)
objective C: NSArray - C++: Object*
objective C: EGDictionary of keytype x and valtype y - C++: Dictionary<x, y>
objective C: NSDictionary - C++: Hashtable
objective C: EGCustomType - C++: CustomType
In fact the objective C client is just a wrapper around the C++ client.
Accordingly the objective C client does not have it's own (de-)serialization code, but converts all types to their C++ equivalents when passing them to the underlying C++ APIs for serialization and back to the matching objective C types when receiving deserialized data from the underlying C++ APIs.
Hence under the hood the objective C client and the C++ client run the exact same C++ serialization and deserialization code.
Therefor if you can successfully transfer some data between two objective C clients, then it already has been successfully serialized and deserialized by the underlying C++ client anyway and hence the C++ client for Android will understand it as well, as it shares the same codebase with the iOS C++ client.
Yes, this is supported.
objective C: nByte - C++: nByte
objective C: short - C++: short
objective C: int - C++: int
objective C: int64 - C++: int64
objective C: bool - C++: bool
objective C: float - C++: float
objective C: double - C++: double
objective C: NSString - C++: JString
objective C: EGArray of type x - C++: x* - (i.e.: EGArray of type nByte - nByte*)
objective C: NSArray - C++: Object*
objective C: EGDictionary of keytype x and valtype y - C++: Dictionary<x, y>
objective C: NSDictionary - C++: Hashtable
objective C: EGCustomType - C++: CustomType
In fact the objective C client is just a wrapper around the C++ client.
Accordingly the objective C client does not have it's own (de-)serialization code, but converts all types to their C++ equivalents when passing them to the underlying C++ APIs for serialization and back to the matching objective C types when receiving deserialized data from the underlying C++ APIs.
Hence under the hood the objective C client and the C++ client run the exact same C++ serialization and deserialization code.
Therefor if you can successfully transfer some data between two objective C clients, then it already has been successfully serialized and deserialized by the underlying C++ client anyway and hence the C++ client for Android will understand it as well, as it shares the same codebase with the iOS C++ client.
Re: iOS opRaiseEvent -> customEventAction loss parameter passing NSData
Hi @AlexeyZhukov.
NSData does not belong to the data types that are supported by Photons serialization.
You could add it as a custom type, if you wanted to, though.
The Client informs you about unsupported data types via an error level log message, if you assign an implementation of the EGBaseListener protocol to ListenerEGBase.Listener, like shown in -NetworkLogic::initWithOutputListener ()line 89 of NetworkLogic.mm from demo_loadBalancing_objc inside the SDKs demo folder.
Photons serialization supports the following types:
nByte
short
int
int64
bool (note: due to a bug in the latest iterations of Swift (not in Photon, but in the Swift language itself), there is currently no way to pass a bool to Photon from Swift code - as a workaround you can just store your boolean value in a variable of another type, i.e. nByte)
float
double
NSString
EGArray (a subclass of NSArray, which enforces that all array elements have the same type)
NSArray
EGDictionary (a subclass of NSDictionary, which enforces that all keys-value pairs share the same key type and the same value type))
NSDictionary
An NSData instance is just an array of bytes. You can just access the raw bytes of an NSData instance and use them to create an EGArray instance with element type nByte.
Example code for creating an EGArray with element type nByte:
NSData does not belong to the data types that are supported by Photons serialization.
You could add it as a custom type, if you wanted to, though.
The Client informs you about unsupported data types via an error level log message, if you assign an implementation of the EGBaseListener protocol to ListenerEGBase.Listener, like shown in -NetworkLogic::initWithOutputListener ()line 89 of NetworkLogic.mm from demo_loadBalancing_objc inside the SDKs demo folder.
Photons serialization supports the following types:
nByte
short
int
int64
bool (note: due to a bug in the latest iterations of Swift (not in Photon, but in the Swift language itself), there is currently no way to pass a bool to Photon from Swift code - as a workaround you can just store your boolean value in a variable of another type, i.e. nByte)
float
double
NSString
EGArray (a subclass of NSArray, which enforces that all array elements have the same type)
NSArray
EGDictionary (a subclass of NSDictionary, which enforces that all keys-value pairs share the same key type and the same value type))
NSDictionary
An NSData instance is just an array of bytes. You can just access the raw bytes of an NSData instance and use them to create an EGArray instance with element type nByte.
Example code for creating an EGArray with element type nByte:
NSValue* valArray[10]; for(nByte i=0; i<10; ++i) valArray[i] = [NSValue valueWithBytes:&i objCType:@encode(nByte)]; EGArray* arr = [EGArray arrayWithObjects:valArray count:10];
Re: Keeping an empty room alive?
This happens by design. The point being: If you endlessly keep the room in memory, you have to run the server and that costs (dearly). Also it prevents us from distributing rooms across machines (which we may add to and remove some).
So, with the Photon Cloud as a service, this can not be done.
You can potentially store your progress, provided you have a webservice you'd attach to Photon via WebHooks.
This allows to store and load the state of a room almost seamlessly.
Of course it's also possible to write your own server software to do as you plan. Photon is excellent for that. You'd get the Photon Server SDK for it and go wild
.
So, with the Photon Cloud as a service, this can not be done.
You can potentially store your progress, provided you have a webservice you'd attach to Photon via WebHooks.
This allows to store and load the state of a room almost seamlessly.
Of course it's also possible to write your own server software to do as you plan. Photon is excellent for that. You'd get the Photon Server SDK for it and go wild


2
Re: How to deal with fast rotating player objects.
Quaternion rotations usually take the shortest path so if something is rotating from 0 to 270 degrees, the path it will take is to rotate -90 degrees. You may want to store and network the Euler angles then interpolate manually.

6
Re: How would I go about making a character customiser for my 2d game?
Mine is pretty sloppy and could be refined, but here's how it works, hope this helps:
I have a gameobject with all cosmetics as children and active toggled to false. I have a cosmetic selection before a game that lets the player save them before the game using playerprefs to store the selected cosmetics names as strings. The cosmetics are based on categories (head, face, hands etc)
Once the game starts and the character is instantiated, it will check for these using this an array for each category to reference the playerpref, then send an RPC to all other players to update it.
the array
The code on Instantiation of the player to set cosmetics active
The RPC to make others set it as active
Happy to chat on Discord or Twitter if you want to see the cosmetic selection screen too. Just send me a message.
I have a gameobject with all cosmetics as children and active toggled to false. I have a cosmetic selection before a game that lets the player save them before the game using playerprefs to store the selected cosmetics names as strings. The cosmetics are based on categories (head, face, hands etc)
Once the game starts and the character is instantiated, it will check for these using this an array for each category to reference the playerpref, then send an RPC to all other players to update it.
the array
public string[] cosmetics = new string[7] { "HAIR", "MASK", "CHEST", "BACK", "HANDS", "LEGS", "FEET" };
The code on Instantiation of the player to set cosmetics active
foreach (string s in cosmetics) { if (PlayerPrefs.GetString(s, "None") != "None") { cosmeticObject = this.transform.Find(PlayerPrefs.GetString(s)).gameObject; cosmeticObject.SetActive(true); photonView.RPC("AddCosmetic", RpcTarget.Others, PlayerPrefs.GetString(s, "None")); } }
The RPC to make others set it as active
[PunRPC] void AddCosmetic(string name) { if (!photonView.IsMine) { GameObject currentObject = this.transform.Find(name).gameObject; if (currentObject != null) { currentObject.gameObject.SetActive(true); } } }
Happy to chat on Discord or Twitter if you want to see the cosmetic selection screen too. Just send me a message.
Re: Out of nowhere the room listing does not work.
Hi JohnTube and Tobias,
Thanks for the quick reply.
I am still stuck on PUN 1 with the project I am working on right now. It has been in development for a long while and is about to hit prod soon. I am using the free 20 CCU plan.
Changing the lobby type from SqlLobby to default solved the issue for me, thanks a lot!
Thanks for the quick reply.
I am still stuck on PUN 1 with the project I am working on right now. It has been in development for a long while and is about to hit prod soon. I am using the free 20 CCU plan.
Changing the lobby type from SqlLobby to default solved the issue for me, thanks a lot!


6
Re: BOLT client-server architecture options
Hello @Peter4242 ,
Yes, Photon Cloud does not host any type of game server.
We mean by application, the backend service provided by Photon, like the matchmaking services and the relay connections, in the case of Photon Bolt.
This is not related to any headless executable instance that you run on our servers.
No. For this, we can suggest services like Gameye (https://gameye.com/), PlayFab, AWS, or similar.
Photon Bolt aims to be used for fast-paced games, like FPS, for example, so yes, we would suggest using Bolt for the scenario you've described. Please, take a look at our Showcases page, where some other Bolt games are displayed: https://www.photonengine.com/en-US/BOLT/showcase
On the Bolt product intro page it says Photon Cloud does not host a dedicated Bolt server, is that correct?
Yes, Photon Cloud does not host any type of game server.
On the Bolt pricing page it mentions the Photon Cloud and the statement "you build it, we run it" suggesting a Bolt server can be on Photon's Cloud
We mean by application, the backend service provided by Photon, like the matchmaking services and the relay connections, in the case of Photon Bolt.
This is not related to any headless executable instance that you run on our servers.
I need clarification on whether a Bolt dedicated client -server can be hosted on Photon Cloud.
No. For this, we can suggest services like Gameye (https://gameye.com/), PlayFab, AWS, or similar.
Given Bolt has client prediction and lag compensation it would appear Bolt client-server model is the best solution for a mobile only multiplayer sports game with a very fast moving ball, as opposed to PUN2?
Photon Bolt aims to be used for fast-paced games, like FPS, for example, so yes, we would suggest using Bolt for the scenario you've described. Please, take a look at our Showcases page, where some other Bolt games are displayed: https://www.photonengine.com/en-US/BOLT/showcase