Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

GameCenter Plugin Live! Leaderboards and Achievements!

Discussion in 'iOS and tvOS' started by prime31, Sep 6, 2010.

  1. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @zihyfw, try doing a Build from Unity then choose Replace. This will regenerate your Xcode project. If you still have errors after doing that post back with the errors.
     
  2. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    bumping...

    Cheers
    BRyan
     
  3. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @bpritchard, sorry about that, I must have missed your post. The only way to log out of Game Center is in the Game Center app itself. Many folks have opened up a feature request with Apple for the ability to log a user out and I recommend you do as well.

    <start opinion pice>That being said, I can't imagine they would actually do that seeing as how they really push the fact that iDevices are personal to a particular user. If they wanted there to be multiple users on a single iDevice they would have made a full OS-based user system with preferences, apps, etc for each user.
     
  4. mforsyth

    mforsyth

    Joined:
    Sep 29, 2010
    Posts:
    54
    Hello. I have my app in itunesconnect with the IAP status as 'Pending Developer Approval' well, if they would ask me I'd approve! But they haven't asked so I'm guessing I need to hit it from the app to kick it in to gear...(?)

    I think I have everything set up and it's time to test it. I made a test user, IAP says 'cleared for sale' and my app builds and runs on my ipod. Here's the code in the Start function
    Code (csharp):
    1. if( !PlayerPrefs.HasKey( "PURCHASED" ) ){
    2.     PURCHASED = false;
    3.     if( !StoreKitBinding.canMakePayments() ){
    4.         Debug.Log( "StoreKitBinding.canMakePayments = false");
    5.     }else{
    6.         StoreKitManager.purchaseSuccessful += onPurchaseSuccessful;
    7.         Debug.Log( "StoreKitBinding.canMakePayments = true");
    8.         if( !PlayerPrefs.HasKey( "firstLaunch" ) ){
    9.             PlayerPrefs.SetInt( "firstLaunch", 1 );
    10.             Debug.Log( "First Launch, checking if paid...");  
    11.             StoreKitBinding.restoreCompletedTransactions();
    12.             showBuyNowButton();
    13.         }
    14.     }
    15. }else{
    16.     PURCHASED = true;
    17.     startGameCenter();
    18. }
    in my console window I see the "StoreKitBinding.canMakePayments = false"
    I tried it logged into my real able to buy apps itunes account, and I tried it logged out of itunes store. It will ask me to log in and that's when I use the test account info right? Why can't my ipod caMakePayments? Here's the console output if it's anything worth looking at
    Code (csharp):
    1. -> force accelerometer registration
    2. -> applicationDidBecomeActive()
    3. 2011-02-20 23:18:46.600 birddashlite[3626:307] Received memory warning. Level=1
    4. WARNING -> applicationDidReceiveMemoryWarning()
    5. onTouchBuyNowButton hit
    6.  
    7. (Filename: /Applications/buildAgent/work/f724c1acfee760b6/Projects/../Runtime/Export/Generated/BaseClass.cpp Line: 2505)
    8.  
    9. 2011-02-20 23:18:52.335 birddashlite[3626:307] StoreKit: in the process of purchasing
    10. 2011-02-20 23:18:52.979 birddashlite[3626:307] StoreKit: error: Cannot connect to iTunes Store
    11. purchase failed with error: Cannot connect to iTunes Store
    12.  
    13. (Filename: /Applications/buildAgent/work/f724c1acfee760b6/Projects/../Runtime/Export/Generated/BaseClass.cpp Line: 2505)
    14.  
    15. -> applicationDidResignActive()
    What I see on my iPod when I hit the buy now button is a little apple alert window that says "Purchase In-app purchases are not allowed." my buy now button code:
    Code (csharp):
    1. function onTouchBuyNowButton(){
    2.     Debug.Log( "onTouchBuyNowButton hit");
    3.     StoreKitBinding.purchaseProduct( "com.levelcapstudios.birddashlite.upgrade", 1 );
    4. }
     
  5. bpritchard

    bpritchard

    Joined:
    Jan 29, 2009
    Posts:
    444
    Heya Prime,

    Thanks for the heads up on that, and i kinda figured that was the case.
    Cheers
    Bryan
     
  6. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @mforsyth, everything looks good except for a couple things: first up, don't call restoreCompletedTransactions without the user asking you to. It is basically only needed in the case a user bought your games IAP, got a new iPhone and put your game on the new iPhone. Usually a button tucked away in a settings screen is enough to handle those cases. Next up, o don't see any calls to request product data. Apple will sometimes reject you if you don't call it before showing buy buttons these days.
     
  7. mforsyth

    mforsyth

    Joined:
    Sep 29, 2010
    Posts:
    54
    ok so the first thing I'm doing now is
    Code (csharp):
    1. StoreKitBinding.requestProductData( "com.levelcapstudios.birddashlite.upgrade" );
    2. StoreKitManager.productListReceived += productListReceived;
    3.  
    4. function productListReceived(){
    5.     Debug.Log("productListReceived ");
    6.     showBuyNowButton();
    7. }
    8.  
    and here is what I'm seeing the xcode console.

    2011-02-21 15:14:59.226 birddashlite[3795:307] StoreKit: invalid productIdentifier: com.levelcapstudios.birddashlite.upgrade
    total productsReceived: 0

    Am I using the wrong product identifier, or is that "awaiting developer approval" still a problem?
    Seriously, how can we test it to get it approved if they wont turn it on first? Are we just testing the visibility of the button? I should send in a screenshot of the button before it's functional?
    From their site: "When you have tested your in app purchase and are ready to approve it and submit it for review, upload a screenshot below."
     
  8. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @mforsyth, here is what a few functional in app purchase test items look like in iTunes Connect:

    $Screen shot 2011-02-21 at 3.27.45 PM.png

    Make sure yours are all approved and green flagged before testing.
     
  9. mforsyth

    mforsyth

    Joined:
    Sep 29, 2010
    Posts:
    54
    I'm stumped. with the code I have posted before, I keep getting these errors.

    StoreKitBinding.canMakePayments = false

    2011-02-22 11:12:21.369 birddashlite[4152:307] StoreKit: invalid productIdentifier: com.levelcapstudios.birddashlite.upgrade
    total productsReceived: 0

    here's my itunesconnect page


    any ideas?
     
  10. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @mforsyth, did you double check all the usual suspects:

    - does your bundle ID in the Info.plist file directly match the bundle ID from the Apple website?
    - are you completely logging out of the Settings -> Store before testing?
    - are you using test users setup in iTunes Connect?
    - have you given Apples sandbox servers at least 24 hours to update?
    - are you deleting the app from you iPhone between tests?
     
  11. AmazingRuss

    AmazingRuss

    Joined:
    May 25, 2008
    Posts:
    933
    I have run into an awkward problem implementing GameCenter. It seems that if you cancel the login a few times, it disables Gamecenter permanently until the user goes and logs in to the GameCenter app.

    I am trying to figure out a way within my game to detect when gamecenter has been disabled, so I can direct them to the GameCenter app... ideally by launching it for them.

    Can anyone suggest a way to detect this condition?
     
  12. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @AmazingRuss, that is quite odd. There is no API method available that lets you know if it is enabled/disabled. Does the playerAuthenticationFailed event get fired? If it does perhaps you can just count the number of times it fires. That would only work if there was some set number of failed/cancelled login attempts before Game Center disables itself.
     
  13. AmazingRuss

    AmazingRuss

    Joined:
    May 25, 2008
    Posts:
    933
    Shows "playerFailedToAuthenticate: The requested operation has been cancelled." when it's disabled itself. Unfortunately, it also does this each time the player hits cancel.

    Trying to get my mind around what they were thinking here... makes sense that they wouldn't want GameCenter annoying people, but there should be some way to turn it back on in code. Sending them out to the gamecenter app to log in is going to lose at least half of them.
     
  14. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @AmazingRuss, maybe opening a bug with Apple might help. It definitely can't hurt for sure.
     
  15. AmazingRuss

    AmazingRuss

    Joined:
    May 25, 2008
    Posts:
    933
    I'm not sure they'd call it a bug. Seems to be more of a design flaw... or a failure on my part to comprehend the design.

    I'll keep thinking about it.
     
  16. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    I'd call it a feature request at the least. Apple takes feature requests pretty seriously so it's definitely worth sending them a note.
     
  17. greensquidsolutions

    greensquidsolutions

    Joined:
    Nov 2, 2009
    Posts:
    47
    Hi,

    I brought this the other day and have to say its awesome, very easy to use! nice one prime31 :)

    I have a little simple problem, I just wanted to know how to pull out the data to make a custom scoreboard?

    I'm using;
    // Sends a request to get the current scores with the given criteria. Start and end MUST be between 1 and 100 inclusive.
    public static void retrieveScores( bool friendsOnly, GameCenterLeaderboardTimeScope timeScope, int start, int end )

    However I'm not sure where the data is stored for me to be able to write it onscreen.

    Thanks again!

    Dan
     
  18. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @greensquid, glad to hear you are liking the plugin! All you need to do to get at that score data is listen to the following event (there is an example of it in the demo scenes GameCenterEventListener class):

    // Fired when retrieving scores completes successfully
    public static event ScoresLoadedEventHandler scoresLoaded;
     
  19. voidmaystorm

    voidmaystorm

    Joined:
    Jun 11, 2009
    Posts:
    89
    hi prime31,

    thanks a lot for the GCplugin, sure it saved me days (not only hours)...

    everything related to testing and sandbox accounts works fine, but in the debug-log from xcode i see occianisonally this problem:

    1.
    Code (csharp):
    1. <Error>: CGImageCreateWithImageProvider: invalid image size: 0 x 0
    i think this happens when i load the leaderboard, close it and immeditaley reopen it, for a few times.
    is there a way to "wait" till the apple-made-GC-gui has disappeared?

    i am testing on my ipad with ios 4.2.1

    any ideas how to get rid of these problem?
    actually, i dont think its a sandbox problem, it looks more like a timing between the viewcontrollers (?)

    any help warmly welcome ;-)

    greetings, thomas

    PS: the main symptom is that i cannot close the apple-GC-Gui showing LB or ACHV. anymore, after the problem occured in the log...

    in the meantime, i fixed it by forcing a minimum timelap between the point where unity regains control (after the leaderboard-view disappeared) and the possibilty to reopen the leaderboard - now its fine...

    but, the problem:
    Code (csharp):
    1. <Error>: CGImageCreateWithImageProvider: invalid image size: 0 x 0
    is still in the logs...
     
    Last edited: Feb 27, 2011
  20. voidmaystorm

    voidmaystorm

    Joined:
    Jun 11, 2009
    Posts:
    89
    one more tipp i had to find out the hard way:

    i use prime31´s EventListener script, and when loading a new scene, the GO "survives" (because of DontDestroyOnLoad), but the Listeners dont.

    Well - maybe all of you know that, but maybe one or two dont, so i thought i would share:
    The OnDisable() method is called on the listener-script when you load another scene, so the listeners were deregistered, and no single event (like reportScoreFinished() ) was fired - but my controller is waiting for a result (success or failure) before moving on...

    finally, i moved the += in the OnEnable() - the eventhandlers get registered again, everythings fine.

    hope at least one can use this info ;-)

    greets, thomas
     
  21. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
    Looking at buying this plugin, though I wish there was a cheaper version with just achievements/leaderboards (not that I think the price is too high... I just have very little money :p). How's testing with an unreleased game work? Leaderboards/achievements still functional? Or at least emulated to help ensure it'll work at launch?
     
    Last edited: Feb 28, 2011
  22. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @JTown, unfortunately we can't go much cheaper. Believe me when I tell you the plugin will save FAR more than $75 of your time even if you only pay ourself $5 per hour :) You can test everything with a debug build of your game before releasing it to the wild.
     
  23. greensquidsolutions

    greensquidsolutions

    Joined:
    Nov 2, 2009
    Posts:
    47
    Hi,

    Just released my new update with game center!

    Cave Runner 3D



    Thanks again for your awesome plugin!

    Dan
     
  24. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    Hey, everybody!

    I've got a leaderboard that I'm posting score data to successfully, but when I try to view it in GameCenter, it appears there but displays the text "Unable to Load" where the scores should be listed.

    Any idea what might be causing this behavior?
     
  25. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    I have something weird. Reporting scores is always considered successful, even when it shouldn't be. For instance, even with Wifi down, ReportAchievementFinished gets called after some delay and ReportAchievementFailed does not. Sure enough, the scores don't show up in Game Center (though that's not saying too much for the sandbox). Judging from the plugin code, Game Center simply doesn't report any error. Also, achievements are still retrieved without Wifi. Does Game Center perform internal caching and buffering? Right now I can only produce an error when submitting to bogus categories.

    By the way, is there a special reason why you're fetching achievements when the user is logged in, Prime31? Is it ok to remove that if you don't care about achievements?
     
  26. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Jasper, GameCenter does cache leaderboards when offline but they do not cache reported scores that fail. Try flipping your build to Release to get on the real servers and see if you get proper errors.

    You can safely comment out the achievement fetch if you arent using it. It is just there as a convenience so that achievements are loaded and ready for those who use them.
     
  27. synapsemassage

    synapsemassage

    Joined:
    Jul 27, 2009
    Posts:
    334
    Hi Prime,

    Does the <GameCenterBinding.authenticateLocalPlayer()> has a time out? For some days I have a problem that my game doesn't continue at authentication sometimes. In this situation it tries to authenticate forever. This happens randomly. I tested on two devices, both have this problem at the same time, so it seems to be a Game Center problem. Anyway a (a 20 sec. or adjustable) time out with throwing a failure event would be cool.
     
  28. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @synapse, the call to authenticate is entirely in Apple's court. It has no timeout and no way to cancel it. I would suggets just hooking up the success and failure events and going about your business as usual. When one of them comes back you can adjust your UI/state manager accordingly. Cautious coding in that manner will cover all possible outcomes so that your game can handle whatever gets thrown at it with regards to GC.
     
  29. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @greensquid, I just added Cave Runner to the games page. Looks great! Well done!
     
  30. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    Just out of curiosity, does anyone here know the difference between GameCenter saying "Unable to Load" for scores on a Leaderboard and it saying "No Scores Available"?

    I assume the latter simply means that no scores have been posted yet. But I can't seem to find any resource that describes the specific occurrences that would invoke the latter.
     
  31. dokosten

    dokosten

    Joined:
    Jun 9, 2009
    Posts:
    16
    Hey there Prime31. Love your work. =)

    However, I can't get the PostprocessBuildPlayer scripts to execute.. I downloaded the PostprocessBuildPlayer example project on Unity's homepage and it does not work either. I've tried it both on my Mac and my PC. Any ideas on what could be wrong?
     
  32. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @dokosten, you are now one of many with the postprocess issue. I think the round trip through the asset store ends up making PostprocessBuildPlayer* scripts lose their executable flag. Can you give it a check and see if that is the issue? A simple "chmod a+x PostprocessBuildPlayer*" will get it back.
     
  33. dokosten

    dokosten

    Joined:
    Jun 9, 2009
    Posts:
    16
    @prime31, I already tried chmod with no luck. Can't get any PostprocessBuildPlayer script to work at all. :\ I posted a bug to the Unity guys.
     
  34. samshosho

    samshosho

    Joined:
    Apr 12, 2010
    Posts:
    370
    Got the GameCenter plugin working and all.
    I have a question in regards to Multiplayer section of the plugin.

    Now, here is the scenario....
    I have a racing game already made, but not for multiplayer.
    So what are the steps that i need to take to actually make it playable over GameCenter using your plugin?

    Meaning, when i get a response from the eventlistener indicating that a match has been found, i should go ahead and fire the level.
    Within that level, should i have network view over the player's cars, for them to see each other ?

    Please bare with me, i am sure tons of people will benefit from this if we can get it going...
     
  35. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @samshosho, The GameCenter Plugin will get you the connection really easily with the showMatchmakerWithMinMaxPlayers which then fires the matchmakerFoundMatch as you have found out. It is really beyond the scope of the plugin itself what you actually do with the open socket connection you have at that point. There are entire books written about developing multiplayer games and the protocol that you come up with is very much app specific.
     
  36. samshosho

    samshosho

    Joined:
    Apr 12, 2010
    Posts:
    370
    I am not looking for details instruction as to how to create a multiplayer game,
    But a general concept of what goes after finding a match.
    You mentioned an open socket, so that means the GC server will start listening to data back and forth, but how is this data transferred between the connected devices? Is it through the sendmessagetoall call?
    If yes, then if three players are playing a game how do I identify which is which in terms of targeting one player over the other?

    If no, then am I correct if I say to use the old unity network multiplayer tutorial code, to transmit data?

    I am just trying to get a hint so I can look in the right direction, and not details of how to do things, that will be left for myself to dig through.

    Thanks in advance, great plugin by the way, works out of the box.
     
  37. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @samshosho, your 2 methods for sending data are sendMessageToAllPeers and sendMessageToPeers. The sendMessage* methods are *just like* the normal SendMessage function in Unity except they go across the network and require a GameObject as the receiver. The first will broadcast to all players and the second lets you choose precisely who receives the message. To track who is connected, you would listen to the playerConnected and playerDisconnected events which give you a playerId to identify the other devices (the same playerId that sendMessageToPeers takes).

    You cannot use Unity networking across a Game Center socket. They are two totally different beasts completely one going through Apple's servers and the other through Unity's.
     
  38. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    @miked and samshosho
    I am just wrapping up my Unity Networking implementation (using NetworkView.RPC() method) I am going to make a new controller class for the GameCenter which instead of NetworkView.RPC uses the GC sendMessage* methods. Hopefully it will be straightforward since I've already re-factored everything to work over RPC calls, and it seems like the GC sendMessage*() classes are pretty much the same, with the main difference being how to specify the receiver.
     
  39. samshosho

    samshosho

    Joined:
    Apr 12, 2010
    Posts:
    370
    Okay I understand that sendmessage is the same, but send message is delayed even within the same device, wouldn't it be even more delayed over a network?
    How can you run a multiplayer game. A reliable one that is, using sendmessage?
    Unless I am not getting the picture.

    You need to send data constantly for a network game to be playable, how is it possible with send message?
     
  40. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    samshosho, thanks! maybe others can share some insights too or correct if i'm wrong. But here is my take on it.

    -GameCenter is for max of 4 players.
    -Because it's a peer to peer network, It's inherently kind of variable and can be laggy sometimes
    -Because the data sending is inherently RPC-ish, you must design your app for what data to send and not to send.
    Very different than just throwing up a Network.Instantiate or NetworkView synchronize in normal Unity multiplayer networking.
    -I've only played a handful of gamecenter games myself, and they were not exactly "speedy"

    Very curious to see how it all works with the Prime31 plugin- I'm going to find out soon.
     
  41. samshosho

    samshosho

    Joined:
    Apr 12, 2010
    Posts:
    370
    i will try few things on my side as well, with send message and see how it goes. I just got my iPhone updated to 4.2.1 yesterday, so i can try a multiplayer scenario with my iPad at 4.2.
    Let me ask you something Mindlube,
    When you said you are using Unity RPC to use sendmessage, did you actually adjust the cs files to do so?
    Also, if you are making a multiplayer game, then you will need to send data every frame between the network players, i guess fixedupdate will be an ideal place to put the sendmessage ?

    let us know how it goes on your side... and i will do so as well...
     
  42. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    samshosho I'm not using Unity RPC and Gamecenter at the same time. I've got a NetManager class, then subclassed that for GameCenter multiplayer, for Unity RPC (for my users is Wifi networking) and then a 3rd subclass which is just a stub for playing locally vs. the computer.
    Also I'm not sending every frame. My game is turn based so I just fire off messages when the game state changes.
    OK good luck!
     
  43. samshosho

    samshosho

    Joined:
    Apr 12, 2010
    Posts:
    370
    looks like you got your hand deep into networking ,,, class and subclass ,, hmmmm i am not that good at C# anyway!

    i got all the way up to firing up the multiplayer level on both devices, once a match is found. Which is not bad so far !
    i also got the message going, that sends data to both devices, which results in two cars moving, each on a device and the second car on each device corresponds to the networked device. in other terms, you are actually racing against each other. However...

    When i got the message going, i started with one sendmessage, things were still fine, but i need more than one send message, since you can only send one set of strings through. Once i sent two or more sendmessages, the game almost froze!
     
  44. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @samshosho, you should be able to call sendMessageToAllPeers or sendMessageToPeers every frame with no issues at all. It is important to come up with a good protocol for your communications though due to the limitation of only being able to send strings. You can encode all kinds of stuff into a string specific to your game that way you only need to send once every frame or so.
     
  45. samshosho

    samshosho

    Joined:
    Apr 12, 2010
    Posts:
    370
    Prime31,
    Can you send float or int through the sendmessage , or does it have to be string ?
    I dealt with converting the float or int to string, then back again from string to float or int.
    But was wonder if there is a shortcut.
     
  46. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @samshosho, you are stuck with strings do to some limitations present. You can certainly encode ints/floats into a string than decode. Making an efficient protocol is a good idea for sure. Just encode the data you need into a string on the sending end and then unwrap it on the other end.
     
  47. samshosho

    samshosho

    Joined:
    Apr 12, 2010
    Posts:
    370
    I think we both posted a reply in about the sametime!
    I was thinking of doing what you just said in terms of packing everything in one string then unpacking on the other end.
    I saw that you used something called minijson and it's included in your plugin.
    Is that safe to use, to parse string into floats?
    What call did you use to parse strings into words? I guess that's what you might have used it for?

    When you talk about protocole and such, you lose me man!
    My background is strictly unity scripting! ;)
     
  48. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @samshosho, I would personally make my own simple protocol. You could use JSON but it is a bit heavy for multiplayer network packets. Here is a simple pseudo-code example that sends and receives a Vector2:

    Code (csharp):
    1. // grab touch input, serialize and send it over to the other device
    2. Vector3 touchPoint = new Vector3( touch.position.x, touch.position.y, 10 );
    3. Vector3 fixedTouch = Camera.main.ScreenToWorldPoint( touchPoint );
    4.                    
    5. string touchData = fixedTouch.x + "," + fixedTouch.y;
    6. sendData( "SomeGameObject", "touchMovedToLocation", touchData, false );
    and here is the same object being received on the other end:

    Code (csharp):
    1. // param is in the form "x,y".  Deserialize then move the object
    2. string[] parts = param.Split( ',' );
    3.  
    4. float xPos = float.Parse( parts[0] );
    5. float yPos = float.Parse( parts[1] );
    6. Vector3 pos = new Vector3( xPos, yPos, 0 );
    7. someTransform.position = pos;
    The idea is that you can send whatever you want in a simple, serialized bundle.
     
  49. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    Speaking of which, another alternative to JSON is ServiceStack.Text 's JSV http://www.servicestack.net/mythz_blog/?p=176
    It's kinda like JSON except faster and smaller. I had to rip out a few classes to remove XML dependencies. But so far it's working great for serializing Dictionary<string,string> and List<string> over RPC calls.
     
  50. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    JSV looks interesting but it seems like it is heavy for a network protocol where specifics and efficiency are paramount. It also appears to have quite a few calls to Reflection.Emit which is a no-go for AOT compiled code.