setting game properties

Hi,
i am experiencing some problems with setting game properties using photon cloud.
i try creating new game like this:
var gameProps:GameProperties = new GameProperties();
          
gameProps.roomName = "room1";
gameProps.roomInfo.isVisible = false;
gameProps.roomInfo.isOpen = false;
gameProps.roomInfo.maxPlayers = 2;

var params:Array = [];
params.push(Constants.KEY_GAME_ID);
params.push(gameId);
           
params.push(Constants.KEY_GAME_PROPERTIES);
params.push(gameProps.serialize());

sendOperation(Constants.OP_CREATE_GAME, params);

i always get the game with properties isVisible and isOpen set to true, and maxPlayers set to 0.

also when i try to set properties of existing game like this:
var params:Array=[];
params.push(Constants.KEY_GAME_ID);
params.push(gameId);
			
var gProps:GameProperties=GameProperties.createDefault();
gProps.roomInfo.isOpen=false;
gProps.roomInfo.isVisible=false;
					
params.push(CoreConstants.KEY_GAME_PROPERTIES,gProps.serialize());
sendOperation(CoreConstants.OP_SET_PROPERTIES,params);

and nothing happens.
i'm new to photon. is there something i'm doing wrong or does the current api for flash with photon cloud doesn't work yet.

in addition to this i just wanted to make few comments on the api docs.
It would be very helpful if the docs contained some simple examples of usage. As a new user, i have trouble figuring out the basic things like: how is sendOperation used, what operation codes in constants class can i use inside a room, and what are the parameters i should send with some operation...

Comments

  • The demos are pretty plain and brief. We hoped they would show how you send data.
    I will point my Flash colleague to this question to get you an answer to the questions.
  • dont get me wrong. the demos are great. everything i did so far is using the demo files. the usage of custom events is very well explained. but still it would be great to have basic examples and few words on usage in the documentation.
  • I agree. The flash documentation is probably even more brief than any other.
    I asked my colleague to have a look at this thread and help. This will also go into the docs.
  • Only the latest release of the Flash SDK (v3-0-0-2-RC4) supports Photon Cloud. Are you sure you are using no deprecated version? The GameProperties class has no roomInfo property or roomName properties at all in this version. Instead, to set gameProperties supply them within the call to
    opCreateGame(gameId:String = "", gameProperties:GameProperties = null):void
    
    or use the method
    opSetGameProperties(gameProperties:GameProperties, doBroadcast:Boolean = false):void
    
    after you already created / joined a game. Both methods are exposed by LoadBalancedPeer class. Please let me know if you are still facing problems after updating.
  • yes. thanks for the reply. i see the problem now. i am using the latest release of flash sdk but the load balanced code was changed.
  • max number of players property still doesn't work. however, custom properties work.
  • What exactly does not work with the max-players setting?
    Is it applied when you create a room but does it not change when you set it in-room?
  • it isn't applied when creating the room, or changing it later when in the room. it is always 0.
  • Hi generative,
    i checked it out and indeed we have a problem here.
    opSetProperties and opGetProperties
    do work only with customProperties right now. On the other hand,
    gameListEvent and gameListUpdateEvent
    do correctly interprete and respond including the maxPlayers property while
    opCreategame and opCreateGame
    do so after connection to the gameServer is established.
    So until we got this issue fixed i suggest to leave the maxPlayers value at default and create a workaround using customProperties.
  • "leave the maxPlayers value at default"
    That's a bit confusing.
    In Flash, you currently can set maxplayers only on createRoom. Usually, this should be fine and the more annoying issue is that you can't close and hide a room yet.
    We're working on this.