Creating and publishing your g...
Best practices
11min
Try the AirConsole Checklist before submitting your game!
- Try to test your game on as many as different phones and screens as possible.
- Make sure all resources (external JS, CSS files etc.) can be loaded over https.
- Games shouldn't request a separate login.
- Having problems during development? Check the airconsole tag on StackOverflow - somebody might have had the same issue before.
- Use <div> tags with a background-image style as buttons instead of <input> or <img> tags.
- Use touchstartand touchendfor event handlers instead of clickor mousedown.
var button = document.getElementById('button_1');
button.addEventListener('touchstart', touchdownHandler);
button.addEventListener('touchend', touchendHandler);
Or try the airconsole-controls library, which already takes care of this.
- Preload your images in the beginning
// For example in javascript:
var images = ['button_1.png', 'button_2.png', 'character_1.png'];
for (var i=0; i < images.length; i++) {
var img = new Image();
img.src = 'assets/images' + images[i];
}
- Use the AirConsole keyboard for text-input on the device, since the regular keyboard can cause a lot of rendering issues.
- Always indicate which ingame-character the player is controlling.
E.g. If the player is controlling the blue character in the game, then make the controller interface blue.
- Avoid having unnecessary buttons
E.g. you can just go left and right, so you don’t need a 4-directional-dpad
- Show different states on the phone instead of always showing the ingame controller.
If a player dies in the game and the game is still running, then show a “You are dead” view on the players controller.
- Make sure the user-flow works. From Menu -> Game -> Game End -> Menu
- Explain your game to your players.
E.g. with an intro-screen or a tutorial. Make sure that it's not too easy to skip the instruction screen by accident.
- Check what happens if a player joins or leaves during a running game.
- If your game needs more than 1 Player, display it in the start screen.
- If your game has a max player amount, display a “max player reached” if too many players connected.
- Do not use device ids as player numbers. Device ids may not be consecutive, there may be devices that were connected but have left. Read more
- Instead of showing "Player 1", try to show the real player name ((airconsole.getNickname()).
- Be aware that players may have a high latency.
- Export your game early and often! Some issues may not appear in the editor and cause unpleasant surprises if you export it for the first time right before launch time.
- Images and JavaScripts need to be in WebGLTemplates/AirConsoleso your screen and controller can access them in the exported build.
- Use the Profiler to pinpoint performance issues and optimize them.
- Read up on the limitations of WebGL early enough so you don’t spend time on features that can’t be used in the exported version.
- Having memory issues? Can you reduce the number of GameObjects in your game, for example? If not, consider increasing the memory size in Build Settings -> Publishing Settings.
- Avoid Exceptions at all costs, because they will cause crashes in the WebGL export. If you’re getting an exception and don’t know why, make a debug build with Build Settings -> Publishing Settings -> Enable Exceptions set to “Full” and then look at the Console in your browser to see a precise error message.
Updated 27 Sep 2024
Did this page help you?