Skip to content

Game Blobs

Stefaan Ternier edited this page Dec 5, 2015 · 7 revisions

Every game defines a media files (pictures, videos, audio files). Some of these files are bound to the game, some are specific to a general item (e.g. every video object should come with a media file that defines the video).

Retrieve the list of game files

When loading a game, one should first retrieve all media files and cache them locally on the device

REST GET:

myGames/gameContent/gameId/<gameId>

Example invocation:

myGames/gameContent/gameId/620064

Response

{
 "type": "org.celstec.arlearn2.beans.game.GameFileList",
 "gameFiles": [
      {
           "type": "org.celstec.arlearn2.beans.game.GameFile",
           "path": "/gameSplashScreen",
           "id": 5814590621351936,
           "size": 323487,
           "md5Hash": "1e45c2d6f64bb00bfea59b7369577939"
      },
      {
           "type": "org.celstec.arlearn2.beans.game.GameFile",
           "path": "/gameMessagesHeader",
           "id": 5831317103050752,
           "size": 44891,
           "md5Hash": "8a1bf1db29d14acc4895021ee5f9e37f"
      },
      {
           "type": "org.celstec.arlearn2.beans.game.GameFile",
           "path": "/map.zip",
           "id": 5785687538270208,
           "size": 4771281,
           "md5Hash": "c75f145eb2ed3bada6e8f36941fc1f32"
      },
      {
           "type": "org.celstec.arlearn2.beans.game.GameFile",
           "path": "/gameThumbnail",
           "id": 5781032968126464,
           "size": 71072,
           "md5Hash": "41a92aed44b187315a004e9d56f13d51"
      },
      {
           "type": "org.celstec.arlearn2.beans.game.GameFile",
           "path": "/background",
           "id": 5810345348169728,
           "size": 55861,
           "md5Hash": "48c63f5f1e5ed1e927bcc1d3c610c044"
      },
      {
           "type": "org.celstec.arlearn2.beans.game.GameFile",
           "path": "/generalItems/618057/audio",
           "id": 4943855258435584,
           "size": 401659,
           "md5Hash": "98f9f497baa47907cb6417a5aadca15f"
      },
      {
           "type": "org.celstec.arlearn2.beans.game.GameFile",
           "path": "/generalItems/617045/audio",
           "id": 4992075393138688,
           "size": 779076,
           "md5Hash": "c812bb4e9aa80cfbfb52f960777de897"
      }
 ]
}

Game File metadata

Every GameFile defines 4 metadata fields

  • The path defines where the file can be retrieved on the server. For instance /background is to be concatinated with the base game url http://streetlearn.appspot.com/game/620064 to http://streetlearn.appspot.com/game/620064/background where the file can be downloaded. When building a local cache it is a good idea to maintain this folder structure on the mobile device, so that relative hyperlinks in the html files that constitute a general item, still work.
  • id: every game file has a unique identifier
  • size defines how big the file is in bytes
  • md5Hash can be used to determine whether the file was updated on the server. A local file for which the hash differs from the server hash must be updated.

Game media

Some paths are reserved and are used to build the game UI:

  • /gameThumbnail defines the game icon. When users search for games in the game library, this icon is used to graphically represent the game
  • /gameSplashScreen defines the splash screen of the game, shown when a users opens a game.
  • /background defines the background to be used when showing e.g. the message list to user
  • /gameMessagesHeader defines the message headers, shown at the top in map view and in image view.
  • /map.zip enables caching map tiles. This enables offline usage of maps.

General item media

General items paths start with /generalItems/<generalItemId>. The following general item files are reserved:

  • /generalItems/<generalItemId>/video defines the video file to be used by in a Video Object
  • /generalItems/<generalItemId>/audio defines the audio file to be used by in an Audio Object

Apart from these reserved files users can define there own paths. A user can for instance define /generalItems/<generalItemId>/myPicture.png and then refer to this file in the rich text of a general item as follows:

<img src="generalItems/<generalItemId>/myPicture.png" />

Clone this wiki locally