0
\$\begingroup\$

I am planning on making a game in c#. It will be a turn based, space exploration game. I want the turns of the different players to be able to happen at the same time though. I have been researching for what type of server to use for hours and I cannot find one that works the way I want it to.

I have heard of listening servers, dedicated servers, and peer to peer. -the peer to peer I have heard are almost gone, and obsolete for the most part -dedicated servers are expensive, in terms of resources (lots of data) -and there are listening servers which seem to be the best option.

Also is there a way for the server to run under the same exe as the client? like how minecraft does it? where each game is internally run in a server though 2 windows do not appear?

EDIT:

I know that I need to create my own server, and I am pretty sure I can do it in c# ( i made a small client and server that doesn't do much but it works) but I want to know what structure of server I should create

\$\endgroup\$
  • \$\begingroup\$ Well, it's clearly possible to run the server and client in the same executable, since you've seen it done. So, yes, there is a way to do that. There are also a number of ways to handle networking. Beyond that, I think your question is a duplicate of: How to structure a simple game server for a multiplayer game? \$\endgroup\$ – MichaelHouse Sep 5 '13 at 20:33
  • \$\begingroup\$ I don't think this is a duplicate, in that question, nothing is asked about the architecture of the server, or at least not clearly for me. and this is for a turn based game, and that is for a RTS game. so there could be more with larger packets being sent to the server, though I don't know what that entails either \$\endgroup\$ – Joseph Dour Sep 5 '13 at 20:49
  • 1
    \$\begingroup\$ Do some more research. Read Gaffer on games: What every programmer needs to know about game networking, then make your decision. This decision is really one for you to make, not something other people should decide for you. \$\endgroup\$ – MichaelHouse Sep 5 '13 at 21:21
2
\$\begingroup\$

I would recommend you to allow both, because it allows your players to have both of two worlds. They can run it on servers in datacenters to provide a permanent meeting-point for their social circle. But they could also open an ad-hoc server from their client.

You could easily do this by implementing the server in a DLL which is used by both the client when it opens a listenserver and by your much more lightweight dedicated server executable.

Another decision you didn't consider is letting the community host their own servers vs. hosting a server for them. When you host your own servers you have these advantages and disadvantages:

Pro:

  • Most community server hosters will be hobbyists, but as a professional with commercial interests you can provide a much more reliable service (hopefully)
  • It solves the piracy problem in a very elegant way, because you have an excuse to give every buyer an own account with password and ban anyone who shares their account with someone else
  • Releasing updates become easier, because you just have to update your own servers
  • You can globally ban any cheaters or other misbehaving players.
  • You can provide authoritative global highscores and statistics. This would be impossible when the players host their own servers, because it would be impossible to prevent them from cheating when they control the hardware.
  • Players are unable to hack and mod the server, preventing them from bastardizing your game

Contra:

  • You have to pay the bills for the hardware
  • You have to pay the admins who keep it running
  • You have to pay the mods who ban the cheaters and abusers (or hand-pick some volunteers from the community which will be a source of endless drama)
  • Players are unable to hack and mod the server, preventing them from adding free value to your game
\$\endgroup\$
0
\$\begingroup\$

To start off, yes, it's definitely possible to create the server and client in 1 executable. For this, take a look at threads. A 'thread' is a place where code is ran asynchronous.

Secondly, you are probably best off with a dedicated server in C#. If you make a game in C#, it's a good idea to make the server in C#. If I were you I would not worry about the resources of the server, as a turn-based game doesn't use a lot of data at all. Unless your game becomes really big, you will be fine with a tcp/ip or udp server in C#.

A little tip on C# servers: use the Lidgren library. It saves you alot of time, as the library will create a high-performance udp server for you with a few lines of code.

\$\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.