Photon Cloud WP7 LoadBalancingClient demo

Options
danglingneuron
edited February 2012 in DotNet
I I just started looking at Photon when I heard it now supports WP7 development.

First of all let me say.. this is UberKool stuff :)

Photon Cloud seems the best option for me since I have a rather simple game to implement multiplayer functionality with. I have spent some time with the LoadBalancingClient demo and have some questions:

Q1. LoadbalancingClient Creates local player in its constructor, why are we trying to create local player in DemoClient constructor as well? It just tries to create the local player two times.


Player has a CustomProperties field and AllProperties (which merges custom and wellknown properties). well known properties currently contains PlayerName.

Q1. When we have custom properties field, why did the DemoClient chose to send player name & color as an event (SendPlayerInfo) instead of just adding color to custom properties. Since player's properties are sent that will automatically send name & color.

Q2. In DemoClient OnEvent function - under Eventcode.Join: why are we not setting received playerproperties in the new demoplayer properties, the received properties may have more than just name:

Hashtable actorProperties = (Hashtable)photonEvent[ParameterCode.PlayerProperties];
string actorName = (string)actorProperties[ActorProperties.PlayerName];
this.realtimePlayers = new DemoPlayer(actorName, i, isLocal);


Q3. In CreatePlayer function playerProperties parameter is received but nothing is done with it, why is it not being set in teh new player's properties?

Q4. OpCreateRoom and OpJoinRoom expects a player properties paramater where one can send player.AllProperties BUT OpJoinRandomRoom doesnt take player properties parameter, I think that method should also take player properties?

Maybe its due to the scope of the demo code? However I need to know if I am going in the right direction with this. I definitely see why player position is sent as event since that is an event that will keep firing at regular intervals, but name and color should be just sent via properties.

Q5. I do see where the OpLeaveRoom is called when player exits game, is there anything else required for proper exit when leaving game/room.
There is an OpLeaveLobby function which hasnt been used in demo so if Client.State == JoinedLobby and player backs out, are we supposed to call OpLeaveLobby ?
Are we supposed to call Client.Disconnect in any case or is that completely handled by the base classes?
Just trying to make sure I cleanup/exit properly in all these cases.

Very excited about all this and hopefully will have my WP7 game "Air Soccer Tour" multi-player enabled.

@danglingneuron
danglingneuron.wordpress.com

Comments

  • Tobias
    Options
    Q1: Most likely we just missed the doubled creation of a LocalPlayer. There's no specific reason.

    So far, we only "ported" the Realtime Demo to make it run with loadbalancing. Aside from changing the way the rooms are found and joined, the demo is compatible with the older clients and those don't have custom and "well known" properties and use their own players list. We plan to revamp the demo into a newer variant but couldn't do it yet. Q1 to Q3 are due to this porting. I have to talk to my colleague about that ;)

    Q1: Good point about name and color. In short: It's a porting fragment.
    Q2: This should be followed by a CacheProperties. LoadBalancingClient.cs handles this correctly.
    Q3: Again. It should cache the properties.

    Q4: Ah. True. Yes, there could be such an override.
    You are absolutely right, seeing events as something quickly changing and properties as less frequently "base information". Updating the demos is on our todo list for a longer time.

    Q5: OpLeaveRoom will bring you back to the Master Server where it joins the lobby again (by default). You don't have to do anything else, aside making sure you don't keep references or try to keep actorIds or anything.
    OpLeaveLobby is not a really useful operation but available. It could be used if you want to keep the connection but explicitly don't want the room-list updates anymore. This is a rare case and not covered by the demo.

    Q6: Disconnect closes the connection. If that's needed, call it :)
    It's up to your game. Maybe you got a singleplayer mode, too. Then you want to be able to end multiplayer.



    > Very excited about all this and hopefully will have my WP7 game "Air Soccer Tour" multi-player enabled.
    Us too :)
  • Thanks for the response.

    I also had to remove the whole code under Event.Join in demo client since thats already handled in base class.

    I have a basic multiplayer implementation ready. Its not even alpha-ready at this point but Its very exciting to see the game running from two WP7 emulators with communications routing through Amsterdam :) I have lots of syncing issues that I need to read up strategies on, my first try at a multi-player game.


    Is there any chance the base class library i.e. Photon3WindowsPhone.dll can be recompiled for Windows 8 OS?

    As part of the Microsoft First Apps contest (https://buildwindowscontest.com) I have ported Air Soccer from WP7 to Windows 8 as well. It would really be awesome if two players could play between a WP7 phone and a Windows 8 tablet.
  • Tobias
    Options
    Thanks for the pointer!
    Resubmission ends on February 17??
    That's tight.

    Get our DotNet SDK: Photon-DotNet_v3-0-1-0_SDK.zip here: https://www.exitgames.com/Download/Photon
    It should run nicely on Windows 8.

    Let us know if there's some hurdle!
  • Using .net SDK may not be anoption for two reasons:

    1. The contest is for Metro Apps, Metro Apps are not desktop apps and dont have access to the full .Net. Metro.Net is a subset just like silverlight. So someone needs to recompile the Photon3WindowsPhone.dll source code in a metro project. I can do that if you guys are interested?
    2. I am using Photon cloud load balancing sdk. the dotnet SDK will have me setup my own server right?

    The deadline is close but I already have the multiplayer stuff done for the most part for windows phone 7 - just a few minor glitches to take of. I ported this game to windows 8. And I decoupled the components well so I will just a need a recompile of my "multi-player" logic project and "photon-sdk". Thats all.

    Contact me on imran@danglingconcepts.com if you guys think its worthwhile. Infact I have an interview with MS coming up on 18th regarding this.
  • Tried sending you private message but couldnt.
  • We will fully support you and Windows 8.