Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Let me clarify what i mean by that.

Let's say i want to create a multiplayer game which uses physics (box2d). If I would let the server handle all the physics I would end up with a very overwhelmed server with clients that only control one entity on the server.

Client-Serv

Question:

What if i only use the server as a 'router' to control the traffic between clients and use one of the clients to handle the physics and do some checking to stop cheating? Is this a bad idea? ( But this may increase latency, since clients can't send data directly to each other.)

Keep in mind that a game is between 2 players, that means the client which would handle the physics wouldn't have all clients body handled by it's pc.

share|improve this question
1  
If you search for "listen server" you might find things that are relevant to what you're looking for. –  Tetrad Jun 21 '13 at 19:13

2 Answers 2

up vote 6 down vote accepted

As far as I'm aware, this is essentially what many console games do. This was even brought across to some PC games, like Call of Duty: Modern Warfare 2.

There are, of course, some drawbacks:

  • Any coding effort to "do some checking to stop cheating" would almost have to be more complex than the physics code itself. You can't trust the client, pure and simple. They could be sending across barrels of dynamite and spyware for all you know (humorous exaggeration).
  • Even if your unknowing "server" has the purest intents, they're likely to get a much smoother, more consistent experience than the other clients, more or less ensuring their headshots are computed first, and what's on their screen is most representative of the game.
  • If players become aware of their server status, all they have to do is turn on something to throttle their bandwidth, ensuring all other players get a horrible experience. You can't even call this cheating, because players connecting from Chile aren't likely to have a consistent connection.

All you really should know is this: Yes, it is possible. But when Call of Duty: Black Ops (the next game in the series) came out, they gained a lot of players by announcing they would use dedicated, rather than player-hosted, servers.

share|improve this answer

It is not a 'bad idea' to do this over other methods of networking.

What developers typically have to discuss is how much power to give to a Client, and how much authority to give to the Server.

I would say that the more you allow a Client to do, the smoother things will be for the player. However, the more you allow a Client to do, the less authority the Server has to prevent cheating.

I will use different examples to explain my answer.

Example1

Online multiplayer FPS games with client-side hit detection benefit all players by giving a more fair experience despite latency. No longer do players feel the results of lag preventing them from scoring a kill when they shot first. A common joke among FPS developers in the earlier days of FPS gaming was the banter between players: "I shot you first! NO I shot YOU first!" The downside is that cheating becomes extremely easy for players. It is not a coincidence that games with Client-Side hit detection have an enormous amount of cheaters compared to other games. While cheaters are in every FPS game, I personally experience a far greater number in Client-Side hit detection games. This makes sense given how much power the client has to send the server what seems like logical, rational headshots. IMO this has a major downfall but a major benefit, especially to high latency shooters like Planetside2. However, like with Planetside2, combining this with client-side movement detection makes for an absolutely idiotic nightmare for players who do not cheat. Yes, Planetside2 doesn't just allow players to decide who and where they shot their bullets, but allows players to teleport, warp around, or even fly simply by telling the server they are here instead of there, despite it not being rational. The benefit of the former is almost worth the negatives, but I see next to no benefit for the latter, compared to the overwhelming negatives that comes with pairing the two.

In a game where the client is the server, I do not see this to be as big of a problem, but the problems of cheating still remain. However there is a great resolution BECAUSE of the client being the server. The client (server) would have the authority to kick cheaters or players who ruin the game experience, or close down by simply leaving the cheaters behind, disconnecting them from everyone and sending them elsewhere to ruin someone else's game.

The negative side of Example1 with a client-as-server design is that the client (server) has an enormous amount of power to cheat. Not only do they hold all authority over all players, to the point of closing the entire game down if they so desire (although you may want this as a feature to handle trolls) but the client (server) can do even the simpest of things to cheat. Messing with one's modem, lagging one's connection, or manipulating flaws in the design can be achieved by even the most amateur of children who find out a simple trick (cheat). Not all cheating is as difficult as requiring a complex program such as an Aimbot.

Example2

Physics for clients, but not on servers. The server's load is obviously very light with this example. However, a single misstep in physics calculation on any one client and everything could change dramatically. What most rational developers do is have the calculations on BOTH the client AND the server, and then check for consistency. This isn't just for Physics, but for many other calculations as well. It is amazing how a tiny insignificant difference in Clients can produce an enormous amount of differentiation between player's game worlds. Especially when the server does not catch and correct these errors.

My question would be, "Why does only 1 client (as server) do the physics calculations? If one client is capable of acting as client, server, AND performing the calculations, then why can't all clients perform the calculations? Unless the client (server) had to be a desktop which can connect to low hardware, low connection clients (mobile clients?) I have a hard time understanding why one would have physics calculations on only one client.

Example3

A single client is the server, where other players connect to said client. This is very common for console games. While a good idea in theory, as a PC gamer and developer I find this to be so laughable that it verges on idiotic. At least for FPS games anyway. For other genre's I may view it entirely different. A turn based game for example would be genius to have this type of setup. Despite the horrendous flaws, there is a benefit in the design. It is easy for players to casually connect, they don't have to ever rely on a server which may go offline, and matchmaking can guarantee similar ping locations. The downfall is the obvious: The client that is the server has a ping of 0. They will have not a small advantage, but an enormous one. Nearly every game I viewed, the host would have one of the highest if not highest scores among all players due to this advantage. When I played games where I had 0 ping, my scores would double and I would be unstoppable almost like I was cheating. More negatives include how if the host leaves the game, all players on the 'server' will suddenly drop, almost as if a crash. Even more of a flaw is the fact that the majority of users do not have the most NAT friendly setup. It is very common for players of even console games to not be able to connect to their friends due to the fact there is no a healthy server to connect with.

While Ex.2 and Ex.3 do not give as specific as an example as Ex.1, I did not want to be repetitive. Example 1 can apply to more than just the feature of client-side hit detection. It is very common for games that allow clients to have power, to have a lot more cheating; undetectable cheating especially. When all the server receives is player input, it is next to impossible to detect whether or not they are cheating or are simply expert gamers. Especially if the cheating is sophisticated enough to know how to fool the server's consistency checks. A common piece of advice among developers which I have read online is to "Give the player as little power as possible for security reasons." and in MMO specifics, "Try to make the client nothing more than a keyboard, mouse, and display."

After all, if you CAN avoid using lag-prediction techniques, then you'd want to do so. These techniques are used as a resolution to a problem. Games that do not have the problem do not need them. So it entirely depends upon the design, but I would never consider your idea a "bad idea" compared to other methods. They are just different, with problems and solutions. Although I would definitely argue that restricting control for the Client to avoid cheating should be used whenever possible. If the Server can handle the load, then it is worth it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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