Battlefield 3's Innovative Social Network

DZone 's Guide to

Battlefield 3's Innovative Social Network

· Web Dev Zone ·
Free Resource

Gaming is bigger than ever, and the economic downturn apparently hasn't touched it: Modern Warfare 3 earned $775 million in five days, obliterating every book, game, and movie ever sold. (PC World's headline is great: 'Modern Warfare 3 Has Best 5-Day Sales in History of Known Universe'.)

From the developer's perspective, graphics and AI get plenty of attention -- though the rise of online play and serious single-player plotting have channeled some attention away from these pure coding achievements.

But nobody doubts that the people who program games are some of the best programmers around. So what happens if they redirect some of their coding skill to web applications?

The impressive result, says Armin Ronacher, is Battlelog, the browser-based, cutting-edge-web-technological social network for Battlefield 3 gamers.

Armin doesn't have behind-the-scenes access to the software, but he deconstructed the system pretty thoroughly. The core of his praise? Battlelog really gets how to relate client-side and server-side programs, in just the way modern web technologies are supposed to do (but don't always succeed at doing).

Here's an example:

If you send an HTTP request to the website it appears to work as if it was a regular website. You get a bunch of HTML rendered and nothing interesting happens. However if you click on any link you do not get HTML transmitted. Instead what is transmitted is JSON, the HTML5 history API is used to modify the URL dynamically and all the HTML is rendered on the client. Since it appears to be able to do both we can compare the sizes of the data transmitted easily.

The HTML for the index page is 18KB in size. If we trigger the request to the same URL with just the JSON it's 4KB. Not only is it less to transmit, it also means that the server is essentially just generating JSON instead of rendering whole templates which also means a performance improvement for the client.

The rest of Armin's post goes into much more detail. Check it out, and be inspired -- even if you're not a game developer -- by some really innovative web coding.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}