Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
StRiKeR

Explain what exactly is happening

Recommended Posts

My curiousity is running amuck, and I know there's quite a few programmers on these forums. So my question is:

Could you explain what exactly is happening when you are playing a game online, be it cooperative or deathmatch, and how the netcode "works"?

Share this post


Link to post

I don't know if you're looking for something specific, but I can explain the whole process in layman's terms.

Data is sent back and forth between your phone/cable line and the server(the computer hosting the program). In the case of games, the data may include information such as your position in the map, when you fire bullets, your score, et cetera. The server processes this information(along with the ones all the other players send) and squeezes it into a small update called a "packet", which it sends multiple times per second. These packets can be as large as 128k, but in DeathMatch games, they'd have to be much smaller. Your "ping"(which you've probably seen on DM scoreboards) tells you how fast you're receiving the packets-- If your ping is 100, then it takes 100ms(or 1/10 of a second) to receive the packet from the server.

Now, there are issues with hacks where a player can run a program in the background(or edit the game's code on your computer) dedicated to sending false information to the server. These can do anything from giving you incredible speed, to making walls invisible, to giving you perfect accuracy. To combat this, programmers must write their network code to 1. check that the game's files have not been tampered with, and 2. decide if data can be run on your machine with or without the server interacting. Some of these "checks" only have to be run once(like before you join a game), but in other cases the server has to check the "legality" of players' actions at all times. There are only so many things the server must check to see if the action is legal before the phone lines become crowded with information, so this remains an issue. For example, a server can allow game data like custom player models to stay on your computer(i.e. the model can be downloaded by other players before the game without being checked), but the programmers have to draw a line somewhere-- especially if your custom model makes you completely transparent.

That's the short version, I guess.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×