KEMBAR78
Multiplayer game with angular and firebase | PPTX
MULTIPLAYER GAME
WITH
ANGULAR & FIREBASE
MICHAEL HABERMAN
FREELANCER
MULTIPLAYER GAME
Browser (Angular)
Game
framework
Real time server DB
WHAT IS GAME FRAMEWORK
• Different UI element
• Physics engine
• Animations
• Fast rendering
• Handling asserts
• Abstract browser rendering options (WebGL / Canvas)
GAME FRAMEWORK
• Phaser
• Unity
• CreateJS
• ImpactJS
GAME FRAMEWORK – LIFE CYCLE
Preload Create RenderUpdate
PHASER CODE
this.game = new Phaser.Game(
window.innerWidth, window.innerHeight,
Phaser.AUTO,
'game_canvas’, {
preload: this.preload,
create: this.create,
update: this.update,
render: this.render
});
PRELOAD
preload: function () {
this.game.load.spritesheet('me', 'assets/animals.png', 32,
32, 96);
}
CREATE
this.sprite = this.game.add.sprite(width, height, 'me');
this.game.physics.enable(this.sprite,
Phaser.Physics.ARCADE);
this.sprite.animations.add('down', [0, 1, 2], 10, true);
this.sprite.animations.play(‘down', 5, true);
UPDATE
if (this.cursors.left.isDown {
this.sprite.animations.play('left', 5, true);
this.sprite.body.velocity.x -= 25;
}
RENDER
• Most object render automatically
• Used for special objects
• Called after game rendered and plugins completed
rendering
• Allow post render changes
LET SEE IT WORK
WHY DO I NEED ANGULAR?
ANGULAR WITH PHASER
• Phaser will handle game rendering & logic?
• What about all the rest?
• Login
• Ads
• Settings
• Pre steps
COMBINE ANGULAR AND PHASER
• Phaser doesn’t export a module
• It sets itself as global
WHAT WE HAVE SO FAR
Browser (Angular)
Game
framework
Real time server DB
FIREBASE
• Google product
• Real Time Database (and more…)
• Amazing for multiplayer game
• Automatic synchronization
SYNC WITH FIREBASE
• Initialize firebase
• Get a list
• Subscribe for changes
Browser (Angular)
Firebase SDK
Firebase DB
Firebase
FIREBASE
Browser (Angular)
Game
framework
Real time server DB
LET SEE IT WORK
Firebase
FIREBASE
Browser (Angular)
Game
framework
Real time server DB
THANK YOU!
@hab_mic
michael@haberman.io

Multiplayer game with angular and firebase

Editor's Notes