question

paulucci-marco07 avatar image
paulucci-marco07 asked

C# Server,C# Server!

Hello! We are running our unity game on playfab and we are looking to implement an external server of our own as well to handle some of the logic. We thought C# would be a good idea so that we can reuse code between client and server. Now, we set a server under linux and were able to get a Default.aspx running on the server IP's address.

How should the external server actually work? Should we use uncompiled .CS files attached to our aspx, or do we need to compile code into an executable?

I know this might sound as a very basic question, sadly we had no luck finding in any guidance on how to get our C# server set up. Any help is greatly appreciated.

CloudScriptCustom 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.

brendan avatar image
brendan answered

To run a custom game server, you need to have a compiled executable that runs your logic. Since you're using Unity, one possibility is that you could use our sample game server as a starting place: https://github.com/PlayFab/PlayFabGameServer

4 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.

paulucci-marco07 avatar image paulucci-marco07 commented ·

The logic I'm trying to run on my server contains information such as: Hero skills, damage, and battle logic. But none of it requires player interaction, which means I don't need a "game room" functionality per se, instead, with only two IDs I can generate a battle.

Since these won't be battles in real-time, are game servers still the solution I'm looking for? Thanks!

0 Likes 0 ·
brendan avatar image brendan paulucci-marco07 commented ·

It really depends upon your requirements. If it's a realtime connection between two players, in general you'll need either a custom game server or something like Photon Realtime. If it's an asynchronous game where a player takes a turn and then, at some later point, the other player takes a turn, that could be simply client-side code (if you're not worried about cheating) or it could be that the client is sending its "move" info to a Cloud Script that checks for cheating and updates the game info, if it's a relatively lightweight amount of work to do so.

0 Likes 0 ·
paulucci-marco07 avatar image paulucci-marco07 brendan commented ·

Brendan, thank you for your reply. There is 0 interaction as I mentioned before. No, it's not a real time connection. One player picks opponent, the fight is validated on a server and then returns whether the game was won/lost (and more info).

As I said before, the game is about heros fighting, but they have a determined order. We need to store a lot of information about heros, such as how each skill works and how we calculate the battle. It's not that simple, which is the reason we want to have our server app, and I'm wondering if Game servers is what we're looking for.

0 Likes 0 ·
Show more comments
daveb avatar image
daveb answered

Another strategy would be to use WebAPI for your server, and Unity WWW, WebRequest or a third party solution to send a web request to the API. The server can use PlayFab's API to do whatever it needs to do (use up consumables, etc.), and the client can also use PlayFab's API - but then your logic would be standard C# running on Azure or w/e.

10 |1200

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

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.