Photon Newbie, understanding Server code

Options
Fraggle
edited January 2013 in Photon Server
Coming from uLink, so please help if you can.

I'm trying to understand if, when using Photon server, if there is any code (that we write) that is actually executed on the actual photon server and not on client instances.

If so, is this code written in C# or Javascript and do I do it just like regular Unity scripts? Then how to deploy that to the actual server?

I don't see anything about this in the docs. Please point me in the right direction.

What I do understand:
Create clients that are running my game in unity and have them be able to send RPC or state sync to other clients or perhaps even to a Master Client. Master Client can then if necessary relay this to other clients.

What I don't understand:
How to send an RPC to a Server and have that RPC code get executed on the server, not on a client machine.

Comments

  • Just responding to my own question:

    Please let me know if the primary means of using photon is to have all code get executed on the clients device. This would help clarify things a bit. That is my assumption right now. That for Unity games, mostly people are using photon server just to relay RPC and state sync, and not executing any custom code on the server side.

    Is that right?
  • dreamora
    Options
    Fraggle wrote:
    Just responding to my own question:

    Please let me know if the primary means of using photon is to have all code get executed on the clients device. This would help clarify things a bit. That is my assumption right now. That for Unity games, mostly people are using photon server just to relay RPC and state sync, and not executing any custom code on the server side.

    Is that right?

    No that is not right.
    Thats the purpose of PhotonCloud, right
    But in all other cases you control and host the server and can expand its server side applications to your specific needs as your project requires it
  • Ok, I think I get it now. The part that I was missing (being a Mac guy) was that we have to develop the server side applications in a dev environment like Visual Studio on Windows.

    So we can develop server side applications to do whatever we want but can't do it inside Unity, and can't do it on a Mac (unless we dual boot or whatever). That is the part that I just wasn't getting. Would be nice if we could deploy raw C# files to the server, and have it compile for us or whatever. Many Unity devs are on Macs, so it's a bit weird that this is so Windows oriented.
  • Unity is indeed working extremely well with Photon, and we are more than happy about all Mac developers out there who use Unity and Photon. :) The only problem is that we didn't know that both would go together so well when the Photon architecture was initially designed. Sorry. ;)

    There are a few reasons for the .NET / C# decision - the obvious one is that Exit Games' staff is more experienced in Windows development, another one is that we wanted to avoid all the hassle of C++ coding (the "core" of Photon is written in C++ for performance reasons, but we think it is far easier to have the actual application logic in managed C# - the part that can be modified by customers in any way they like.).

    And finally, you could at least do some C# development work on other platforms with Mono (http://www.mono-project.com/). You could give that a try if you don't want to use a VM / Parallels on your development Macs. But keep in mind that you still need a (virtual or physical) Windows machine to actually run a Photon Server.

    Let us know if you have any more questions!