Search Unity

Third Party Photon MMO Sample available

Discussion in 'Multiplayer' started by tobiass, Dec 15, 2009.

  1. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    The modified Island Demo that we showed at the Unite 2009 is finally available for everyone. It shows how Photon can be used on the server side and of course also for the Unity clients.

    The pre-built demos are only usable on a Windows machine so far, as they connect to localhost (and Photon is Windows only). But you won't have a hard time to build them against another IP and run Photon there.

    I hope the readme is enough to get you started. We plan to extend this demo, add features and documentation and we are open for feedback of course.

    Get the MMO Sample on our site:
    http://photon.exitgames.com/download/photon

    Our next steps are: enable you to start a Neutron Trial via webpage, forum and of course the next version of "Lite" for Photon which becomes more flexible and offers more property-features.
     
  2. Matroblend

    Matroblend

    Joined:
    Jan 30, 2009
    Posts:
    134
    Tobias, Thank you now if the weekend would just get here so I can get some time to test it out.
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Very nice :)

    Range based updating will surely help quite a few users :)
    I consider myself one of those two and with the "unlimited trial" aka the $100 for 50 CCU license, I'm really tempted to take the idea to Photon and potentially this range sync layer once I can focus on it again.
     
  4. Deleted User

    Deleted User

    Guest

    is this just used for the networking?
     
  5. Discord

    Discord

    Joined:
    Mar 19, 2009
    Posts:
    1,008
    Photon is a server backend solution for Unity. So yes, it's for networking.
     
  6. ProtonOne

    ProtonOne

    Joined:
    Mar 8, 2008
    Posts:
    406
    Agreed, looking forward to checking this out.

    I tried downloading an SDK last weekend, that seemed to connect to Neutron or something... couldn't quite figure out what was going on there since I never started a server. Neutron itself confused me too.

    From what I could quickly tell, it wouldn't be possible to use unity's physics engine server-side, so each client would need to update it's own version of a physical world. Not such a big deal.

    I also wasn't sure if communication could be handled in an authoritative configuration. Anyway, it seems like a cool product.
     
  7. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    you can handle it anyway you want, photon just transfers data, what you do with it is up to you generally.
     
  8. zumwalt

    zumwalt

    Joined:
    Apr 18, 2007
    Posts:
    2,287
    Point in fact, Photon rocks, it is very solid and has some of the most useful tools I have ever used. Their staff are very friendly and highly knowledgeable on top of that they have the fastest turn around I have seen in a long time when you email them, they get back with you extremly quickly. So far I say they have some of the best CS around, not to mention the product is rock solid. You really can't beat it for the price and what you get. It takes no time to setup and although they are still working on making the documentation easier to read, it is really straight forward, not a lot of mucking around in hyperspace if you ask me :) (an no they are not paying me for this post :))
     
  9. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    In short: Photon and Neutron are two different products and while Photon is self-hosted and has a server-side framework to easily integrate game logic, Neutron is a hosted service with many out of the box features to do non-realtime multiplayer games and lobbies.
    The samples in the Photon SDKs should not need Neutron. Most likely the sample tried to access our semi-public Photon server. Semi-public as in: it's not a service with perfect up-time but a server we will update and modify to run the samples on it. Depending on our luck, we updated the server when you tried to run the samples.


    That's a good point. So far we only implemented smaller demo projects and used box2d on client and server side. Maybe we can experiment with Unity's physics in the future.

    Authoritative or not is completely up to you. The server's basic logic is there and the API should enable you to do anything else.


    zumwalt: Thanks! You make it sound too good to be true.
     
  10. Deleted User

    Deleted User

    Guest

    so basicly if i want to stress myself out considerably i could fire up vs c# 2008 express and could make my own networking library and plug it into unity. The only question I have and I apologize if this is off topic but how is the info sent? All the small scale net apps ive made used a bitsream reader and righter and a network stream with all the info sotred in a byte array i guess. are their any basic tuts on this not that im planing on it, just wouldnt mind messing arround
     
  11. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    thats what any networking does actually.
    How you structure it is up to you, how optimized it is too.

    I personally prefer to ivnest into flexible and performant server backends (as Photon for realtime and SFS Pro for turn based) if there are any, as they save you a large amount of time for the development of the base itself but also on the longer run as these plugin / component approaches make it possible to easily change and expand functionality without breaking others while still running performant
     
  12. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    birvin: dreamora is right. Anything that goes over the net has to be in byte-array form. Where SFS encodes into a xml (-alike) structure, Photon and Neutron use a byte-protocol to encode types but both are simply bytes to be sent.

    Besides: It's not really public (again, we don't have a proper SDK yet) but the way you program Photon will soon be available as IIS "component" (don't know the proper naming, maybe it's called "application" but you get the idea). This means you could use your Photon "Lite"-derived application and run it in IIS as turn based solution as well. As extension for Neutron or stand alone but fully HTTP.

    If there is serious interest in a turn based / HTTP approach, message me and we will hurry up.
     
  13. Deleted User

    Deleted User

    Guest

    its not realy a problem for me. It just may be an off project when im bored. I take it though either way you cannot use unity client then other server?
     
  14. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    urgs http requests ...
    TCP is definitely the lowest I will go for any kind of game that has "continues communication".
     
  15. Deleted User

    Deleted User

    Guest

    not to sound like a complete idiot but what do you meen http requests thats for web broqsing i thought. Is that for web browser games?
     
  16. zumwalt

    zumwalt

    Joined:
    Apr 18, 2007
    Posts:
    2,287
    GETS and POSTS are nothing more than strings passed to and from web servers that interpret them, all these network systems do is act as a web server basically and interpret the data over the internet ports. You can actually post to web pages and get responses from them with your own self written web browser and never touch IE or Firefox or even Mozilla or the like, you do a POST to the site IP or URL it then responds, thats it, you do with the data as you see fit. These network libraries pretty much do the same thing if they decide to use port 80 or any other port that web servers use. It is all fat strings. Not worth a nickle beyond simple stuff, and that is the turn based systems, chats, the like.
     
  17. ProtonOne

    ProtonOne

    Joined:
    Mar 8, 2008
    Posts:
    406
    I'm just trying out the demo projects (Win32-Grid-Island, Unity-Grid-Island Unity-Island). You can run all 3 at the same time, they are all clients of the same server (very cool).

    I was surprised when I loaded the non-unity project (Win32) and was able to add AI players to the island and they would walk around correctly. I found that the y position was just being inferred in Unity via Terrain.activeTerrain.SampleHeight. So these projects are only syncing the x,z coordinates. Not a criticism or anything, just an observation.

    I've been trying to figure out how AI players would be handled though. How would I add an AI player to the demo? Right now if I press '+' in the Win32 app, I can add a player that randomly wanders around, but as soon as I kill the client, all the AI players it created disappear since they are 'owned' by the client.
     
  18. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    You'd make an NPC service that plugs in to the server and thus doesn't disconnect (you'd want failover and a reasonably timeout), with as many players as you have npc's.
     
  19. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    In the end, we didn't really show AI but faked players. We wanted a bit of movement on the island and wanted to show that real players can walk around instead of server NPCs.

    And you are right with the y coordinate being left out. I guess this developed from the 2D sample we had into the Island demo but in the end I would recommend it for any heightmap-terrain based MMO as it saved some traffic.

    A single axis is not much of course but this multiplies rapidly when sent multiple times a second per player.

    As duke pointed out, this would be part of the server logic.

    You have the C# source to implement them on the server yourself. You would need to do the logic for NPCs, maybe provide special operations to interact with them and you would make them send the same events you use for players. At the moment: position updates and name information.

    We didn't integrate server AI so far but it sounds like a good idea for a sample.
     
  20. MentalFish

    MentalFish

    Joined:
    Nov 2, 2005
    Posts:
    282
    I am looking forward to check out the innards of this, just need to shovel away a to-do list.
     
  21. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    I'm getting this when trying to start the server:

    Code (csharp):
    1.  
    2. 1700: 23:01:39.0281 - CService::OnException() - Exception: CManagedHost::RunApplicationInNewDomain() - Failed to run application: "Lite.SocketApplication", "Lite.SocketApplication.LiteApplication" - Exception has been thrown by the target of an invocation.
    3.  
    edit: Installing the latest .NET runtime libs seems to have done the trick!
     
  22. Quietus2

    Quietus2

    Joined:
    Mar 28, 2008
    Posts:
    2,058
    I'm a bit confused about what Photon gives you. There's much white papers included on partitioning algorithms and interest management. Is this included as a feature in Photon?

    While reading the white-papers I immediately thought that if you were able to use a nav-mesh from AngryAnt's Path or data from setting up occlusion (once it's rolled back into Unity) for such purposes that would be a win.

    I can't seem to find any meaty documentation on the website, just marketing blurbs and overviews.

    Also, the given samples for servers and clients all seem to be built for Windows. It's be nice to have a sample build for a bsd target, so us Mac users can play too.
     
  23. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Photon does not run on anything but windows. So its hard to have stuff for other platforms :)

    I kind of agree on the documentation, but VC# is pretty good at showing you what functionality is within a .NET assembly so you can check it out there.
    Its by no meaning a full scale mmo platform. Its really more or less the range based distance handling (likely based on a grid cell based approach for the initial "potentially in range" gathering with actual range checks in the border grids).

    Any unity related handling like occlusion culling based would not help in that case.
    Actually it would not work in this case at all for the following reasons:
    1. Occlusion culling is based on the main camera. So with multiple users that you want to use it on its useless, it will not do anything
    2. A headless client has no rendering and thus no culling at all.
     
  24. Quietus2

    Quietus2

    Joined:
    Mar 28, 2008
    Posts:
    2,058
    Ack! :cry:

    You sure about that? Not being cross-platform would eliminate it from my consideration.
     
  25. tigeba

    tigeba

    Joined:
    Sep 11, 2008
    Posts:
    70
    I may be misinterpreting one of TobiasS previous comments, but my understanding is they support clients on many platforms, not that their server itself runs on multiple platforms.
     
  26. Kaiserludi

    Kaiserludi

    Joined:
    Jan 21, 2009
    Posts:
    94
    Hi, the Photon Clients are avaiable for Windows (C, C++ and C#), Java (ME and SE), Flash, Windows Mobile (C, C++ and C#), Brew (C and C++), iPhone (C, C++ and objC), Android, Browser (via Java, Flash and Unity) and of course Unity (C# for Unity Indie, Unity Pro and Unity iPhone Advanced) (hiope, I did not forget a platform) and all of them are cross-platform compatible to all other avaiable platforms, so you can make a crossplatform-multiplayer-game with for example mobile phone players playing vs. PC-players in the same game, if you want.
    The server is Windows only, meaning, you can't host a Photon server on an Unix system, but of course clients from non-windows-platforms can use the windows-server.
     
  27. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    Can I confirm what the LiteApplication does? Why is it needed when theres the Photon.Mmo.Server? What does LiteApp do that the Mmo Server doesn't and vice versa?

    I see in the PhotonSocketServer.xml they're treated as different applications so is LiteApplication unneeded for the Mmo Server?
     
  28. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    To answer my own question: no! The whole Lite folder isn't needed and is probably just in there as a default part of the package. The mmo server is indeed... mmo.server.
     
  29. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    Ack. The "Lite" application is a sample application that uses distinct rooms by name and the "MMO Sample" shows how else you could treat users and manage their interests on the server-side. These are very different goals and we wanted to show how you could get both done.
    Photon can run both business logics at the same time as different applications. The users who connect to one game are not known in the other, which might or might not be good for your purposes. It could separate logic into distinct apps if needed and they could later be split to different machines or profiled and tuned independently.

    And Kaiserludi is right: it's only the server that must run on Windows. We use specific performance optimizations and udp handling inside the Photon.exe that is difficult to port and keep system-independent. We also use Windows Performance Counters, which is a built in tool in Windows (commandline, type: perfmon) which lets you configure and show graphs easily. This is very valuable for performance analysis, too.

    The clients are fully cross-platform by design. At least to the extend that the language offers, which means: we can't implement the short-type in Flash of course. As long as you are aware of the lowest common denominator of all your platforms, you can connect them across Photon (and Neutron) effectively.

    Hope that clarifies some points.

    This post also gives me a chance to say "Happy new Year!" to all of you :)
     
  30. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    We got some feedback and a few questions about the MMO Sample so far. Thanks for that!

    If anyone is stuck and has questions: we opened up our forum for Photon and Neutron now. This means also the trial or Indie License users can get some support:
    http://forum.exitgames.com

    It's pretty empty still but we check in regularly.
    Of course we will answer questions here as before :)

    Aside from that: we are preparing the next release of a Photon SDK with clearer isolation of source and binaries for deploy, enhanced game properties in the Lite application and less differences between our two apps "Lite" and "MMO". But the release is still a few weeks ahead.
     
  31. the_gnoblin

    the_gnoblin

    Joined:
    Jan 10, 2009
    Posts:
    722
    One question about pricing: do I have to pay $3500 per project or per physical server (for an unlimited number of users)?

    thanks
     
  32. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    The licenses are for concurrent users of one game/application and per server.
    At the time you have more than 1000 concurrent users online we expect you to have a major success and a solid income. The fee is one-time and not per month (after all, you do the hosting yourself). If you need to run multiple servers you would have to buy some licenses.
    You can start with a small license and upgrade anytime at the cost of the difference (without any fees).
     
  33. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    I really like that pricing! I think it's a very fair approach that grows nicely with the needs (1000 concurrent users really is a lot) ;-)
     
  34. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Fully agreed :)
    Espcially the indie license for the alpha and part of beta dev phase really helps out of my view :)
     
  35. JDonavan

    JDonavan

    Joined:
    Oct 3, 2009
    Posts:
    105
     
  36. Deleted User

    Deleted User

    Guest

    what the hell u pay microsoft for?
     
  37. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    As long as you can use Windows Web Edition (which - AFAICS - works for pretty much anything except for when you want to run SQL Server), you can rent Windows servers at the same price as Linux servers. Only Mac servers are usually more difficult to find and usually also more expensive.

    So personally, I'm very happy with Windows servers (in fact, I'm considering ditching that one Linux server that I still have because it creates an extra-burden administration-wise).
     
  38. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    This sounds pretty cool and like the perfect point in time for me to "really get my hands lighted up with Photon" (I've made up my mind and will port networking of Traces of Illumination to Photon). Do you have a rough estimate when you'll approximately be done with that "cleaned up release"?
     
  39. joew

    joew

    Joined:
    Apr 8, 2008
    Posts:
    96
    Just FYI we have been using Amazon EC3 for various game server applications and there isn't a huge difference in cost between starting up a Linux instance vs. Windows. Sure if you're buying your own hardware Windows can cost more in licensing but at the same time if you are buying hardware instead of using a cloud computing system then the Windows licensing fees should be a negligible cost.
     
  40. Discord

    Discord

    Joined:
    Mar 19, 2009
    Posts:
    1,008
    I know this topic is a bit old, but I've run into a little problem. When I use the DotNet client to simulate more users, I can't see them populate the island for some reason. The player's name updates from usually being Unity1 to Unity81 after I add about 80 players, I just can't see any of them on the Island. Is there something else you are supposed to do before you can see them? I've run around the island with the viewing distance at the max (20000x20000), and can't see a single other computer player running around.
     
  41. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    if you run it in the editor, do you see their GOs in the hierarchy or do you get any suspicious debug log entries?
     
  42. Discord

    Discord

    Joined:
    Mar 19, 2009
    Posts:
    1,008
    I ran it in the editor and I don't see any GO's in the hierarchy. I joined the game with another computer and another cylinder showed up in the hierarchy representing that new player. Would the players from the DotNet client be represented as cylinders as well? And the only thing in the debug log is "game state changed to Running."
     
  43. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    that depends on if they send the same data as the unity side expects.

    I've not used the two in conjunction yet, just either one or the other.
     
  44. Discord

    Discord

    Joined:
    Mar 19, 2009
    Posts:
    1,008
    Alright. I had used them separately before, but decided to try them in conjunction today. Quoting the readme,
    Well, I added a 100 DotNet users and walked around the island for a good 15 minutes and didn't run into a single DotNet user, so I'm assuming I did something wrong. :p
     
  45. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    For me it works with the build for the island demo (in the build folder)

    what I though had to change is the .config file of the exe as the default adress is localhost while I have the server on a distinct machine. once that was fixed all was working fine.
    spawned about 50 and moved one around which showed me the moving nametag and allowed me to search for them :)

    you can check the log window in the dotnet client thingy. if it mentions error 1026 your connection failed
     
  46. Discord

    Discord

    Joined:
    Mar 19, 2009
    Posts:
    1,008
    Ack. I misread the Readme they provided. I was using the wrong DotNet client. Alright. Now it works. And I feel stupid. Thanks for the help Dreamora.
     
  47. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    No prob :)
     
  48. CaptainKiyaku

    CaptainKiyaku

    Joined:
    Feb 8, 2009
    Posts:
    324
    I am playing around with the island demo for a while.

    I get how the players gets created, etc.

    But now i wonder how you can actually sync the positions between Player and Actor.

    Like when a new players joins the game, it create an Actor object on all clients for him. So instead of moving it to a random position like its done in the demo, how can you move him to the position of the player who is controlling him?

    And is there an "easy" way to, for example, strings to clients? Do you have to manipulate the C# client project?

    Thanks in advance.