Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the general strategies for the server of an FPS multiplayer game to update its clients?

A friend and I were having a discussion about how a FPS server updates the clients connected to it. We watched a video of a guy cheating in Battlefield: Bad Company 2 and saw how it highlighted the position of enemies on the screen and it got us thinking.

His contention was that the server only updates the client with information that is immediately relevant to the client. I.e. the server won't send information about enemy players if they are too far away from the client or out of the client's line of sight for reasons of efficiency. He was unsure though - he brought up the example of someone hiding behind a rock, not able to see anyone. If the player were suddenly to pop up where he had three players in his line of sight, there would be a 50ms delay before they were rendered on his screen while the server transmitted the necessary information.

My contention was the opposite: that the server sends the client all the information about every player and lets the client sort out what is allowed and what isn't. I figured it would actually be less expensive computationally for the server to just send everything to the client and let the client do the heavy lifting, so to speak. I also figured this is how cheat programs work - they intercept the server packets, get the location of enemies, then show them on the client's view.

So the question: What are some general policies or strategies a modern first person shooter server employs to keep its clients updated?

like image 875
Hooray Im Helping Avatar asked May 16 '10 20:05

Hooray Im Helping


People also ask

How do client/server games work?

A simple client-server interaction. In summary: the game state is managed by the server alone. Clients send their actions to the server. The server updates the game state periodically, and then sends the new game state back to clients, who just render it on the screen.

How does a multiplayer game server work?

A game server (also sometimes referred to as a host) is a server which is the authoritative source of events in a multiplayer video game. The server transmits enough data about its internal state to allow its connected clients to maintain their own accurate version of the game world for display to players.

How do multiplayer games communicate?

Play-by-email multiplayer games use email to communicate between computers. Other turn-based variations not requiring players to be online simultaneously are Play-by-post gaming and Play-by-Internet. Some online games are "massively multiplayer", with many players participating simultaneously.

Which network architecture is used in online multiplayer gaming?

In server-network (or server pool) architecture, there are several interconnected servers. Here, the communication graph can be thought as a peer-to-peer network of servers over a set of client/server subnetworks.


2 Answers

It's a compromise between your position and your friend's position, and each game will make a slightly different decision on this to achieve their desired trade-off. The server may try not to send more information than it needs to, eg. performing the distance check, but inevitably will send some information that can be exploited, such as sending the position of an enemy that is behind a rock, simply both because it is too expensive for the server to calculate the exact line of sight each time and also for the latency issue you mention.

Typically you'll find that FPS games do tend to 'leak' more information than others because they are more concerned with a smooth game experience that requires a faster and more regular rate of updates. Additionally, unlike MMOs, an FPS player is usually at liberty to move to a different server if they're finding their game ruined by cheats.

Some additional reading:

  • Multiplayer and Network Programming Forum FAQ @ Gamedev.net
  • Networking for Game Programmers @ GafferOnGames
  • Source Multiplayer Networking @ Valvesoftware.com
like image 95
Kylotan Avatar answered Oct 09 '22 02:10

Kylotan


The general policy should be not to trust the clients, in the sense that the developer should assume that anyone is able to rewrite the client from scratch.

Having said that, I think it's hard to avoid sending this kind of information to the client (and prevent this kind of cheating). Even if there is no line of sight, you may still need to send positions (indirectly) since clients may want to utilize some surround-sound system which requires 3D locations of sound-sources etc.

like image 40
aioobe Avatar answered Oct 09 '22 00:10

aioobe