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:
This is how a game looks on a TV set using the split-screen option:
This is how a game looks on a TV set using the full-screen option:
The game background can (and should) be enriched with additional elements when running in full screen mode on a TV set.
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 thesrc
attribute. - HTML event attributes like
onclick
andonload
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 theeval
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
andsetInterval
. 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.