-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
807 lines (639 loc) · 22.9 KB
/
index.html
File metadata and controls
807 lines (639 loc) · 22.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>HTML5 Game APIs</title>
<link href='http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/default.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<link rel="stylesheet" href="css/jsvm.css">
<link rel="stylesheet" href="css/prism-dark.css" />
<script src="js/prism-es6.js"></script>
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
<style>
.orange .state-background {
background: #f1622f;
}
</style>
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h2>December 1st</h2>
<img src="images/hackphx.png">
<a href="http://hackphx.com">hackphx.com</a>
</section>
<section>
<img src="images/hsllogo.png">
</section>
<section>
<h2>WhomTF ?</h2>
<img src="images/luiscartoon3.jpg" style="border-radius: 15px; border: 0;">
<h3>Luis Montes</h3>
<a href="http://twitter.com/monteslu"><span>@MONTESLU</span></a>
</section>
<section>
<h2>WhomTF2 ?</h2>
<img src="images/twit_pic_blaine.png" style="border-radius: 15px; border: 0;">
<h3>Blaine Bublitz</h3>
<a href="http://twitter.com/BlaineBublitz"><span>@BlaineBublitz</span></a>
</section>
<section>
<img src="images/icedlogo.png">
</section>
<section>
<section>
<h2>Web based gaming - Last Decade</h2>
<img src="images/plugins3.jpg" style="border: 0; border-radius: 0px;" border="0">
</section>
<section>
<h3>
In order to play this you must first install...
</h3>
<ul>
<li>
Java Applets
</li>
<li>
Adobe Flash
</li>
<li>
Silverlight
</li>
<li>
Unity 3D
</li>
</ul>
<br>
<div style="text-align: center; border: 1px solid black; padding: 4px; background-color: #FFFFBF; color:#444444;">
<img src="images/pluginpuzzle2.png"><br>
Don't bother clicking here, the plugin isn't available for your Operating System and Hardware
</div>
</section>
<section>
<h2>Fast Forward a decade</h2>
<img src="images/html5-logo-1.jpg" style="border: 0; border-radius: 0px;" border="0">
<h2>Evolving Standard</h2>
</section>
</section>
<section>
<section>
<h3>Typical Game Engine Functionality</h3>
<ul>
<li>
Rendering / Animation
</li>
<li>
Physics
</li>
<li>
Input
</li>
<li>
Resource Management
</li>
<li>
A. I.
</li>
<li>
Networking
</li>
<li>
Audio
</li>
<li>
User Interface
</li>
</ul>
</section>
<section>
<h2>HTML5 Game Engines</h2>
<a href="https://github.com/iceddev/frozen">FrozenJS !</a><br>
<a href="https://github.com/bebraw/jswiki/wiki/Game-Engines">Impact, Crafty, Melon, many others</a>
</section>
</section>
<section>
<section>
<h2>Canvas</h2>
<h3>Now, we can paint, too!</h3>
<img src="images/bob_ross.jpg" />
</section>
<section>
<h2>Canvas Creation</h2>
<pre class="language-html"><code class="language-html"><canvas id="myCanvas"></canvas></code></pre>
Default sizes: height="150" and width="300"
</section>
<section>
<h2>Setting our own height & width</h2>
<pre class="language-javascript"><code class="language-javascript">
var canvas = document.getElementById('myCanvas');
canvas.setAttribute('height', '450');
canvas.setAttribute('width', '450');
</code></pre>
Setting height or width clears canvas
</section>
<section>
<h2>But I want to draw!</h2>
<pre class="language-javascript"><code class="language-javascript">
var context = canvas.getContext('2d');
// Can also get 3d context (WebGL)
context.fillStyle = '#10B7FB';
// (X, Y, width, height)
context.fillRect(0, 0, 450, 450);
context.strokeStyle = '#B1E3FE';
context.lineWidth = 20;
context.strokeRect(450 / 4, 450 / 4, 450 / 2, 450 / 2);
</code></pre>
</section>
<section>
<a href="demos/canvas1.html" target="_blank">Cheesy Demo #1</a>
</section>
<section>
<h2>What about images?!</h2>
<pre class="language-javascript"><code class="language-javascript">
// Load an image
var img = new Image();
img.onload = function(){
context.drawImage(img, 0, 0);
};
img.src = "images/cheese.jpg";
</code></pre>
</section>
<section>
<a href="demos/canvas2.html" target="_blank">Cheesy Demo #2</a>
</section>
</section>
<section>
<section>
<h3>Game Loop</h3>
<img src="images/gameLoop.png" />
</section>
<section>
<h3>A simple JS game loop</h3>
<pre class="language-javascript"><code class="language-javascript">
var prevTime;
function gameLoop() {
var currTime = new Date().getTime();
elapsedTime = currTime - prevTime;
prevTime = currTime;
handleInput(elapsedTime);
update(elapsedTime);
draw(context);
}
</code></pre>
</section>
<section>
<h3>Running the loop</h3>
<pre class="language-javascript"><code class="language-javascript">
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(/* function */ callback, /* DOMElement */ element){
window.setTimeout(callback, 1000 / 60);
};
})();
(function animloop(){
thisgame.gameLoop();
requestAnimFrame(animloop, canvas);
})();
</code></pre>
</section>
<section>
<a href="demos/gameLoop/index.html" target="_blank">Animation with a game loop</a>
</section>
<section>
<h3>Input Management Initializing</h3>
<pre class="language-javascript"><code class="language-javascript">
game.initInput: function(im) {
im.addKeyAction(dojo.keys.LEFT_ARROW);
im.addKeyAction(dojo.keys.RIGHT_ARROW);
im.addKeyAction(dojo.keys.UP_ARROW);
im.addKeyAction(dojo.keys.DOWN_ARROW);
};
</code></pre>
</section>
<section>
<h3>Using the input</h3>
<pre class="language-javascript"><code class="language-javascript">
handleInput: function(im){
/* handle left and right movement */
if(im.keyActions[dojo.keys.LEFT_ARROW].isPressed()){
sprite.dx = sprite.maxVelocity * -1;
}
else if(im.keyActions[dojo.keys.RIGHT_ARROW].isPressed()){
sprite.dx = sprite.maxVelocity;
}
else{
sprite.dx = 0;
}
/* handle up and down */
...
};
</code></pre>
</section>
<section>
<a href="demos/inputManagement/index.html" target="_blank">Input Management Demo</a>
</section>
</section>
<section>
<section>
<h2>Web Audio API</h2>
<h3>Play Sounds like it's 1995</h3>
<img src="images/goes_to_11.jpg" />
</section>
<section>
<h2>Get a reference to the Web Audio context</h2>
<pre class="language-javascript"><code class="language-javascript">
var audioContext;
// Try/Catch incase it doesn't exist (FF/IE)
try {
audioContext = new webkitAudioContext();
} catch(e) {
alert('Web Audio API is not supported in this browser');
}
</code></pre>
</section>
<section>
<h2>How are we getting sounds?</h2>
<pre class="language-javascript"><code class="language-javascript">
var soundBuffers = {};
var loadSound = function(name, url) {
var request = new XMLHttpRequest();
request.open('GET', url, true);
// Web Audio is binary (not text) - we need an arraybuffer
request.responseType = 'arraybuffer';
// Decode asynchronously
request.onload = function() {
if(audioContext){
audioContext.decodeAudioData(
request.response, function(buffer){
soundBuffers[name] = buffer;
}, onError);
}
}
request.send();
};
</code></pre>
</section>
<section>
<h2>Now, let's play the sound!</h2>
<pre class="language-javascript"><code class="language-javascript">
var playSound = function(name) {
if(audioContext){
// creates a sound source
var soundSource = audioContext.createBufferSource();
// tell the source which sound to play
soundSource.buffer = soundBuffers[name];
// connect the source to the context's destination
soundSource.connect(audioContext.destination);
// play the source now
soundSource.noteOn(0);
}
};
</code></pre>
</section>
<section>
<h2>Use the functions</h2>
<pre class="language-javascript"><code class="language-javascript">
loadSound('wee', '/demos/sounds/wee.wav');
loadSound('yipee', '/demos/sounds/yipee.wav');
loadSound('yahoo', '/demos/sounds/yahoo.wav');
loadSound('pop', '/demos/sounds/pop.wav');
playSound('wee');
playSound('yipee');
playSound('yahoo');
playSound('pop');
</code></pre>
</section>
<section>
<a href="demos/webaudio.html" target="_blank">Cheesy Demo #3</a>
</section>
<section>
<h2>Can I use?</h2>
<img src="images/use_webaudio.png" />
</section>
</section>
<section>
<section>
<h2>WebSockets</h2>
<img src="images/websockets.png" />
<h3>Networking in the browser</h3>
</section>
<section>
<h2>Can't we already do networking?</h2>
<img src="images/ajax_comet.png" />
</section>
<section>
<h2>Use Node.js !</h2>
<img src="images/nodejs.png" />
</section>
<section>
<h2>Node.js</h2>
<img src="images/chrome_v8.png" />
</section>
<section>
<h2>Quick Node primer</h2>
<pre class="language-javascript"><code class="language-javascript">
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
</code></pre>
</section>
<section>
<h2>Socket.io server</h2>
<pre class="language-javascript"><code class="language-javascript">
var io = require('socket.io').listen(80);
io.sockets.on('connection', function (socket) {
socket.emit('news', { hello: 'world' });
socket.on('my other event', function (data) {
console.log(data);
});
});
</code></pre>
</section>
<section>
<h2>Socket.io client</h2>
<pre class="language-html"><code class="language-html"><script src="/socket.io/socket.io.js"></script></code></pre>
<pre class="language-javascript"><code class="language-javascript">
var socket = io.connect('http://localhost');
socket.on('news', function (data) {
console.log(data);
socket.emit('my other event', { my: 'data' });
});
</code></pre>
</section>
<section>
<h2>Can I use?</h2>
<img src="images/use_websockets.png" />
</section>
</section>
<section>
<section>
<h2>WebRTC</h2>
<h3>The final blow to Flash</h3>
<img src="images/flash-dead.png">
</section>
<section>
<h2>The <video> element</h2>
<pre class="language-html"><code class="language-html"><video id="myVideo" autoplay></video></code></pre>
</section>
<section>
<h2>The pain of vendor prefixing</h2>
<pre class="language-javascript"><code class="language-javascript">
navigator.getUserMedia = navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia;
window.URL = window.URL || window.webkitURL;
</code></pre>
</section>
<section>
<h2>Request access to user's camera</h2>
<pre class="language-javascript"><code class="language-javascript">
var video;
navigator.getUserMedia({
video: true
}, function(localMediaStream) {
video = document.getElementById("myVideo");
// Create blob url with media stream
video.src = window.URL.createObjectURL(localMediaStream);
}, function(error) {
console.log(error);
});
</code></pre>
</section>
<section>
<h2>Cheesy Demo #4</h2>
<a target="_blank" href="demos/webrtc.html">Follow the yellow brick road!</a>
</section>
<section>
<h2>Capture something!</h2>
<img src="images/gangnam_style.png" />
</section>
<section>
<h2>How can we capture crazy things?</h2>
<pre class="language-html"><code class="language-html"><canvas id="canvas"></canvas></code></pre>
<pre class="language-javascript"><code class="language-javascript">
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
context.drawImage(video, 0, 0);
</code></pre>
Yes, it is actually that easy!
</section>
<section>
<h2>Cheesy Demo #5</h2>
<a target="_blank" href="demos/webrtc.html">Gangnam Style!</a>
</section>
<section>
<h2>But how do we save it?</h2>
<pre class="language-html"><code class="language-html"><img id="save" /></code></pre>
<pre class="language-javascript"><code class="language-javascript">
// Base64 encoded url of image
var imgData = canvas.toDataURL();
var img = document.getElementById('save');
img.src = imgData;
</code></pre>
</section>
<section>
<h2>Cheesy Demo #6</h2>
<a target="_blank" href="demos/webrtc.html">Embarrass your friends!</a>
</section>
<section>
<h2>Individual pixel data</h2>
<pre class="language-javascript"><code class="language-javascript">
// get the pixels!
var pixels = context.getImageData(x,y,width,height);
</code></pre>
</section>
<section>
<h2>Cheesiest of the cheesy demos</h2>
<a target="_blank" href="demos/webrtc2.html">rtc and pixels</a>
</section>
<section>
<h2>Can I use?</h2>
<img src="images/use_webrtc.png" />
</section>
</section>
<section>
<section>
<h2>WebGL</h2>
<h3>Taking things to a whole new dimension</h3>
<img src="images/3d_tiger.jpg">
<aside class="notes">
Oh hey, these are some notes. They'll be hidden in your presentation, but you can see them if you run the speaker notes server.
</aside>
</section>
<section>
<h2>WebGL is...</h2>
<h3>Javascript implementation of the OpenGL ES 2.0 Spec</h3>
</section>
<section>
<h2>WebGL is Easy!</h2>
<h3>Just read the spec</h3>
<a href="https://www.khronos.org/registry/webgl/specs/1.0/">https://www.khronos.org/registry/webgl/specs/1.0</a>
</section>
<section>
<h2>Use THREE.js</h2>
<h3>A scene</h3>
<h3>A renderer</h3>
<h3>A camera</h3>
<h3>An object or two (with materials)</h3>
</section>
<section>
<h2>Let's see some code</h2>
<pre class="language-javascript"><code class="language-javascript">
var renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
var camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 1000 );
camera.position.z = 400;
var scene = new THREE.Scene();
var geometry = new THREE.CubeGeometry( 200, 200, 200 );
var texture = THREE.ImageUtils.loadTexture('textures/crate.gif');
texture.anisotropy = renderer.getMaxAnisotropy();
var material = new THREE.MeshBasicMaterial( { map: texture } );
mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
//put this in a requestAnimationFrame:
renderer.render( scene, camera );
</code></pre>
</section>
<section>
<h2>Demo</h2>
<a target="_blank" href="demos/webgl_geometry_cube.html">Everyone loves Crates</a>
</section>
<section>
<h2>Creepy Demo</h2>
<a target="_blank" href="http://mrdoob.github.com/three.js/examples/webgl_materials_bumpmap_skin.html">Uncanny valley</a>
</section>
<section>
<h2>Putting things together</h2>
<a target="_blank" href="http://www.airtightinteractive.com/demos/js/webcammesh/">WebRTC + WebGL</a>
</section>
<section>
<h2>Can I use?</h2>
<img src="images/use_webgl.png" />
</section>
</section>
<section>
<section>
<h2>Mobile HTML5 Gaming</h2>
<img src="images/old-mobile-phone.jpg" />
</section>
<section>
<h2>Everything is working just fine...</h2>
<img src="images/you_mad.png" style="border:0;" />
</section>
<section>
<h2>iOS</h2>
<li>WebAudio !</li>
<li>A fast Canvas!</li>
<li>... WebGL only for iAds</li>
</section>
<section>
<h2>Android</h2>
<li>less than 4.0 = "browser"</li>
<li>Chrome is better, but missing things</li>
<li>Release 24 showing promise</li>
</section>
<section>
<h2>Others</h2>
<li>Firefox on android has WebGL!</li>
<li>Bowser has WebRTC!</li>
<li>BB10 & Window mobile could get interesting.</li>
</section>
</section>
<section>
<h2>Other HTML5 topics</h2>
<ul>
<li>Web Workers</li>
<li>Device Orientation</li>
<li>Fullscreen</li>
<li>Mouse Lock</li>
<li>Gamepad API</li>
</ul>
</section>
<section>
<section>
<h2>Monetization</h2>
<img src="images/monetization.jpg" />
</section>
<section>
<h2>Web app stores</h2>
<ul>
<li><a href="https://chrome.google.com/webstore/detail/simple-pool-game/acjijhekaonkmkedfdabbageicfhhlgo?utm_source=chrome-ntp-icon">Chrome Web Store</a></li>
<li><a href="https://marketplace.firefox.com/">Firefox Marektplace</a></li>
<li><a href="https://marketplace.firefox.com/">Blackberry App World</a></li>
<li><a href="http://windows.microsoft.com/en-US/windows-8/apps">Apps for Windows 8</a></li>
</ul>
</section>
<section>
<h2>Venture Capital</h2>
<ul>
<li>Spaceport.io ($M, undisclosed)</li>
<li>Game Closure ($12M)</li>
<li>Goko ($8M)</li>
<li>Artillery ($2.5M)</li>
<li>Moblyng ($10M & bankrupt)</li>
</ul>
<br><br>
<h4>(Slide stolen form @cykod)</h4>
</section>
</section>
<section>
<h2>Some Resources</h2>
<ul>
<li><a href="https://github.com/iceddev/desertjs_html5">This Source + Demos</a></li>
<li><a href="http://html5rocks.com/">HTML5 ROCKS!</a></li>
<li><a href="https://github.com/mrdoob/three.js">THREE.js</a></li>
<li><a href="http://www.chromeexperiments.com">Chrome Experiments</a></li>
<li><a href="https://caniuse.com">Can I use?</a></li>
</ul>
</section>
<section>
<h1>THE END</h1>
<h3><a href="http://twitter.com/iceddev">By @IcedDev</a></h3>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/linear(2d)
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/highlight.js', async: true, callback: function() { window.hljs.initHighlightingOnLoad(); } },
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'lib/js/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'lib/js/data-markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/zoom-js/zoom.js', condition: function() { return !!document.body.classList; } },
{ src: '/socket.io/socket.io.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } },
{ src: 'plugin/speakernotes/client.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } }
]
});
</script>
</body>
</html>