question

tonnyadiyasa avatar image
tonnyadiyasa asked

Photon server and Cloudscript

Hello, I am planning to use Photon Cloud in the game I am working on.

I am very new to Playfab and Photon, and recently spending time to understand how both works, and the best implementation for what i am aiming for.

I've been using Client API Cloudscript call to modify player statistics such as win/lose and elo skill ratings.

So far it works, but I know its not safe to trust the client to modify these important statistics in a competitive game.

What is the best way to do it safely and easily?

I prefer not to write my own separate server sided software, and rely fully on Photon Cloud if possible? (Since I will be paying for it anyways)

Is this doable?

CloudScriptphoton
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Yes, you can use Cloud Script for simple, server-authoritative logic, like checking the reported results from a client for cheating (before writing it to statistics). In fact, one of our users, Hamza Lazaar, posted a sample to his GitHub showing using Cloud Script with the Photon memory demo: https://community.playfab.com/questions/9573/memorydemocloudscript-question.html?childToView=10075#comment-10075.

For a competitive game, your best bet is to use a custom game server, of course. Short of that, you would want to have each user report the results and compare them, using some sort of "trust" rating. If the reports match, register the results and raise the "trust" rating for both players a bit. If they don't match, lower their trust rating. I'd use a sliding scale for that, starting at the amount you increase for a match, but increasingly negative based on how many games they've played - that way, new players can't be unduly penalized by people who occasionally cheat to try to trick your system. And even then, you'll need to monitor your community closely. Using PlayStream to log an event whenever there's a mismatch, with a quick summary of the differences, will help you with this.

Anyway, for a mismatch, you don't need to just throw out the results, then - compare the two reports, and use the results from the player with the higher trust rating, if there's a big difference in trust. You could also keep track of the number of times they had a mismatch with their opponent, along with how often that mismatch resulted in them winning the match. If you're recording all the mismatches via PlayStream, and you're collecting all events via the Event Archive, you could use that to check who all the player had mismatches with and what their history shows, to try to make a determination as to whether they're trying to be a clever cheater.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

tonnyadiyasa avatar image tonnyadiyasa commented ·

That is exactly what I am trying to avoid, hosting my own custom game server.

I love the idea of Photon managing my servers worldwide, and I will have no hassle or involvement in handling any of it. Pay for it, and focus on developing the game.

And it seems like Photon Cloud does not allow custom server logic according to this explanation.

Unless I applied for Enterprise plan. (Which ofcourse I have no budget for.)

Photon server is an option, but I will have to host it myself. And learn about all the server side operations.

Thank you for the trust rating solution suggestion, I think for now I will go along with this idea with the budget I currently have!

PlayFab is amazing, not only the ease of use, but this level of comprehensive forum support is rare gem nowadays!

Have a good day!

0 Likes 0 ·
tonnyadiyasa avatar image tonnyadiyasa commented ·

I just found out that you can do Cloud Script calls safely from Photon Cloud using WebRPC for anyone looking for the same solution!

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]