0
\$\begingroup\$

I have made in the past multiple offline game, and would like to make my first online game. I have very basic knowledge of server structure.

The game is a multiplayer RTS game, with ONE server (If possible in c#), where player can build base, attack other player and move around a world. it is in real time, but slow paced, so not many actions, and every time a user make movement it take let's say an hour to move. The game is planned for Android/iOS and (maybe) but not at all for the moment, web.

The game itself is easy, but the server I don't know where to start and I have been struggling in the last 3 days to find a informations and answer to my question. Most of the example I found are P2P/client-hosted server, this do not apply to my case, I want a single server that runs outside of Unity and that I can run on a computer as stand-alone. My question problems are.

1) for a mobile game, I have seen in some post that UDP TCP/Socket are not available in 3g? is this true ? If so, what should I Use ? I was thinking of websocket since MAYBE i make a web version, but I don't know if it's a good idea, and apparently it is not built in in Unity.

2) Related to my 2) is there any c# library that work in Unity and would fit my game needs? a user would probably load a map, and interact around 20 times with the server during the gameplay. I believe a simple server that get and send message only is largely enough, but I don't know what to use. Start from scratch? then what should I use, TCP ? Socket? WebSocket ?

3) Should I use photon ? I've seen is free to test until 20CCU, and since for probably the next 6month I will be alone on it it's OK, then at release let's say I have 100 player, is not that expensive. Is it a viable solution? I found it a bit overkill for my needs, but it looks documented and easy to start. Will I still learn stuff if I "cheat" like this?

Thank you for your time

\$\endgroup\$
  • \$\begingroup\$ Possible duplicate of Is this the right architecture for our MMORPG mobile game? \$\endgroup\$ – Saad Anees Jun 19 at 14:20
  • \$\begingroup\$ Did you really try to find solutions? there are 100s of answers there online. \$\endgroup\$ – Saad Anees Jun 19 at 14:21
  • \$\begingroup\$ exactly, 100s solution, but so many contradicting one's that's why I am still confused \$\endgroup\$ – Crocsx Jun 19 at 15:02
  • \$\begingroup\$ @Crocsx That's the problem here. There is never just one ultimate solution for a problem. Only the solution which works best for you. \$\endgroup\$ – Philipp Jun 19 at 15:48
  • \$\begingroup\$ @Crocsx its highly unlikely for you to find answer that you are looking for because you question is discussion based. There are so many technologies for the same things its just pros and cons for everything. Thats why you have to read all articles to figure which ones are for you. \$\endgroup\$ – Saad Anees Jun 19 at 16:39
1
\$\begingroup\$

Some of what you ask will fall on opinion based. And know that asking for what technology to use and where to start are off-topic here.


However...

1) for a mobile game, I have seen in some post that UDP TCP/Socket are not available in 3g? is this true ?

Not true.

Note that we are probably talking of running on a mobile operating system that will require the user to set permissions to the application to use the network. It possible that the user has restricted the use of the network because the ISP is charging based on the amount of transferred data.

Also, these are common:

  • The IP can change beyond user control.
  • The device will likely be connected behind a bunch of NATs (and you will not be able to use UPnP to punch through).

These are bypassed simply by having a traditional client-server architecture, where the client sends a request to the server, and the server responds. Since you are not trying to do P2P, these should not be issues for you (except, perhaps for push notifications).


2) is there any c# library that work in Unity and would fit my game needs?

Plenty, try them, they may not all work for you. See BenchmarkNet.

Start from scratch? then what should I use, TCP ? Socket? WebSocket ?

Sockets. You build everything ontop of sockets. UDP will give you more flexibility, TCP is easier to start with.


3) Should I use photon ?

Don't know. I am only vaguely familiar with photon, I am not familiar with your requirements, I am not familiar with your skills.

Will I still learn stuff if I "cheat" like this?

Using services, engines, middleware, libraries, etc... created by third parties is not cheating. It is to stand in the shoulders of giants.

Please, reuse code.

Yes, there is value in understanding the technical and low level aspects, yet that does not mean you have to start there.

Will you still learn? Yes! Even when it comes to networking, you will learn the high level architecture you need in order to have a big scary thing called "Internet" breaching in the middle of your system.

With that said, if your goal is to learn how do those libraries work, and you are motivated to start from scratch, then go ahead. In fact, I think there is room for more libraries (for C# in particular), if you think you have something to apport, please do.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.