Skip to content
Michal Vodička edited this page Sep 1, 2017 · 1 revision

Building the package

Game is uploaded to the GAMEE Platform as a zip package via private administration system. The package must contain the index.html file in the root.

Other Rules

  • The package must contain gamee-js framework (latest version). Framework will guarantee the functionality on every platform that GAMEE covers.
  • index.html can link to scripts, css files, images and other data files in the package. It is expected index.html will point to gamee-js.min.js too.
  • Package size is limited to 5MB.
  • Any network requests are foribidden. Game can use packed assets and framework functionality only to get some data.
  • Accessing to the cookies, local storage etc. is prohibited. Attempts will result in unspecified behavior on various platforms. Use the platform features instead.
  • Using javascript features is limited by the webview capabilities of the platforms. Stick to the widely supported javascript functionality only.

Functionality on the platform

Each game on the GAMEE Platform is supposed to have the specific life cycle. Gamee-js framework offers features that allows to follow it. Game developer must implement them in order to make the game work within the GAMEE Platform. Implementation of these featuers is mandatory. Everything else is optional.

The basic life cycle

  1. Player selects the game from GAMEE app (or starts the game from web|bot). Player will enter the game lobby.
  2. Inside the game lobby the data are being downloaded with visible percentual progress.
  3. Once are data loaded your index.html file is executed. GAMEE Platform waits for the signal to continue. During this process your game can execute scripts and prepare for running. What player sees is the spinning circle now without the percentual value.
  4. Once your scripts are ready the game should notify the GAMEE Platform with the ready signal. The platform reacts with showing the play button to the player. Clicking the button will start the game session.
  5. Once player hits the button the GAMEE Platform notifies the game with the start signal and removes the game lobby overlay. Game should start. Interaction with the player is now in your hands. There is still a top bar which belongs to the GAMEE Platform and can't be controlled or removed. Based on the controller you chose there can also be an additional bottom part with the controller buttons. During the session your game is supposed to notify the platform with score updates. New score will reveal in the top bar.
  6. During the game session player can hit the tripple dot in the right top corner. Then GAMEE Platform notifies the game with pause signal and put the overlay on the screen. Game shouldn't continue. Player can choose to go back to the game session. If he does GAMEE Platform notifies the game with resume signal. Game should continue.
  7. During the paused session player can mute & unmute the sound. This will cause the GAMEE Platform to send the notification with mute or unmute signal. Game should mute or unmute the sound completely.
  8. Once you want to end the game (due to player death for example) the game should notify the platform with gameover signal. The GAMEE Platform will react with showing the overlay to the player. Player is back in the game lobby where is the replay button. When the player hits the button the GAMEE Platform will notify the game with a new start signal which should be resolved as the step 5.

Code integration

In this section we will go step by step thru the integration with code examples.

Gamee-js framework exposes the gamee object. The most of the gamee object methods requires callback as one of the input arguments so it is the standart request & response async mechanism. Sometimes response doesn't contain any useful information and the callback might be ommited.

Choose the setup

Once the index.html file is executed, game developer must choose some controller the game will use and optionally some of the GAMEE capabilities. Then do the first handshake with gameInit method with arguments according to the chosen setup.

From the controllers the most prefered is the FullScreen controller which gives the developer full controll over the game and also more game space on the screen. For the FullScreen controller GAMEE Platform doesn't guarantee any resolution. Game must handle the resolution on its own by detecting the size of the window.

From the capabilities the most prefered is the saveState capability, which replicates the cookie | localstorage functionality.

In the callback game will receive previously saved data and current sound setup. Till this point it is forbidden to replicate any sound.

var capabilities = ["saveState"];

gamee.gameInit("FullScreen", {}, capabilities, function(error, data) {
    if(error !== null)
        throw error;

    var sound = data.sound;

    var saveState = data.saveState;

});

More about the gameInit method

Kick it!

Once the game did the inital handshake it is free to call gameReady method which simply notifies the platform game is ready to start.

gameReady doesn't have any arguments except the callback which is optional. The simplest call:

gamee.gameReady();

More about the gameReady method

The game must be able to handle start signal from the platform before it calls the gameReady. From the moment game called gameready it must be able to handle the start event any time it occurs repeatedly. start event occurs when player starts the game, restart it or desires to run the game in the ghost mode or the replay mode.

Listening to the start event (events are propagated via the emitter property):

gamee.emitter.addEventListener("start", function(event) {

    // create a new game session here
    // ... and maybe toss the current one

   event.detail.callback();
}); 

It is strongly recommended to handle the game session as a singleton pattern. Each time start event occurs the current game session should be ended and new one must start within the shortest possible time. Once game reacts it should call the callback. The callback is an event.detail property.

More about the gamee.emitter

Gameplay

During the gameplay the game is supposed to increase the player score. Game will achieve that by using the updateScore method.

gamee.updateScore(10); // set score to 10

Only unsigned integers are allowed. Increasing the score should happen every time the score changes in the game.

More about the updateScore method

During the gameplay player might wish to pause the game or manipulate the sound. Both things are doable from the platform. Game is supposed to listen to the events and react as fast as possible. Once game reacts it should call the callback. The callback is an event.detail property. Callback will notify the platform it was done properly.

gamee.emitter.addEventListener("pause", function(event) {
   // your code to pause the game

   event.detail.callback();
}); 

gamee.emitter.addEventListener("resume", function(event) {
   // your code to resume the game

   event.detail.callback();
});

gamee.emitter.addEventListener("mute", function(event) {
   // your code to make game silent

   event.detail.callback();
});

gamee.emitter.addEventListener("unmute", function(event) {
   // your code to make game produce sound again

   event.detail.callback();
});

More about the gamee.emitter

Complete the circle

Once game session should end (for any reason), game calls the gameOver method.

gamee.gameOver();

gameOver callback argument is optional. One method is called GAMEE Platform covers the game with the overlay so the game shouldn't project any important content. In the overlay there is restart button wich will trigger new start event.

More about the gamee.gameOver

At this point the basic integration is complete and your game should work within the GAMEE Platform.

Clone this wiki locally