making native browser games in the modern age

65
@cattsmall @cattsmall Making Native Browser Games in the Modern Age Web Unleashed Toronto 2015 – Catt Small

Upload: catt-small

Post on 20-Jan-2017

1.249 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Making Native Browser Games in the Modern Age

Web Unleashed Toronto 2015 – Catt Small

Page 2: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

● Product Designer, SoundCloud

● Game developer, Brooklyn Gamery

● Co-founder, Code Liberation

I’m Catt Small!

Page 3: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

● Why I like making games

● The state of making games for web

● Pros & cons of HTML5 game-making

● My favorite HTML5 game framework

● Tools for packaging HTML5 games as apps

Today we’ll talk about:

Page 4: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Why I LikeMaking Games

Page 5: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

I can make ANYTHING?!

Whoa.

Creative freedom!

Page 6: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

UsefulnessValue for time spent

Page 7: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Game making utilizessimilar abilitiesto web development

Page 8: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Use of skillset changes

drawing narrative sound

animation systems interaction

code

UI

Page 9: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Reuse processes

Ideate

PrototypeTest

Learn

Page 10: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

The State of Making Games for Web

Page 11: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Before 2010,Flash ruled the internet.

Page 12: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

All Flash everything

Page 13: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Apple rejected Flash

Page 14: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Page 15: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

The canvas element

Kirby, © Nintendo

Page 16: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

HTML5 + JS game engines

Construct 2 ImpactJS CreateJS GameMaker

Page 17: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Here we are.

Page 18: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Pros of MakingHTML5 Games

Page 19: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Native to web

<canvas> <canvas>

<canvas>

Page 20: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

0 0

00

THE FREENITED STATES OF FREEMERICA

NAN NAN0000000000

0000000000

0 0

00

THE FREENITED STATES OF FREEMERICA

NAN NAN0000000000

0000000000

0 0

00

THE FREENITED STATES OF FREEMERICA

NAN NAN0000000000

0000000000

0 0

00

THE FREENITED STATES OF FREEMERICA

NAN NAN0000000000

0000000000

0 0

00

THE FREENITED STATES OF FREEMERICA

NAN NAN0000000000

0000000000

Free (or affordable)

0 0

00

THE FREENITED STATES OF FREEMERICA

NAN NAN0000000000

0000000000

0 0

00

THE FREENITED STATES OF FREEMERICA

NaN NaN0000000000

0000000000

Page 21: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Many engines to choose from

html5gameengine.com

Page 22: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Supports collaboration

Page 23: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Many export options

Desktop & mobilebrowsers

Phone & tablet apps

ConsolesPC, Mac, & Linux apps

Page 24: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Cons of MakingHTML5 Games

Page 25: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Too many engines

Page 26: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Not native to all, hard to export

PhoneGap Intel XDK CocoonJS NW.js

Page 27: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

My favoritegame engine

Page 28: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Page 29: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

For game devs, by game devs

© Photon Storm

Page 30: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Easy to learn & use

phaser.io/examples

Page 31: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Responsive

Droplet, © Photon Storm

Page 32: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Touch & controller support

Page 33: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Works with other plugins

www.pubnub.com/blog/motion-controlled-servos-with-leap-motion-raspberry-pi

Page 34: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Setting up Phaser

Page 35: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Turn on web serverPhaser requires a server to run properly.

Page 36: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Create folder & HTML fileSet up a folder and create index.html in it. Set up the basic HTML structure.

myfolder

index.html

Page 37: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Download PhaserGo to phaser.io. Download the most recent JS file to your folder.

myfolder

index.html phaser.min.js

Page 38: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Create a game fileSave a new file called game.js. Game code will go here.

myfolder

index.html phaser.min.js game.js

Page 39: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Include script filesAdd <script> tags to your HTML file. Include phaser.min.js, then game.js.

index.html

phaser.min.js

game.js

Page 40: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Start making your game!

Page 41: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Concepts of Phaser

Page 42: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

JavaScriptYou’ll be right at home using Phaser since it relies on variables, objects, and functions.

Page 43: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

GameAn object that contains properties related to gameplay including window width, window height, and graphic rendering settings.

var game = new Phaser.Game(...);

Page 44: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

PreloadingPhaser needs to know what files to prepare before the game can be displayed. This phase is called the preload() function.

function preload() {}

Page 45: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Loading ImagesSeveral types of images can be preloaded:● “image” - static, no animation● “spritesheet” - sprite with animation● “tilemap” - environmental objects

Page 46: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Creating the GameThe create() function lets you set up variables, objects, and the game’s layout.

function create() {myGame.score = 0;

}

Page 47: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Updating the GameUnlike preload and create, which only run once each, the update() function is running constantly until the game stops.

function update() {}

Page 48: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

PhysicsPhaser has 3 types of physics.● Arcade: Phaser.Physics.ARCADE● Ninja: Phaser.Physics.NINJA● P2: Phaser.Physics.P2JS

Arcade Ninja P2

Page 49: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

JavaScript Games Beyond the Web

Page 50: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Intel XDKPackages HTML5 games & apps for Android, iOS, Windows, OSX, and Linux.

Page 51: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

PhoneGapPackages HTML5 games & apps for many mobile operating systems.

Page 52: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

CocoonJSAllows you to test and package HTML5 games & apps for both Android and iOS.

Page 53: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

NW.js (node-webkit)Packages HTML5 games & apps for Windows, OSX, and Linux.

Page 54: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Continuing onthe path

Page 55: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Other notable game engines● ImpactJS: impactjs.com

● MelonJS: melonjs.org

● Game Closure: gameclosure.com

● Construct 2: scirra.com

● Game Maker: yoyogames.com/studio

Page 56: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Share your creations!Twitter hashtags:● #screenshotsaturday● #gamedevWebsites:● forums.tigsource.com● makega.me

Page 57: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Attend games events

Page 58: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Recap!

Page 59: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

● Creative freedom

● Practicing skills you already know

● Learning skills you don’t know

● Familiar methodologies & processes

Making games

Page 60: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

+ Native to web+ Free or affordable+ Many engines to choose from+ Supports collaboration & version control+ Export options for various OSes exist- Too many engines, varying quality- Browser-native, not usually OS-native

HTML5 game dev + & -’s

Page 61: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

● Well-supported with good documentation

● Easy to learn & use

● Fluid, allows for responsive & fullscreen

● More inputs than keyboard & mouse

● Friendly with other plugins & frameworks

Phaser - why it’s good

Page 62: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

● Available at phaser.io

● Download & include it in your folder like any other JavaScript framework

Resources:

● github.com/cattsmall/Phaser-game

● codeliberation.github.io/CLF-slides

Phaser - try it out!

Page 63: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

● Intel XDK for mobile & computer OSessoftware.intel.com/en-us/intel-xdk

● PhoneGap for mobile OSesphonegap.com

● CocoonJS for iOS & Androidludei.com/cocoonjs

● NW.js for Windows, OSX, & Linuxnwjs.io

HTML5 to native

Page 64: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Get out there & make games!

Page 65: Making Native Browser Games in The Modern Age

@cattsmall@cattsmall

Thanks! Questions?Think of questions later?

Tweet @cattsmallEmail [email protected]

Work with me: soundcloud.com/jobs