mozilla
Your Search Results

    Special considerations for game developers

    This article describes some of the considerations for developing game apps, beyond the basics of Getting Started. Of particular interest are: being able to play the game offline (with caveats and limitations), saving player information, and allowing players to interact with friends.

    Making games playable offline

    Using apps offline describes a set of techniques which can be used to make your game playable when your app or browser is not connected to the Internet. At a minimum, you'll want to use the application cache to ensure that basic structure of your game itself is always available. This also has the advantage that once it's been loaded into the user's cache, subsequent loads of the game will be very quick.

    If your game has a significant amount of server-side logic, it may not be practical to be fully playable offline, but it can still be advantageous to persist enough data in either IndexedDB or DOM Storage so that if a player's connection disappears (e.g. their computer loses WiFi connectivity), they still have some partial ability to play locally, rather than having their game simply grind to a halt or behave unpredictably.

    Identifying players

    It's often interesting to have an ongoing relationship with individual players of a game, particularly when it makes sense to save a bunch of state (saved games, earned experience, etc.). You need to authenticate that the player interacting with the game now is the same as the one you remember. Available technologies for doing this include:

    • BrowserID — Players can demonstrate control of a given email address. Mozilla maintains public servers that can do much of the work for you, or you can run your own.
    • Twitter — Players can demonstrate control of a Twitter account using OAuth 1.0a; this requires a game to depend on Twitter and the servers it owns.
    • Facebook — Players can demonstrate control of a Facebook account using OAuth 2.0; this requires a game to depend on Facebook and the servers it owns.

    Identity information gained from one of these methods can then be used by the game server to authorize access to accounts which offer such things as saved games, friend lists, photos, or other valuable resources.

    Making games social

    Multiplayer games can benefit from allowing players to choose to compete against lists of their friends or to interact with them in other ways as part of gameplay. Both Twitter and Facebook offer the ability to get lists of friends/followers as well as a variety of other APIs.

    See also

    Document Tags and Contributors

    Contributors to this page: Sheppy, ChrisL, ScottMichaud, kohei.yoshino, chrisdavidmills
    Last updated by: ChrisL,