Playgama
  • Welcome
  • 🚀Quick start
  • Submitting a game
  • Game Requirements
    • 💥Self-check
    • Technical Requirements
    • Advertising Requirements
    • User Experience Requirements
    • Content Requirements
    • Other Requirements
    • Platform-Specific Requirements
  • In-Game Purchases
    • Step-by-step IAP integration guide for Unity
  • FAQ
    • General
    • Submitting a Game
    • Game Moderation
    • Payments and Statistics
  • SDK
    • Getting started
    • Engines
      • Core (Plain JS)
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Unity
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Construct 3
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • GDevelop
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Godot
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Game Maker
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Defold
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Cocos Creator
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
    • Playgama Bridge Config
    • Changelog
  • For Partners
    • Getting Started
    • Embed the Widget
      • Adding Games Widget to Your WordPress Site
      • Adding Games Widget to Your Tilda Site
      • Adding Games Widget to Your Framer Site
    • Import the Game Catalog
    • Share your referral link
Powered by GitBook
On this page
  1. SDK
  2. Engines
  3. Cocos Creator

Platform Parameters

PreviousSetupNextUser Data

Last updated 2 days ago

At any time, you can retrieve values for specific parameters that you might use in your game, such as the user's browser language.

Platform ID

Identify the platform on which the game is currently running to customize features and settings accordingly.

bridge.platform.id

Returns the platform ID on which the game is currently running. Possible values: playgama, vk, ok, yandex, facebook, crazy_games, game_distribution, playdeck, telegram, y8, lagged, msn, poki, qa_tool, mock.

Language

Check the language to display proper text labels.

Get the language set by the user on the platform or the browser language if not provided by the platform, to localize game content.

bridge.platform.language

Returns the language set by the user on the platform. If the platform does not provide this data, it returns the browser language. Format: ISO 639-1. Example: ru, en.

URL Parameter

Embed auxiliary information into the game URL to pass additional data or settings when launching the game.

bridge.platform.payload

Allows embedding auxiliary information into the game URL.

Platform
URL Format

VK

http://vk.com/game_id#your-info

Yandex

http://yandex.com/games/app/game_id?payload=your-info

Crazy Games

crazygames.com/game/game_name?payload=your-info

Mock

site.com/game_name?payload=your-info

Domain Information

Retrieve the top-level domain of the platform to handle domain-specific configurations and behavior.

bridge.platform.tld

Returns the top-level domain (TLD) of the platform. If there is no data – null. If the data is available – com, ru, etc.

Is Get All Games Supported

Verify whether the platform supports the GetAllGames method to retrieve the correct links to the developer's other games.

bridge.platform.isGetAllGamesSupported

Is Get Game By Id Supported

Verify whether the platform supports the GetGameById method to retrieve the correct link to a specific game.

bridge.platform.isGetGameByIdSupported

Get All Games

This method retrieves the correct links to the developer's other games.

bridge.platform.getAllGames()
    .then(gammes => {
        if (bridge.platform.id === "yandex") {
            for (const game of games) {
                console.log("AppID:", game["appID"])
                console.log("Title:", game["title"])
                console.log("URL:", game["url"])
                console.log("CoverURL:", game["coverURL"])
                console.log("IconURL:", game["iconURL"])
            }
        }
    })

Get Game By Id

This method retrieves the correct link to a specific game from the developer.

async getGamyById() {
    const gameId = this.gameIdInputField.string;
    try {
        const game = await bridge.platform.getGameById({ gameId });
        console.log(`onGetGameByIdCompleted, success: true, game:`);
        console.log(`App ID: ${game["appID"]}`);
        console.log(`Title: ${game["title"]}`);
        console.log(`URL: ${game["url"]}`);
        console.log(`Cover URL: ${game["coverURL"]}`);
        console.log(`Icon URL: ${game["iconURL"]}`);
    } catch (error) {
        console.error(`onGetGameByIdCompleted, success: false, error:`, error);
    }
}

The call to sendMessage with the parameter game_ready is mandatory!

Don't forget to implement it.

Send predefined messages to the platform to trigger specific actions or events, such as signaling that the game is ready.

To use platform PLATFORM_MESSAGE you need to import type from playgama-bridge.ts Here is example

import { VISIBILITY_STATE,BANNER_STATE, INTERSTITIAL_STATE, REWARDED_STATE, STORAGE_TYPE, PLATFORM_MESSAGE, ACTION_NAME, EVENT_NAME, BANNER_POSITION } from '../../extensions/playgama-bridge/playgama-bridge.ts';

In example above, we import all types from the file, but in your file you can import only PLATFORM_MESSAGE

sendGameReadyMessage() {
    bridge.platform.sendMessage(PLATFORM_MESSAGE.GAME_READY)
        .then(() => {
            console.log("Game ready message sent.");
        })
        .catch((error) => {
            console.error("Failed to send game ready message:", error);
        });

The game has loaded, all loading screens have passed, the player can interact with the game.

Any loading within the game has started. For example, when a level is loading.

In-game loading has finished.

Gameplay has started. For example, the player has entered a level from the main menu.

Gameplay has ended/paused. For example, when exiting a level to the main menu, opening the pause menu, etc.

The player reached a significant moment. For example, defeating a boss, setting a record, etc.

Server Time

getServerTime(){
    bridge.platform.getServerTime()
        .then((time) => {
            console.log("Server time: ", time);
        })
        .catch((error) => {
            console.error("Failed to get server time:", error);
        });
    }

Current Visibility State

Check if the game tab is visible or hidden, and adjust game behavior accordingly, such as muting sound when hidden.

bridge.game.visibilityState
onVisibilityStateChanged(state: VISIBILITY_STATE) {
    console.log("Visibility state changed: ", state);
}

Returns the current visibility state of the game (the tab with the game). Possible values: visible, hidden.

React to visibility state changes. For example, mute the game sound when hidden and unmute when visible.

Sending a Message to the Platform

PLATFORM_MESSAGE.GAME_READY
PLATFORM_MESSAGE.IN_GAME_LOADING_STARTED
PLATFORM_MESSAGE.IN_GAME_LOADING_STOPPED
PLATFORM_MESSAGE.GAMEPLAY_STARTED
PLATFORM_MESSAGE.GAMEPLAY_STOPPED
PLATFORM_MESSAGE.PLAYER_GOT_ACHIEVEMENT