Understanding Photon and Unity3D

Options
JohnLeeroy
edited July 2011 in DotNet
Hello Everyone,

The studio I work at is looking to use Photon for Unity3D IPhone. I looked at the developer pages and I am still a little bit confused on how it works so I will try to explain how I see it and want you to correct me if I am wrong.

The client will be running a Unity3D application that has integrated photon.
The server is hosted on a machine that I run that has the Server SDK(not on a machine that Exit Games provides).

The client will be polling for events and everything should be handled in Unity3D.
How can we add code to the server to send and handle calls from/to clients?

Comments

  • Kaiserludi
    Kaiserludi admin
    edited July 2011
    Options
    The Photon server itself has two layers: a C++ core for the high performance low level stuff and a C# API for the high level access to it. On top of this C# high level API there are so called application, also written in C#. For typical stuff, which is often needed by many game developers, we already provide applications lite Lite, LiteLobby, or MMO. For all game specif stuff you can add your own application, which can also inherit from one of the exisiting applciations and implement operation responses and events there.
    The unity clients (and other clients) can send operations to the server and depending on the logic in your server-side application the server will react to this oeprations and send responses to the clients, that have sent the operations or events to the sending and also to other clients or also trigger server side logic as an reaction to operations (for example you could let the server check with a server side game logic implementation, if some ingame success, which a client claims, is correct)
    As an example for already provided high level logic, you could have a look at the raise event operation from Lite:
    A client can send a hastable with game specific data with this operation and tell, who should reseive it (default is: all clients in the same room like the sender, except the sender itself (rooms are Lite's understanding of game isntances, chat rooms, lobbies, etc.)) and the server will then send this hastable as an event to all the clients in the list of receivers.
  • Thanks for the information. About hosting, I believe Exit Games recommends using Amazon EC2 but what would be the advantage of doing so rather than self-hosting or another hosting service.
  • Boris
    Options
    Actually, Amazon EC2 is not recommended - it's very expensive and the performance is not as good.
    AirVM has pretty good performance, so does rack space.
    The optimum would be a non-virtual server - with windows server 2008 64bit.
  • Kaiserludi
    Options
    Self hosting is performance-wise the best option as clouds are often slower in comparison to using the same hardware natively.

    The advantage of clouds is their scalability: If some site features your game without you knowing about it until it is "too late" and out of nowhere the amount of players online at the same time explodes and your servers can't handle it anymore, it is a matter of minutes, to have as many servers online as you need. As there are models like renting a server in a cloud just for a few hours you can even rent your servers in a cloud based on different times of the day: have more servers at prime time than when it is 3 in the morning for most of your players.

    So in conclusion the best way is, to have some native servers for the part of traffic, which is there nearly all the time, and to additionally have a cloud available to handle traffic peaks.
  • Thank you for your quick responses. I will be sure to look at all my options before deciding on a host.