Update Room Properties

0 votes

I have two users A and B. In Fruit card based game, user A select the card Apple and user B selects card Banana as players cannot select the same card. To maintain this i am using room properties to get selected card by user. 

When user A selects "Apple" card. I create the Turn based Room with properties {"A":"Apple"} and When user B will select the "Banana" card. I call the updateRoom Properties method to add new property  {"B":"Banana"}. So now room should  have two properties {"A":"Apple" , "B":"Banana"}. But calling updateRoom method with user B is not updating the properties in room. Here is my code.

NSDictionary *playerData = @{@"B":@"Banana"};

[[WarpClient getInstance] updateRoom:self.currentRoomID

                               addProperties:playerData

                            removeProperties:nil];

I got the call back event onUpdatePropertyDone:(LiveRoomInfoEvent *)event.

But when i print the event.properties in console. It returns null. 

My doubt is :

Room owner can only update the properties of room  ?

or

any user joined that room can updates the properties  ?

or

Am i doing something wrong here ?

 

asked Mar 20, 2014 in AppWarp by nilesh (109 points)

1 Answer

+1 vote

No, anyone who has joined the room can update the room properties.

We have checked the above code it works fine here.

It may happen if you pass "nil" value for room id. May be you are getting this callback but with failed response as below:

-(void)onUpdatePropertyDone:(LiveRoomInfoEvent *)event

{

       if (event.result == SUCCESS)

       {

              NSLog(@"%s...properties=%@",__FUNCTION__,event.properties);

      }

      else {

               NSLog(@"%s...Failed",__FUNCTION__);

               NSLog(@"%s...properties=%@",__FUNCTION__,event.properties);

        }

}

 

Do let us know if it helps.

answered Mar 21, 2014 by rajeev.etc (1,660 points)
rajeev, you are right, i was getting error but my room id was correct. i am getting RESULT SIZE ERROR. what it means ? Even documentation does not describe about this error. http://appwarp.shephertz.com/game-development-center/ios-game-developers-home/ios-client-result/
I found this constraints link about the room size limit.
http://appwarp.shephertz.com/game-development-center/matchmaking-basic-concept/#constraints

Is there any way to save more than 2048 bytes data. As i am making turn based token matching game. I am saving all my tokens in a room properties. Because i want to make token sequence same for all players after shuffling. So i shuffle the tokens array and save it to room properties. but its occupies more than 5000 characters :( any suggestions ?
You can try using abbreviations for the property's key and value i.e., instead of using @{@"B":@"Banana"}; , you can use @{@"B":@"Ban"};.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...