How to create new room

Hi,
I am new to photon. I just look demo project v3 code for android. I have live photon cloud instance APP_ID. In the DemoService class, i changed the following code:
From: peer.connect(settings.server, "Lite");
To : peer.connect(settings.server, my_app_id);

After that, demo project get connected to the cloud , But how to create the new room with identifier and How to get list of rooms available and players list in the room. And how to join in that room.

Please help.
Thanks in advance.

Comments

  • We are in the last stages of releasing a new SDK for Android, which will feature Cloud support. This makes it easy to get rooms listed and created.
    I suggest you give us a few days more and meanwhile use a local server with the Lite logic. It's a bit different but if you concentrate on in-room stuff with that first, you will be able to switch to the cloud quite easily.
    If that's not feasible for you, let me know and I might push a preview SDK with LoadBalancing.
  • My Project is complete depend on load balancing stuff. Both ios and flash version of the project was finished. If you push the preview sdk for android, that will be help me.

    Thanks in advance.
  • Hi,
    Thanks for alpha release.
  • Hi.
    I am a bit confused.
    In that thread you are stating, that you are using the Android NDK Client: viewtopic.php?f=8&t=1525, while in this thread here it looks more like you are using the Android Java Client SDK.
    Which one are you using or do you use both?
  • At first, i used android java client sdk. But that sdk seem there is no load balancing stuff. so i currently i downloaded the Photon-AndroidNDK_v3-0-1-0-PreAlpha_SDK.zip. i think this sdk had this feature.

    Tobias replied that, he might release preview SDK. So I thought "Photon-AndroidNDK_v3-0-1-0-PreAlpha_SDK.zip" is the preview sdk and so i get look into that.

    My requirement is, I need to get the list of rooms and list of users in particular room and I need to create new room.

    Please tell which sdk i need to use. Is android java client sdk had load balancing feature?

    Please help. sorry for my english.

    Thanks.
  • We offer two different Client SDKs for Android:
    The Photon-Android Client SDK and the Photon-AndroidNDK Client SDK. the first of these two is for developers, who want to develop their game in Java, the second one for those, who want to develop it in C++.
    You should choose between them depending on the language, which you prefer to use for whatever reason.
    These to SDKs are totally unrelated and the recent AndroidNDK Client release of course is not a preview for the upcoming Java client SDK release.
    We support Java for Android for more than a year now and the Client SDK can in gerneral be considered stable. However the LoadBalancing client API has just been added to it recently and we are in the final steps of working on it and will release a new Android Java client SDK in the next days.
    The Support for C++ with the AndroidNDK has just been added this month and its declared a PreAlpha release for now, as we are still working on full support of the NDK platform. However the current release for NDK already comes with full support for LoadBalancing (which is due to the fact, that it shares the according sourcecode with the other C++ Client SDKs for other platforms).
  • Thanks for clarify my doubt.
  • Hi,
    I waiting for loadbalancing java client SDK. My project completely depend on loadbalancing stuff. Could please tell, when you going to release it.
  • I just uploaded the Photon v3.0.0.0 RC1 SDK for Android Java.
    Download it here: http://www.exitgames.com/Download/Photon

    It's a RC1, so let us know if we need to fix something.
  • Thanks for this release. I will check, if i have any doubt, i will ask.
  • Hi,
    In the Photon-Android_v3-0-0-0-RC1_SDK demo project, after connected to server. when click on "create game", dialog is not shown . After that i checked the code, "b.show()" is missing in the code . Please add it.
  • Hi, i have a problem.

    In Photon-Android_v3-0-0-0-RC1_SDK demo project, I added my appid to the run() method in DemoClient class.
    this.connectToMaster("MY APPID", "v1.0", "PlayerX");
    

    * After that i can able to create new room, but at first i didn't see any rooms (Already room are created through iphone project). The room which is created my me is not shown in iphone demo project. I run the same android demo app with the above changes, it shows the room name which is created by another android demo.

    In iphone demo project, i added same appid but It shows more rooms except room which is created through android app. What is i need to change in code?

    * And my second doubt is, how to connect with local server, I added following code to connect to internal server,
    this.setMasterServerAddress("My_IP:4531");
    this.connectToMaster("MY APPID", "v1.0", "PlayerX");
    

    But there is no connection established to local server.

    Please help,
    Thanks in advance,
    dhatchina
  • 4531 ist the default tcp port, used by Photon. Are you actually using TCP? If you have not explicitly stated so in your client code, then you would use udp, which is the default and the Photon default port for udp is 5055. Maybe this is the reason, why you can't connect.
  • * In live cloud, room created through iphone is not shown in android demo project why? I only change the following code in that project,
    this.connectToMaster("MY APPID", "v1.0", "PlayerX");
    

    thanks,
    dhatchina
  • Can you see the rooms, which have been created by other Android clients?
    Are you sure, that you set exactly the same appID and version for Android like for iOS?
  • Sorry it's my mistake, app version in android client and ios client is different. Now i changed it, currently room list get updated.

    Thanks for ur reply,
    dhatchina.
  • In local server, i need to change gameserveraddress or masterserveraddress ?. Currently I changed the masterserver address to MY_IP:5055 , but no connection established. In logcat following message is shown,

    03-26 18:25:56.974: INFO/System.out(3017): /192.168.86.99:5055 - Connection refused
    

    what is different between gameserveraddress & masterserveraddress. where i can find the documentation for Loadbalancing api?
  • You do not need to nor should you set the game server address at all, as the client LoadBalancing logic will automatically use the one, which it is getting back from the master server and connecting to another game server, than the one, where the master server sends your client to, will lead into undefined behavior, even, if you specify a legal game server address.
    The game server address actually is considered an internal value and an implementation detail of the LoadBalancing logic and you should not even be able to set it via the API, without modifying the loadBalancing code first.

    You should also not set the master server address with setMasterServerAddress(), as this setter is declared protected, meaning, it does not belong to the public interface (which is, because otherwise you could change it, while being connected, which would again be undefined behavior).
    Instead please provide the master server address, when creating the instance of class LoadBalancingClient.

    You could also just call connect() instead of connectToMaster() and you will still connect to the master.

    Are you able to connect to your local server with the iOS client? If yes, then it should also work with the Android client, as far as I can tell from your code.
    If you are not able to connect to it with the iOS client, either, then please check, that you have started the LoadBalancing instance on the server and that you have NOT started Instance1, check, that your servers firewall and router have opened port 5055 and 5056 for udp-traffic and that you have set the the public addresses of the game servers in their configs to 192.168.86.99 (not having done the last one should not prevent your clients from connecting to the master, but it will prevent them from connecting to the game servers).
  • ok i will check.

    thanks.
  • Hi,
    ios version of game is already in live. Yesterday in live, only 10 rooms are created through ios, those 10 rooms are shown in demo android load balancing project.

    But today, 37 rooms are created in ios version of game, i run the same android demo project, but it crashed due to outofmemoryerror. In logcat, following message is shown.
    03-27 10:36:16.835: ERROR/dalvikvm(359): Rejecting allocation of 1634885988-element array
    03-27 10:36:16.835: WARN/dalvikvm(359): threadid=17: thread exiting with uncaught exception (group=0x4001b188)
    03-27 10:36:16.835: ERROR/AndroidRuntime(359): Uncaught handler: thread Thread-9 exiting due to uncaught exception
    03-27 10:36:16.835: ERROR/AndroidRuntime(359): java.lang.OutOfMemoryError: array size too large
    03-27 10:36:16.835: ERROR/AndroidRuntime(359):     at de.exitgames.client.photon.TConnect$TcpConnectionThread.run(TConnect.java:262)
    

    I think, It is coming from photon-android.jar. Please tell how to fix it.
  • I have been in contact with your colleague Krishna and sent you an updated lib.
    This is a TCP issue which is fixed now.
    The demo on the last SDK accidentally uses TCP, I think. You should switch it to UDP. In LoadBalancingClient.java, find this code:
    super(ConnectionProtocol.Tcp);
            this.m_clientId = ++m_clientCount;
            this.setMasterServerAddress("app.exitgamescloud.com:4530");
    

    this should be replaced with:
    super(ConnectionProtocol.Udp);
            this.m_clientId = ++m_clientCount;
            this.setMasterServerAddress("app.exitgamescloud.com:5055");
    


    so it's really just 2 minor changes.
    this sets your game to UDP and this should work.
  • Ok, looks like I used the old version of Photon v2.6 .Why it changed so much between these two version, I mean the method arguments list.
  • A change like this can always happen. After a while, it doesn't make sense to support outdated API methods anymore, as things evolve. If we kept every API intact forever, it would become really big and confusing.
    Also, the switch from 2.x to 3.x includes a major release, which always is used for bigger API changes (to clean up).
    Sorry you stumbled over this.
  • Hi,

    i created a room with custom property by following code:
               HashMap<Object, Object> gameprop = new HashMap<Object, Object>();
    
               gameprop.put("room", "themeroom");
       
               this.opCreateRoom(roomname, true, true, (byte)0, gameprop, null);
    

    For joining Random room,
                     HashMap<Object, Object> customProperties = new HashMap<Object, Object>();
    		           customProperties.put("room", "themeroom");
                     this.opJoinRandomRoom(customProperties, (byte)0);
    

    But I can't join into room with similar property. I joined into some other ramdom room with no custom property. Please help how to fix this.
  • It seems to be an error in LoadBalancingPeer.opJoinRandomRoom().
    The line:
    opParameters.put(ParameterCode.Properties, expectedRoomProperties);
    
    should be:
    opParameters.put(ParameterCode.GameProperties, expectedRoomProperties);
    

    Then it should work.
    Thanks for pointing me to it. It's going to be fixed in the next release.
  • Also, there might be a server error: Please set the expected number of players to 0 for JoinRandom and try that.
    We look into what's happening here.
  • Thanks, Now joining random room works fine in android. Room which created by android sdk is visible in flex sdk with custom property, but can't join into room through randomroom call in flex. we are also provided the expected room properties, but i can't join into the expected room in flex.

    Code for join room in flex
    var dic:Dictionary = new Dictionary();
    dic["room"] = "themeroom"; 
     var gp:GameProperties = new GameProperties();
     gp.customProperties = dic;
     PhotonPeer.getInstance().opJoinRandomGame(gp);
    

    please help to fix this issue.
  • We're on it. I'm in direct contact with your colleague Krishna.
  • edited July 2012
    Hi,
    Currently i'm using new sdk (i.e Photon-Android_v3-0-0-3_SDK) . I found the following problem

    I created room (i set maxplayers to 8) with following code:
    HashMap<Object, Object> gameprop = new HashMap<Object, Object>();
    gameprop.put("room", "themeroom");
    String[] list = {"room"};
    this.opCreateRoom(roomname, true, true, (byte)8, gameprop, list);
    

    For joining ramdom room
    HashMap<Object, Object> gameprop = new HashMap<Object, Object>();
    gameprop.put("room", "themeroom");
    this.opJoinRandomRoom(gameprop, (byte)8)
    

    I can't able to join into expected room, it says "No match found". If i change maxplayers parameter to zero for create and join operation of room, then joinrandomroom operation works fine ((i.e) I can able to join into correct expected room). Why i can't able to join into expected room when expectedmaxplayers = 8?

    how to fix this issus. please help.
  • The max players problem is a known server-side issue: the server does not match the custom properties correctly anymore, if max players are set to anything else than the default.

    Afaik Tobias has sent Krishna a new server SDK, which fixes this issue.
Sign In or Register to comment.