Question About PUN and Self Hosting

Options
Hi, I'm new and wanting to learn about Photon. Currently I'm going to be working on an online RPG (An MMO, just small scale. Like 10-20 players max, but will have skills, classes, a bank, chat, guilds, etc.) My goal with this project is to learn about networking with Photon. I am wondering, is there a way to host the game servers and create it just using C# and Photon in a console application, or do I have to make the game servers with Unity? I am wanting to have the client using Unity, and the servers be using just Photon, completely decoupled from Unity. I looked at the SDK's, and only found PUN, Unity3d On Premise(On Premise, since I'm going to self host all my servers in the rack I have at a datacenter), and Photon server SDK. Like I said, I'm wanting to use Unity as a client, and Photon as the game server completely decoupled from Unity. Just not sure if it's possible. Worst case, I will have to make the server a seperate Unity project. Thank you all for your time.

Comments

  • MichaelQN
    Options
    I noticed on Photon Server SDK here -> https://www.photonengine.com/en-US/OnPremise/Pricing

    It says use with and Photon Client SDK. I assume this includes unity? So I could use Photon On Premise Server, along with Unity3D on Premise to create the game server and client? Just curious how I have the server that's decoupled from unity, to spawn something. For example, how do I have the server tell the client that the server spawned an NPC? Wouldn't the server have to have the script for the NPC and everything? Just tell the client what model it is to represent it, and have the client play all the animations based on what NPC that it is told?
  • Hi @MichaelQN,

    yes, this is definitely possible. Inside the Unity Editor you can select the PhotonServerSettings file and select 'Self Hosted' as 'Hosting' option. This allows the client to join the server you specifiy.

    The server itself is completely decoupled from Unity, means you neither need to run any kind of Unity instance nor any of the Unity scripts server-side. To pick up your example: the server itself doesn't spawn or instantiate the NPC, the server just stores the Instantiation call (until it gets removed) in order to forward this call to other, currently active clients as well as client who join later.