question

nikolalemmens avatar image
nikolalemmens asked

Photon Cloud Script for mobile realtime 2d race game

Hi,

I’m developing a mobile 2 player realtime synchronous 2d racing game in Unity. The two players need to finish a task as fast as possible while they see each others move.

But what would be best practice for my game? I suppose setting up Photon via Playfab and then using the Photon Realtime via webhooks. And then coding the game logic in Cloud Script.

Is this right? Or would I need a custom game (Photon) server for this type of game? Although a simple game, the game objects move really fast and reaction time is pretty important...

And what would be best handled in Cloud Script? I read in a post 'to validate player moves'. But could anyone elaborate on that?

Any thoughts would be appreciated.

Best Regards

Nikola

CloudScript
10 |1200

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

brendan avatar image
brendan answered

The post talking about validating player moves would be for a turn-based game, where players are making moves every few minutes. For realtime games, you need (as you say) a high rate of communication with minimal latency. You can enable realtime connections between players a number of different ways, and Photon is definitely one we would recommend. The real question is, how much do you care about cheating in your game? If you need to have server-side authority for updates to minimize cheating, you'll need either Photon Enterprise (so that you can have your own DLLs running on the server to handle the game logic) or else use custom game servers (hosted with us or in a game server hosting service you select - our matchmaker works for both).

10 |1200

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

nikolalemmens avatar image
nikolalemmens answered

Hi Brendan,

I would like to keep cheating to a minimum, but that said, without server-side authority, is there a remedy for cheating, so it becomes controllable and it doesn't annoy other players?

As an indie dev I like the fact that Photon Enterprise is free until 100 CCU but I've been looking at the docs and plugin manual and as it is all new terrain for me and with my planning and game release date in mind, it's a bit overwhelming.

With the custom game servers hosted by you guys, would I also be responsible for server administration and scalability (as with Photon Enterprise)? What would be the price?

Cheers,

Nikola

10 |1200

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

brendan avatar image
brendan answered

Without server authoritative logic checking all the values and inputs reported by the client, you're trusting the client for whatever it says. In a realtime game, you could use Cloud Script to do a relatively simple check at the end of a match (comparing match summary reports from the players), but that wouldn't help with the fact that a hacked client could be cheating the inputs throughout the game session. I wasn't aware that Photon Enterprise had a free level, but that would be something you can discuss with the Exit Games team directly (the providers of Photon Cloud). For custom game servers, all you do is upload and configure the build - your configuration settings determine how the servers are scaled by our service automatically. In terms of administration, that would be minimal - basically, you have the ability to upload new builds, terminate running instances if you need to update everyone to a new build, etc. We capture log and output files from servers, so that you can review any issues you think might be occurring. And the pricing on our server hosting is the actual EC2 cost plus 10% to cover our costs. You can read more about our game server hosting here: https://api.playfab.com/docs/custom-game-servers

10 |1200

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

nikolalemmens avatar image
nikolalemmens answered

Hi Brendan,

I'm now following a tutorial on server side game logic to get me going on that.

The doc on custom game servers says that the builds must be compatible with Windows Server 2012 R2, so I need a Windows/Linux machine for that. Is there a Mac workaround?

Do you have knowledge of more tutorials/code examples on the PlayFab custom game servers?

Grtz

Nikola

10 |1200

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

brendan avatar image
brendan answered

All games have access to a relatively small server instance in AWS for testing purposes, so you could just use that. The link above on using custom game servers is the overall guide, but we do also have a sample game server in our Git repo that you could use as the basis for your own: https://github.com/PlayFab/PlayFabGameServer

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.

nikolalemmens avatar image nikolalemmens commented ·

Great, that sample game server is much appreciated, thx!

Just to be sure, I need to connect with a windows pc, right?

0 Likes 0 ·
brendan avatar image brendan nikolalemmens commented ·

No, the server must be compatible with Win2K12 R2 to run. The clients connecting to the server can be running any operating system.

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.