Talk by Matthew Gatland / @mgatland
(Actually, you can still use the app store if you want to)
(We'll talk about this later)
2D, 3D, all devices
iOS 7.1+
<meta name="viewport" content="minimal-ui">
Android
element.requestFullscreen();
window.requestAnimationFrame(update) //called on every screen refresh
(Before this, there was no accurate timing in JavaScript!)
This used to be really bad
(especially on iPhone)
Now it's good – we can play multiple channels, change volume, use special effects, everything.
(remember the unmute hack)
I don't want any browser rubbish
We can disable MOST default browser actions with one line:
...
e.preventDefault();
...
(There are a few you can't disable)
Networking is a little complex, so I use a framework – socket.io
var socket = io.connect("http://mgatland.com/server");
//send a message
var messageType = "state";
var message = {x:10, y:10, health:99};
socket.emit(messageType, message);
//receive a message
socket.on("state", function (data) {
//do stuff
})
...
JSON is easy, but inefficient... you can use binary instead.
Websockets can only do reliable connections.
We can't send unreliable (UDP) data.
WebRTC supports unreliable data, but it's not in iOS, Safari or Internet Explorer.
Distributing your game as a website is super easy.
(See Gridland and 2048)
But if you wanna get rich, you need to play in the App Store...
turns your JavaScript game into an app
free (for now)
totally easy
(they add a splash screen)
You can test this in < 5 minutes
Doing it for real is almost as easy - you need icons, licence keys...
PhoneGap is an open source alternative.
You can make a game today that people can play on every platform, right now.
You can distribute it on the web with NO DRAMA
(No expensive licence)
(No Xcode crashing all the time)
(No learning a new language for every platform)
(You don't even have to make a new build for each platform)
You can put it in the app store with ALMOST NO DRAMA
(Still no Xcode! :)
But you will need a developer account
Image credits for Creative Commons images:
Browser logos from https://github.com/alrra/browser-logos