Server Side Code?

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Photon Server.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Server Side Code?

ShivaFang
2016-06-10 13:14:27

I'm having a little trouble understanding where I put the server-side code for Photon. All of the tutorials seem to be based around the premise that the clients do all the work and data is sent to the server and is then 'echoed' to all the other clients.

Is this correct? Is there no server-side validation of the data at all?

I'm also using PlayFab, which has server-side code, but the code isn't 'tied' to any particular game. My understanding of combining these two products is that Photon handles the local game information (IE - the actual location of the pieces and how many hit points units have etc) and passes requests to Playfab when it needs to check specific TitleData queries or broad code access.

However, it feels like Photon is literally just an echo chamber - I can't actually code on it. Which means I'm relying on my clients to handle the majority of my game logic, which does not seem like good practice. Also it makes me wonder why use Photon at all at that point, since everything is basically handled by Unity and PlayFab.

Can someone point me in the right direction? Surely there's some Photon Server Side documentation somewhere that I'm missing.

Comments

ShivaFang
2016-06-10 13:21:27

I should point out that I did search extensively on this topic. The top link on Google is this one;
http://forum.photonengine.com/discussion/64/server-side-programming

And the reply to the question "Where do I put the code" was "Wherever you want". @%!$@!@$??? Where do I physically upload the code? What language does Photon Server speak? Etc.

If Photon has server-side code capabilities, they are completely obscured to users. I can't find any information on them. This is a huge problem.

Markus
2016-06-10 14:35:11

Hi,

before clarifying, where to put the code, some pointers to understand the different Photon products a bit better.

to start I would suggest reading:

  • https://doc.photonengine.com/en-us/onpremise/current/getting-started/photon-server-intro
  • https://doc.photonengine.com/en-us/onpremise/current/getting-started/onpremise-or-saas

Photon Server:

  • you host the server and can adjust its logic as you need it (c# code)
  • on premise

Photon Cloud (Realtime, Chat, Voice):

  • usually, we do the hosting here and you cannot add server-side code/logic
  • SaaS

ShivaFang
2016-06-10 14:37:17

Okay, so with Photon Cloud I cannot add server-side code. This is good to know, and should probably be clarified in the documentation (as I see this question a lot)

Markus
2016-06-10 14:53:18

Fair enough.

Let me add a note (no rule without exception):
in Photon Enterprise Cloud (dedicated servers, SLA, ...) you can add server side logic running in rooms/games via plugins (http://doc.photonengine.com/en-us/onpremise/current/plugins/manual).

In the end, it strongly depends on the kind and scale of your game, if you need server-side logic or can cope without.

ShivaFang
2016-06-10 15:15:09

I strongly need server side code. Enough that after your first answer I was considering going back to player.io (which is what I originally started development with but it's gone seriously downhill since Yahoo! bought it out)

My game has elements of collectible card games and strategy, and a large portion of it is matches vs AI opponents and I can't trust the clients at all.

Photon Enterprise Cloud's plugins feels (at a glance) very much like how player.io works. I can't find much information on the pricing though - I'm a small indie developer and anything with 'enterprise' in the name is usually way outside of my budget, so I'm a little worried.

Back to top