Search Unity

Announcement: SmartFox API 1.2 released - now with iPhone!!

Discussion in 'Multiplayer' started by Thomas-Lund, May 17, 2009.

  1. Thomas-Lund

    Thomas-Lund

    Joined:
    Jan 18, 2008
    Posts:
    465
    Hi everyone,

    A real pleasure to be able to announce the last and greatest Unity API for SmartFoxServer.

    This one is especially cool since it adds fully featured Unity iPhone Advanced support out of the box!

    Write you game once, run it on all platforms that Unitty supports (except the Wii).

    There are also 3 iPhone tutorial ports (didnt do a Island Demo replacement, so 3 will do). So play tic-tac-toe on your phone vs. Unity in a webplayer.

    Download link is here:
    http://www.smartfoxserver.com/labs/API/

    The changelog is pasted below:

    * iPhone support - full featured and cross platform without changes to client
    * API are fully aligned with the latest Actionscript 3 version, shipped with SmartFoxServer PRO 1.6.6
    * Bug fix in handling string message receiving as reported on forums
    * SendXtMessage now has reworked API to take hashtables for json/xml and arraylist for string Cross platform compatible protocol for string sending
    * Fixed Entities decoding/encoding not properly initialized (as reported in support board)
    * Implemented new Contains method on JsonData (not present in original API)
    * Added new SwitchPlayer method from SFS 1.6.6
    * Added CheckRoomList and CheckJoin methods on API methods
    * Added LOTS of checks in SysHandler for if a room is in the roomlist before trying to call methods on it. Prevents null pointer exceptions and gives user a nice warning in the console
    * Catching more exceptions on event handling, and giving user readable message on the console
    * Printing exception message on console when exception thrown in http communication
    * OnExtensionResponse documentation now shows host to cast response to the 3 different data formats
    * New set of CreateRoom methods using NewRoomDescriptor class instead of hashtable
    * Added 2 new methods to the queue mode - one for querying number of events in queue, and another to process a single event only.
    * Documentation for SetRoomVariables was still AS3 syntax. Now rewritten to C# + fixed error in text Extended RoomVariable constructor to also include a 3 parameter version
    * *Major* reorganization of the main client code using #region into a more logical and usable structure (only structural changes)
    * Made isGame truly optional + other validation checks in room creation

    /Thomas
     
  2. Thomas-Lund

    Thomas-Lund

    Joined:
    Jan 18, 2008
    Posts:
    465
    Please note!!!! (Important enough to warrant a separate post)

    This API version breaks code that uses SendXtMessage using the string/raw protocol!!!!

    So you you previously coded up a game with this using string/raw, you will have to re-implement that part. This was done due to me having broken compatibility with the other APIs.

    The change is that previously you gave a Hashtable to the method and it would send a string of "key=value" to the server. Now the method takes a ArrayList (when using string/raw as type), and sends the list values only - 100% in line with the other APIs.

    Sorry about this one if you have extra work due to this.

    /Thomas
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Great release

    The official newsletter already pointed towards that but the full list looks even better :)
     
  4. Pia

    Pia

    Joined:
    Feb 16, 2009
    Posts:
    78
    Hi Thomas,

    I used version 1.1 of your API for a game in Unity. All network messages are sent in the raw/string format. Now I understand that your API breaks existing code, because formerly the sendXtMessage took a Hashtable object and now it takes an ArrayList object. So I changed my code accordingly and ran into a strange error:

    My game server receives messages which look like this:
    cmd%roomID%System.Collections.ArrayList

    So instead of sending the entries of the ArrayList as Strings, the typeof() is sent. Is this a possible bug or is the bug located in my own code? I would be very grateful if you could check. Thank you.


    Edit: Ok, I am quite sure that this is a bug in the .dll. I scanned through the source code, which was contained in the download and spotted the following code snippet:
    Code (csharp):
    1. foreach (Object param in paramObj)
    2.                     hdr += paramObj.ToString() + MSG_STR;
    This should be
    Code (csharp):
    1. foreach (Object param in paramObj)
    2.                     hdr += param.ToString() + MSG_STR;
    shouldn't it?
     
  5. Thomas-Lund

    Thomas-Lund

    Joined:
    Jan 18, 2008
    Posts:
    465
    Hi

    Wow!!! Brown paper bag of shame coming up!!

    Seems variable expansion has given me the wrong variable.

    Definitely a bug, definitely my fault - I'll try to get the SFS guys to release a 1.2.1 ASAP.

    Thanks a bunch for reporting!!!

    /Thomas
     
  6. Thomas-Lund

    Thomas-Lund

    Joined:
    Jan 18, 2008
    Posts:
    465
  7. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    I just wanted to drop a message to thank for the great work done on it.
    Enjoyed a little round SFS local server iphone tic-tac-toe fun today with my girlfriend and it was nice to see how simple SFS makes this kind of games and from experience I know how easy and powerfull SFS Pro is when it comes to server side extension
     
  8. Thomas-Lund

    Thomas-Lund

    Joined:
    Jan 18, 2008
    Posts:
    465
    Anytime anytime, and thanks a bunch.

    I'm super happy to see so many people playing with it and finding it useful.

    I would definitely love to hear from you and your projects (you can always PM me to keep it private if you want), or post a little message here or on the SFS forums. Simply to see what its being used for and congratulate you.

    /Thomas
     
  9. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Definitely plan to share it as soon / once it has happened :)
     
  10. Matroblend

    Matroblend

    Joined:
    Jan 30, 2009
    Posts:
    134
    Thomas,

    This is great, I did some testing with Smartfox it was very easy to understand and now that it supports IPhone it is even greater.

    Thanks
     
  11. ClamsTheCat

    ClamsTheCat

    Joined:
    Apr 16, 2008
    Posts:
    57
    Sweet I will give this a try!
     
  12. junkotron

    junkotron

    Joined:
    Feb 22, 2009
    Posts:
    158
    I've got the demos up and running but realized it's all in C#. This may be a dumb question but how would I tie this in with JS?
     
  13. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    the same way just ensure that all the c# core code is in the plugins folder and that you use import instead of using :)
     
  14. junkotron

    junkotron

    Joined:
    Feb 22, 2009
    Posts:
    158
    that seems so simple that i'm reluctant to believe you! :D
     
  15. junkotron

    junkotron

    Joined:
    Feb 22, 2009
    Posts:
    158
    that actually worked out nicely. I'm getting a bunch of warnings about file names not matching their class names but it's actually working just fine. Thanks!
     
  16. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    those warnings should be taken serious, because you can otherwise get into serious problems on the build at worst
     
  17. junkotron

    junkotron

    Joined:
    Feb 22, 2009
    Posts:
    158
    I'm not really sure how to address this. The class names and the files names are actually the same but I keep getting this error for all the files:

    Couldn't load the script "User" because its file name doesn't match the class name.
    Please make sure the file name of the script is the same as the class defined inside it.

    Not sure what else to do. Any suggestions?
     
  18. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    file is user.xxx but class is User for example
     
  19. junkotron

    junkotron

    Joined:
    Feb 22, 2009
    Posts:
    158
    I checked all that... file name is User.cs, public class User.

    I'm getting the same warning for, say, Room and that actually looks like it's working and returning all the methods within.
     
  20. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    are you sure you use the right thing?

    you shouldn't have these cs files present at all, you should just have the assembly that you drop into the plugins folder and fine.

    the problem oyu get there in the warning comes from the namespaces
     
  21. junkotron

    junkotron

    Joined:
    Feb 22, 2009
    Posts:
    158
    The warnings are also from the files I downloaded from SFS site, straight off the Examples-iPhone > SFSTutorials downloaded from here: http://www.smartfoxserver.com/labs/API/

    All I did was download it, opened up the connection.unity scene in any of the tutorials and all the warnings are there.
     
  22. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    the iphone example is for unity iphone, which I doubt we are talking about here right (as we are in the multiplayer networking board not iphone development which is more appropriate for iphone related things due to the distinct restrictions)

    if you are on the iphone then yeah you could ignore the warning. if you are on the desktop I would though recommend to use the regular unity examples
     
  23. junkotron

    junkotron

    Joined:
    Feb 22, 2009
    Posts:
    158
    haha - probably should have said I'm on the iphone. thanks for the help though!
     
  24. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    I see

    The warnings comes from the namespaces.
    Its normally said that they don't work but it seems as if the recent versions became less picky (originally this warning was an error when I remember right)
     
  25. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    So, I thought I would finally have a play of SFS, and downloaded the free server version and installed it (and latest java runtime) on my public facing windows server and then tried running the latest examples...

    None of them will connect to my server via my public IP with the standard (or any port)...

    I cant see anything happening in my server console window and the examples spit back saying cannot connect

    Unity 2.6.1, SFS Lite 0.9.0, API v1.2.4

    Any ideas?
     
  26. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    Ok, I just installed SFS Lite on my dev windows server inside my office, and ran it with a local IP of 192.168.1.20, post 9339.

    I then changed the example scripts to connect to that IP and port and again, no connection from any of the examples :(
     
  27. oxl

    oxl

    Joined:
    Nov 21, 2008
    Posts:
    325
    Hi,

    AFAIK the Unity examples are only working with a SFS Pro Version installed.

    --
    oxl