0
votes

I have to build a server to which I make requests using Unity for a mobile game.

I was advised to stay away from using REST for the server.

I want to be able to, in the client, make GET and POST requests via endpoints like "/players".

My question here is: which programming language and programs do you recommend me to start with to build a server to which clients can communicate with, in this case?

1
Why were you advised to stay away from REST? You also say you want to make GET and POST requests, but those are RESTful. Perhaps the person giving you the advice meant that you may want to avoid the HTTP protocol for a networked game? I think many games that communicate often with a server will directly use TCP or UDP.Kevin Wang
@kevinwang they just told me not to use it really in this circumstance... Then which approach do you recommend me using? I'm a bit of a newbie in regards to creating servers so any help would be appreciated!Pedro Cabaço
The game I'm building is turn-based by the way, so much less messages are sent!Pedro Cabaço
oh, I'm not really familiar with making games. I would think that using GET and POST http requests would be fine for a turn-based game. (But again, I'm not sure.) They didn't give you a reason when they said not to use REST?Kevin Wang
@PedroCabaço If you're making a turn-based game, it'd be best to go with a TCP connection (real-time games usually use UDP but you have time to deal with the confirmation of received packets). With this method, you'd be sending streams of data through a socket connection instead of GET and POST requests (which, as Kevin mentions, are RESTful requests). Here's a simple example of a TCP client and server in UnityFoggzie

1 Answers

1
votes

I've been using NodeJS to write servers for my programs and I've found it really good for a couple of reasons:

1) It is easy to understand the syntax (JS) if you've been using UnityScript or C# in the past.

2) There is a free download from the Asset Store that helps you parse and send data from a NodeJS server.