Netcode

Things have gotten a lot busier in school. Longer grading periods, more reading, longer assignments, but I always make time for unwinding at least once a day. My main source of unwinding is playing Battlefield 4. If you play, this weekend there's actually a Double XP Boost going on for Player Appreciation Month, which by the way was only announced on Facebook and seems very odd that no official announcement was made on the actual Battlelog website. Anyways, although it is a fun game it can be stressful but in a good way ... until we get to the frustrations of it all.

The game can be very buggy at times and it can get quite annoying when I'm just trying to have fun. I'm okay with the stresses generated by the gameplay of attacking an objective with enemies ready to swarm in and kill. I'm okay with the stresses of being shocked around a corner by a shotgun. But playing a game in which bugs introduce possible preceived unfairness is not okay. But then again when I think about how massive this game is with at least one server and near 64 or more participants, I am inspired by how such a game even functions to begin with!

What is Netcode?

If you've been keeping along, you know I enjoy networking! The biggest feedback or complaint that users in Battlefield 4 have are of "netcode". What is this "netcode"? I had no idea what it was in the beginning. At first, I assumed it was just some premium code that users could get and get an advantage in the game because the statements I saw were things like "F--- netcode" or "Wow, you only killed me because of netcode". I later looked it up and all it means is the network programming code in the game that pretty much manages everything!

A prime example of raging against "netcode" would be if two players are shooting at each other and Player A kills Player B and Player B sees a clear "hit" indicator on his screen to show that his shot hit the player but Player A either has taken no damage or isn't killed. I've seen this a lot and I'm quite unhappy with it. This brings up a major perception issue. What has happened is that Player B's game decided that the hit was good but then the gaming logic or "netcode" when communicating with Player A's game and the server decided it wasn't good at all.

Why Does it Happen?

There isn't any reason this should happen but I assume that the developers just messed up the logic. If Player B's shot didn't hit Player A then there should be NO indication of it. There are, however, three main systems in play:

  1. Player A's gaming client.
  2. Player B's gaming client.
  3. The game server.

All three programs need to work together! They can range from being so far apart with 0 ms to 250 ms pings (if not more but most servers don't tolerate more than 250 ms pings) that you literally can get up to 1 second of delays! I've never designed a distributed gaming system so if you are reading this and have had experience, please enlighten me as I'm curious on what actually is implemented.

Action Delay
B tells Server that he shot. 250 ms
Server tells A that a shot was made. 250 ms
A tells Server that the shot was no good. 250 ms
Server tells B that the shot was no good. 250 ms
Total 1 sec

My Thoughts

Now, obviously I bet that there are shortcuts being made that most communication is made with the server and the server has the "true" information. So we can mostly bring it down to just half a second time of communication to say whether we hit the target or not. But then again another optimization is sometimes made in that for a smooth game play experience since data is always being communicated and the clients have some information about other users, that it can predict whether a shot was a hit or not based on that data and thus show a hit before any verification of it occurs! This is a lie to user perception if the guess was wrong!

So I'm guessing the biggest bugs are actually optimizations that are made on the client side! Thus users are perceiving actions that are predicted to be incorrect and this causes rage against "netcode".

I for one am not happy about it, but I understand that designing a game is complex. It does ruin part of the game play when your game indicates a clear hit or kill but in reality it actually isn't. If the design of the game eliminates such discrepancies then we'd all actually be much happier! Lies are the worst enemies and when we have proof, we are pissed.

I could go on and on discussing this topic actually, feel free to comment on your thoughts. Maybe another idea to cause discussion is how do you know if somebody actually hit someone in game when there is some delay or even a range of delays?

Kindle Reader on Mac OS X Bug
Oh Gosh Javascript


comments powered by Disqus