# GameSnacks requirements

This document uses the following terms (following
[RFC 2119](https://www.ietf.org/rfc/rfc2119.txt)):

- **must** and **must not** --- these are hard requirements that all games are required to comply with;
- **should** and **should not** --- these are recommendations that are not required but may be used when deciding how to rank or filter the games shown to users. For example, if the user's screen is landscape GameSnacks may choose to only recommend games that support this [aspect ratio](https://developers.google.com/gamesnacks/developer/requirements#aspect_ratio).
- **may** --- these are suggestions that aren't required and won't be used to filter games except where explicitly requested by the user. For example, future features could allow the user to view a list of games that support [gamepad](https://developers.google.com/gamesnacks/developer/requirements#game_interaction) input.

The following requirements apply to your game and its assets:

## Game structure

Your game is uploaded as a bundle of files that includes the code and runtime
resources of the game itself, the marketing assets for displaying it
within the GameSnacks catalog, and a
[`game.json`](https://developers.google.com/gamesnacks/developer/game-json) file that stores metadata
describing the game and enumerates all of the resources in the bundle.

### game.json

The config file containing the metadata for the game.

- Your game **must** include a [`game.json`](https://developers.google.com/gamesnacks/developer/game-json) file that contains all **required** fields.
- This file **must** be placed in the root directory of the game.

### HTML entrypoint

The HTML document that loads your game.

- Your entrypoint **must** be a valid HTML file.
- This file **must** include at most one `head` element and one `body`
  element.

  - Both elements, if present, **must** have both a start and end tag.
  - Content outside these elements and attributes on these elements will be
    ignored.

    Instead of setting attributes on the `body` element directly, you can
    use:
    - `onload`: `Window`'s [load event](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event)
    - `style`: CSS styling

### Files

All of the individual files in the bundle including the game and its associated
marketing assets must conform to the following:

- Every file **must** be less than 10 MiB.
- Files **must** only be referenced using relative paths.
- Paths **must** use only `/` as the directory separator.
- File names **must** only use [unreserved characters (RFC 3986)](https://datatracker.ietf.org/doc/html/rfc3986#section-2.3).
- File names and all paths **must** be in lower case.

### Game size

The game size is the total size of all of the code and resources
that are downloaded to the user's device.

- The size of the game **must not** be more than 100 MiB.
  - This includes all of the files listed in [`files`](https://developers.google.com/gamesnacks/developer/game-json#fields) in [`game.json`](https://developers.google.com/gamesnacks/developer/game-json) and does **not** include marketing assets.

## Technical requirements

Your game must conform to the following technical requirements.

### GameSnacks SDK

- Your game **must** be integrated with the [GameSnacks Developer SDK](https://developers.google.com/gamesnacks/developer/sdk) including all of the **required** interfaces.
- Your game **must not** directly load any ads APIs (e.g. injecting an ads tag like adsbygoogle.js).
  - GameSnacks will load all of the required ads services for you.
  - See [monetization requirements](https://developers.google.com/gamesnacks/developer/requirements#monetization) for more information about supporting ads within your game.

### Browser compatibility

- Your game **must** use either [the Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) or [WebGL](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) to render.
- Your game **must** run correctly on the two most recent major versions of the following browsers:
  - Chrome on Android, iOS, Windows and macOS
  - Safari on iOS and macOS
  - Firefox on Android and Windows
  - Edge on Windows
- Your game **must** run correctly within web views on the latest versions of the last two major releases of Android and iOS:
  - WebView on Android
  - WKWebView on iOS
- Your game **should** be tested on as wide a range of other standalone and embedded web renderers as feasible.

### Minimum device capabilities

Your game **must** run well on low end devices. For guidance, the following are
indicative of the minimum device capabilities required for GameSnacks games.

- Your game **must** run at 30 fps or greater on any device with the following
  specs or better:

  - CPU: Qualcomm 215, Samsung Exynos 7570, Mediatek MT6737, or similar
  - RAM: 2 GiB
  - GPU: Arm Mali-T720 MP1, Qualcomm Adreno 308, or similar

  Example phones that match this spec include JioPhone Next, Nokia 1.4, LG
  K22, Samsung J2 Core, and Motorola Moto E4

### Initial download size

The initial download size is the amount of data that will be downloaded to the
client to start the game.

- The initial download **must** be less than 15 MiB.
- The initial download **should** be less than 5 MiB.

## Functional requirements

Your game must conform to the following functional requirements.

### Load time

Load time is the time taken to initially run the code and start the game.

- Your game **must** show a loading screen or be interactive in less than 1 second on any connection of at least 10 Mbps.
- Your game **must** be playable in less than 15 seconds on any connection of at least 10 Mbps.

### Crashes

- Your game **must not** cause consistently reproducible crashes.
- Your game **must not** cause consistently reproducible crashes in apps or websites that embed it.

### Aspect ratio

GameSnacks will create a frame for your game to render into. The size and
aspect ratio of this frame will vary depending on the distribution surface,
device and the presence of ads placed around the game. This frame can change
size if, for example, a user resizes their browser window.

- Your game **should** use all of the available area within the frame for interactive content--without additional padding or filler.
- Your game **must** support a 9:16 portrait aspect ratio.
- Your game **should** support a 16:9 landscape aspect ratio.
- Your game **should** support a 1:1 square aspect ratio.
- Ideally, your game **should** be responsive and support a wide range of portrait, landscape and square aspect ratios.
- When the frame size changes, your game **must** immediately resize to follow these requirements.
  - Your game **should** transition smoothly to the new size.
- Your game **must not** lock the browser orientation.

### Game interaction

- Your game **must** be entirely playable using touch input.
- Your game **must** be entirely playable using mouse input.
- Your game **should** be entirely playable using keyboard input.
- Your game **may** be entirely playable using [gamepad](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API/Using_the_Gamepad_API) input.
- All UI elements displayed within your game **must** be implemented and function correctly.
- Your game **must not** include disabled controls--if a feature is not available it must be removed entirely from the UI.
  - This includes reward prompts; only render a reward prompt if the [`beforeReward`](https://developers.google.com/gamesnacks/developer/sdk/ad/break) callback for that ad break is called.
- Your game **must not** display in-game sharing prompts.
- Your game **must not** display UI or in-game links that take the user to external games, sites, or other content.
- Your game **must** clearly communicate to the user when they have completed the last level or finished the game.
- Your game **must not** use words like "buy" or "purchase" that could be confused with in-app purchase features that are not supported for GameSnacks games.
- If your game includes haptic feedback the user **must** be able to switch it off.

### Game startup

Your game must correctly coordinate with the GameSnacks runtime at startup.
The GameSnacks [`Game`](https://developers.google.com/gamesnacks/developer/sdk/game) interface provides functions to signal
the loading state of your game including:
[`firstFrameReady`](https://developers.google.com/gamesnacks/developer/sdk/game/firstframeready)
when you are ready to draw to the screen for the first time, and
[`ready`](https://developers.google.com/gamesnacks/developer/sdk/game/ready)
when the user can start interacting with your game.

- Your game **must** call [`firstFrameReady`](https://developers.google.com/gamesnacks/developer/sdk/game/firstframeready) when the first frame of your game is ready to be rendered.
- Your game **must** call [`ready`](https://developers.google.com/gamesnacks/developer/sdk/game/ready) when it is ready for user interaction.
- Your game **must not** call [`ready`](https://developers.google.com/gamesnacks/developer/sdk/game/ready) while there are still non-interactive elements being displayed, such as splash screens or loading screens.

### Mute controls and sound handling

Your game must respect the GameSnacks platform sound controls.

- Your game **should not** show an overall mute button and **should** instead rely on the GameSnacks platform mute control for this.
- Your game **must** integrate with the [Audio interface](https://developers.google.com/gamesnacks/developer/sdk/audio) and **must** respect the [`audio.isEnabled`](https://developers.google.com/gamesnacks/developer/sdk/audio/isenabled) method.
- Your game **may** have separate granular audio controls in the game, such as for background music or sound effects, but it **must** still follow these requirements.

### Pause and resume

Your game must support being paused and resumed.

- Your game **must** integrate with the [Game interface](https://developers.google.com/gamesnacks/developer/sdk/game) [`onPause`](https://developers.google.com/gamesnacks/developer/sdk/game/onpause) and [`onResume`](https://developers.google.com/gamesnacks/developer/sdk/game/onresume) methods for pausing and resuming game play.
- Your game **must not** use the web Page Visibility API or similar web APIs.
- Your game **must** clearly communicate to the user if it's paused.
- Your game **should** save user progress when it is paused.

### Data handling

**Only** use the GameSnacks storage APIs for handling data.

- Your game **must** only use the [Storage interface](https://developers.google.com/gamesnacks/developer/sdk/storage) for saving game data.
- Your game **must not** use **any other form of storage** including cookies, `localStorage`, `sessionStorage`, and `IndexedDB`.
- Your game **must not** collect any user data.
- Your game **must not** make any external calls or data requests to or from any server using any protocol.
- Your game **must not** display any additional user agreements, privacy policies, or other data collection or regulatory messages.

### Saving progress

Save the user's progress and be able to restore their progress when they
return to the game.

- Your game **must** use the [Storage interface](https://developers.google.com/gamesnacks/developer/sdk/storage) to save progress when users have made material progress, such as completing a level.
- The total size of saved game **must** be less than 3 MiB and **should** be less than 500 KiB.
- Your game **must** restore any saved progress when the game starts.
- Your game **must** be able to restored saved progress from previous versions of the game.

### High scores

Store the user's highest score or track their progress using a different metric.

- If your game has scores, your game **must** track them using the [Score interface](https://developers.google.com/gamesnacks/developer/sdk/score) interface.
- If your game doesn't have scores you **should** track an alternative progress metric such as number of levels completed.

## Game content

The following requirements apply to the content of your game:

### Game UI

- Your game **must** render clearly across different screen resolutions. For example, UI elements **must not** be blurry, pixelated, or stretched.
- Your game **should not** use low resolution rasterized assets that appear blurry when scaled to larger screens.
- Your game **must not** use icons that could be confused with those on the GameSnacks action bar.
- Your game **must not** include an in-game exit or quit buttons. This will be handled by the app or site that embeds your game.

### Localization and accessibility

- Your game **must** support the English language.
- Your game **should** make a best effort to be accessible. We recommend aiming to meet the [Web Content Accessibility Guidelines](https://www.w3.org/WAI/standards-guidelines/wcag/) (WCAG), level AA.
- Text within your game **must** be legible across devices and screen sizes. See [WCAG 2.2 §1.4.3](https://www.w3.org/TR/WCAG21/#contrast-minimum).

### Child-directed content

- Your game **must not** specifically target kids. See [Determining if your content is "made for kids"](https://support.google.com/youtube/answer/9528076) for more information.

### Rights and clearances

- Your game **must** have fully cleared third-party intellectual property rights.
- Your game **must not** infringe on any third-party trademark or trade dress rights.
- Your game **must** have all necessary music rights.
- Your game **must** have all necessary personality rights, including name and likeness.

## Where will my games show?

We publish GameSnacks games on a range of surfaces both on Google products and
GameSnacks partner sites and apps, on both mobile and desktop. Some examples of
where we publish GameSnacks games includes the Google Play Games App, on Android
devices, and the gamesnacks.com website. This is where much of our traffic
currently comes from. However, the locations where we publish games are
constantly evolving and we're always looking to expand the audience for
GameSnacks games. So over time we may add new Google surfaces or distribution
partners. From time to time we may also run experiments as we work with new
distribution surfaces.

## Monetization

GameSnacks will monetize your game and will provide you with a share of that
revenue per GameSnacks developer licensing agreement.

GameSnacks can automatically place ads at natural game events such as prerolls,
next- and end-of-level events. You can also place additional ad breaks within
your game (both interstitial and rewarded) using the GameSnacks Developer SDK
[Ad interface](https://developers.google.com/gamesnacks/developer/sdk/ad).

Games that have too few opportunities for monetization or monetize poorly may be
surfaced less frequently, or not approved for distribution. A good rule of thumb
is to **make sure there is an opportunity for an ad at least once a minute**.
This includes both interstitials and rewarded ads that you place, and the ad
breaks that GameSnacks sets up automatically for you.

However, this doesn't mean that we'll always show an ad. GameSnacks will
carefully balance ad load, engagement, and user experience. You should
therefore feel free to create ad breaks anywhere they fit well within your game
(i.e. more than once per minute) and let GameSnacks adjust the final rate at
which ads are shown.

Monetization requirements:

- Your game should offer a continuous, uninterrupted, experience of core
  gameplay with adequate opportunities to show interstitial and rewarded ads
  which **must** be configured using the Ad interface.

- You **must not** include any other form of promotion or monetization. This
  includes in-game ads, payments, sponsorships and product placements, social
  media prompts, and links that take users to external games, sites or other
  content.

- You **must** ensure your games provide enough opportunities to show ads so
  that both you and GameSnacks distribution partners can generate sustainable
  revenue. Either organically due to normal game events (e.g. next level) or
  explicitly by using the Ad interface methods at other appropriate moments
  during your game.

- When using the Ad interface methods to place ads within your game you
  **must** adhere to all relevant interstitial and
  [rewarded behavioral policies](https://support.google.com/publisherpolicies/answer/11975916).
  Also see this set of
  [best practices](https://services.google.com/fh/files/helpcenter/h5_games_policy_best_practices_infographic.pdf)
  for further tips on configuring in-game ads.

- If you are placing interstitial ads within your game you **must** ensure
  that they happen at natural breaks in the gameplay. Ads **must** fit into
  the flow of your game. You **must not** just trigger interstitials in the
  middle of a period of continuous game play.

- If your game mechanics support it you **should** place rewarded ads. These
  reward opportunities **must** be optional, you **must** clearly describe
  them, and you **must not** encourage the user to click ads. See the
  [behavioral policies](https://support.google.com/publisherpolicies/answer/11975916)
  for the full requirements.