Skip to content

Latest commit

 

History

History
87 lines (67 loc) · 3.82 KB

best-practices.md

File metadata and controls

87 lines (67 loc) · 3.82 KB
layout title description
default
Best practices
Read the Phune Gaming best practices guidelines and apply them to your game development


Aspect ratio

For a seamless integration with the Phune Gaming platform we recommend all the games to be implemented using the aspect ratio of 1.775 (same as iPhone 5).

This is how a game looks on a smartphone device:

  • Mobile aspect ration
  • Mobile aspect ration

This is how a game looks on a TV set using the split-screen option:

  • TV split-screen aspect ration
  • TV split-screen aspect ration

This is how a game looks on a TV set using the full-screen option:

  • TV full-screen aspect ration
  • TV full-screen aspect ration
{% markdown %} The game background can (and should) be enriched with additional elements when running in full screen mode on a TV set. {% endmarkdown %}

CSP restrictions

Phune Gaming fully supports Firefox OS. However, Phune Gaming is distributed as a Firefox OS privileged type of app which enforces the CSP (Content Security Policy) by default.

This may cause existing code to break. To guarantee your game is fully functional on Firefox OS, follow the best practices below during the development:

  • Include all JavaScript and CSS files locally in your game instead of loading them remotely.
  • Don't embed JavaScript in <script> tags in HTML files since the inline scripts are banned. You should place the code in an external JavaScript file and reference it via the src attribute.
  • HTML event attributes like onclick and onload are also considered inline scripts, thus add them as event listeners in your JS files.
  • Don't assign content to the innerHTML property of dimanically created <script> tags.
  • Don't assign remote URLs to the src property of dinamically created <script> tags.
  • Don't use the eval() function or the eval operator.
  • Don't use the javascript: pseudo-protocol (e.g. <a href="javascript:alert('foo')">).
  • Don't use the Function() constructor.
  • Pass callable objects (i.e. functions) to setTimeout and setInterval. Strings and other data types are not callable objects.
  • Don't use plugins (e.g. <object>, <embed>, etc.).
  • Don't create Web Workers with remote URLs.

For additional information consult the applicable CSP restrictions for Firefox OS.


What's next? Go to Install Phune Gaming to learn how to install the Phune Gaming client platform.