Our Properties: Gamasutra GameCareerGuide IndieGames Indie Royale GDC IGF Game Developer Magazine GAO
My Message close
Contents
Building Games that Run on Poor Mobile Connections
 
 
Printer-Friendly VersionPrinter-Friendly Version
 
Latest News
spacer View All spacer
 
February 23, 2012
 
Interview: Silver Dollar uses XBLIG for its mad experiments
 
Last year's Supreme Court case on games cost California $1.8M [6]
 
GDC 2012 details Moriarty, Della Rocca, 'Rant' sessions in Education Summit [1]
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
February 23, 2012
 
2K Games
Public Relations Manager - 2K Games
 
2K Marin
Level Designer
 
2K Marin
Senior Rendering Programmer
 
Zindagi Games
Presentation/Game Programmer
 
The Workshop
Art Director
 
Blizzard Entertainment
Senior Software Engineer, Tools
spacer
Latest Features
spacer View All spacer
 
February 23, 2012
 
arrow Postmortem: Days of Wonder's Ticket to Ride Pocket [1]
 
arrow Sponsored Feature: Canada - Scoring High as a Game Nation [3]
 
arrow The Vita Interview [19]
 
arrow Gamification Dynamics: Identity and Story [7]
 
arrow What Makes Social Games Social? [3]
 
arrow Will Tablet Game Quality Soon Leapfrog Consoles? [27]
 
arrow Tearing Down Barriers: How to Bring MMO Players Together [10]
 
arrow Withstanding the Collapse of the Middle [4]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
February 23, 2012
 
Piracy and the four currencies [5]
 
The Secondary Costs of Outsourcing [10]
 
Sixty to Zero [4]
 
The Combinatorial Itch [5]
 
God Games and the Superman Complex [13]
spacer
About
spacer Editor-In-Chief/News Director:
Kris Graft
Features Director:
Christian Nutt
Senior Contributing Editor:
Brandon Sheffield
News Editors:
Frank Cifaldi, Tom Curtis, Mike Rose, Eric Caoili, Kris Graft
Editors-At-Large:
Leigh Alexander, Chris Morris
Advertising:
Jennifer Sulik
Recruitment:
Gina Gross
 
Feature Submissions
 
Comment Guidelines
Sponsor
Features
  Building Games that Run on Poor Mobile Connections
by Bernt Habermeier [Programming, Social/Online, Smartphone/Tablet]
2 comments Share on Twitter Share on Facebook RSS
 
 
January 26, 2012 Article Start Page 1 of 4 Next
 

In this article we'll walk you through how you can make your mobile web game resilient to poor network conditions. Many excellent developers are used to developing games for the desktop environment, but often don't think about network reliability when they implement their apps. When you find that your app freezes up over a cellular network you can shrug and blame the carrier, or you can roll up your sleeves and fix the problem. We'll teach you how to fix such problems and discuss the creation of multiplayer games that play great even in areas where the user's cellular coverage is not great. 

It turns out that some of the old methods from way back came in handy when I recently wrote the cellular-network-friendly networking code for Moblyng's Social Poker Live. I have a few years experience working on games over questionable network connections, including 28.8k - 56k modems.


Try It Before You Buy It  

Before we dive into what the issues are and how to solve them, I'd like to quickly review the game so you can see what I'm talking about is a solution we used in a feature rich, live production quality title.

Social Poker Live is a multiplayer poker game that can be played in real-time, over any internet connection on iOS and Android mobile devices (phones and tablets), and it's resilient to spotty network conditions.

For example, you can play the game on Caltrain going from San Francisco to Redwood City, and will recover going through tunnels and the like.

Of course, the game also runs well on a desktop, but in this article we'll focus on the mobile experience. Try out Moblyng's Social Poker Live on your iOS or Android phone at http://poker.moblyng.com.

Here are some screenshots of the typical user experience, starting with the loading screen, all the way to the winning screen. One neat feature is that we'll discover which of your Facebook poker pals are online, and ask you if you'd like to join their table. Here is what that looks like:

I'd like to encourage you to load the game in Chrome, bring up the developer tools, look at the Network tab, and go back to the game to sit at a table. You'll see the data passed back and forth between the client and the server, including packet identifiers and acknowledgements that we'll talk about in the rest of the article.

Problems? What Problems?

The common perception is that it's difficult to implement real-time multiplayer games on mobile devices. It's true that this type of game is more involved than implementing a typical social game where the game doesn't require down to the second data synchronization across a group of players, but it's not terribly difficult either. There tends to be two problems with multiplayer real-time games: scalability and networking over a cellular network. This article talks about the latter -- how to get reasonable networking performance even over spotty 3G cellular networks using HTML and JavaScript.

Gimme Updates!

Traditional web technologies are decent with issuing requests to servers. The client knows when it wants some piece of information and hits the server with an HTTP request, and as a result the server scrambles to offer up the request as quickly as it can.

In multiplayer games the game client knows it wants game updates as quickly as possible, but it doesn't know when to ask for such information. This doesn't fit well with a model where the client has to initiate the request for data. When do you ask for an update?

You could just hit up the server once a second with an active poll request. Your operations manager could also decide to hit you once a second over your noggin because that's not efficient for neither the client or the server. All hitting aside, you won't get sub-second response times -- especially over a cellular network.

 
Article Start Page 1 of 4 Next
 
Comments

Ilya Belyy
profile image
That's interesting, thanks for sharing.

On a high level, it looks very much like an implementation of a reliable game protocol over something like UDP. This part of the task is essentialy the same, you are working on top of unreliable long polls and lost connections, rather than unreliable datagrams and lost packets.

That's annoying how the android browser lags behind chrome far more than ios browser compared to safari.

Anatoly Ropotov
profile image
Did you encounter a lot of unexpected crashes due to memory leaks in handling of socket.io on mobile webkit in iOS 4.x, terrible time restoring the game state after an incoming call or being disrupted by on-screen push message and all other crap like that? I doubt that realtime games as webapps will ever make sense, unless you wrap them with PhoneGap (which has some WebKit prev-generation limitations) and then you are still at disadvantage over native apps.


none
 
Comment:
 




UBM Techweb
Game Network
Game Developers Conference | GDC Europe | GDC Online | GDC China | Gamasutra | Game Developer Magazine | Game Advertising Online
Game Career Guide | Independent Games Festival | Indie Royale | IndieGames

Other UBM TechWeb Networks
Business Technology | Business Technology Events | Telecommunications & Communications Providers

Privacy Policy | Terms of Service | Contact Us | Copyright © UBM TechWeb, All Rights Reserved.