An Architecture of the Slot Games Platform

33
An Architecture of the Slot Games Platform Krzysztof Opałka POZNAŃ, 17.10.2015

Transcript of An Architecture of the Slot Games Platform

Page 1: An Architecture of the Slot Games Platform

An Architecture of the Slot Games PlatformKrzysztof Opałka

POZNAŃ, 17.10.2015

Page 2: An Architecture of the Slot Games Platform

Introduction• Front-End Architect at Yggdrasil Gaming• Previously King, Ganymede• 5 years in Game Dev• 10 years in IT

@krzysztof@krzysztof-o

Page 3: An Architecture of the Slot Games Platform

Slot MachineImage: https://www.flickr.com/photos/kubina

Page 4: An Architecture of the Slot Games Platform

Slot Machine• 3 columns, 1 row• One payline• A few different different

symbols

Image: https://www.flickr.com/photos/kubina

Page 5: An Architecture of the Slot Games Platform

Video Slot MachineImage: https://www.flickr.com/photos/garryknight/

Page 6: An Architecture of the Slot Games Platform

Video Slot Machine• X columns, Y rows• 1-243 lines, different direction• Wild symbol• Scatter symbol• Free Spins• Respin• Sticky symbols• Bonus Game• Collectibles• Jackpots• And much, much more…

Image: https://www.flickr.com/photos/garryknight/

Page 7: An Architecture of the Slot Games Platform

… + really rich multimedia experience

• High quality graphics • 3D content• Complex animations• Videos• Particles• Sounds

Image: https://www.flickr.com/photos/garryknight/

Page 8: An Architecture of the Slot Games Platform

Platform Requirements• Web based• Cross Platform• Produce 1 new title

every month• Deliver kick ass games

Page 9: An Architecture of the Slot Games Platform

Event-based spinning loop

Page 10: An Architecture of the Slot Games Platform

Spinning loopSpinnin

g started

Spinning

Stopped

Win Animati

on Started

Win Animati

on Finished

Spinning Ended

Page 11: An Architecture of the Slot Games Platform

Event Dispatcherfunction updateBalance() { //update text field}

function playAnimation() { //explosion}

msg.on("spinning/stopped", updateBalance);msg.on("spinning/stopped", playAnimation);

msg.emit("spinning/stopped");

Page 12: An Architecture of the Slot Games Platform

Event Prioritiesfunction updateBalance() { //update text field}

function playAnimation() { //explosion}

msg.on("spinning/stopped", updateBalance);msg.on("spinning/stopped", playAnimation, msg.PRIORITY.HIGH);

msg.emit("spinning/stopped");

Page 13: An Architecture of the Slot Games Platform

Async eventsfunction updateBalance() { //update text field}

function playAnimation(done) { //explosion setTimeout(done, 1000);}

msg.on("spinning/stopped", updateBalance);msg.on("spinning/stopped", playAnimation, msg.PRIORITY.HIGH, true);

msg.emit("spinning/stopped");

Page 14: An Architecture of the Slot Games Platform

Pros and dos• Easy to plug in new behavior• Independent, separated components• Encourages proper code encapsulation

Cons and don’ts• Priorities hell• Hard to follow non-linear code

Page 15: An Architecture of the Slot Games Platform

Model View Controller

Page 16: An Architecture of the Slot Games Platform

MVCModel

ControllerView

Fetch data

Events

Fetch data,Trigger data calculations

Page 17: An Architecture of the Slot Games Platform

Pros and dos• Clear separation of concerns• Model is easily testable• Easy to have multi-views

Cons and don’ts• Hard to debug when a view gets out of sync with data

Page 18: An Architecture of the Slot Games Platform

Vanilla Slot

Page 19: An Architecture of the Slot Games Platform

Vanilla Slot

Page 20: An Architecture of the Slot Games Platform

My Magic Slot

Page 21: An Architecture of the Slot Games Platform

Overriding assetsvar image = new Image("background.jpg");var sound = new Sound("click.mp3");

Vanilla Slot

assets

src

click.mp3

Symbol.jsGame.js

background.jpg

Page 22: An Architecture of the Slot Games Platform

Overriding assetsvar image = new Image("background.jpg");var sound = new Sound("click.mp3");

Vanilla Slot

assets

src

background.jpg

click.mp3

Symbol.jsGame.js

My Magic Slot

assetsbackground.jp

g

Page 23: An Architecture of the Slot Games Platform

Overriding codeimport Symbol from ”Symbol";

Vanilla Slot

assets

src

background.jpg

click.mp3

Game.js

srcSymbol.js

Vanilla Slot

assetsbackground.jp

g

Symbol.js

Page 24: An Architecture of the Slot Games Platform

export default class Symbol { play() { //explosion animation }}

import VanillaSymbol from "vanilla/Symbol";

export default class Symbol extends VanillaSymbol { play() { //explote animation }

Symbol.jssrcVanilla Slot Symbol.jssrcMy Magic Slot

Page 25: An Architecture of the Slot Games Platform

Pros and dos• Easier to maintain multiple games at once• Start new game in no time• Quick to implement new game with custom features• Write once, benefit in all games• Convention over configuration

Cons and don’ts• Easy to break all games at once

Page 26: An Architecture of the Slot Games Platform

Assets pipeline

Page 27: An Architecture of the Slot Games Platform

Assets pipelinespritesheet-js assets/*.png

[email protected]

Build spriteshe

et

Scale down

Optimize

Page 28: An Architecture of the Slot Games Platform

Pros and dos• Fully automated process of scaling assets• Use smaller assets on mobile• Optimization saves 75% of asset size (!)

Cons and don’ts• Automatically scaled assets can be a bit blurred

sometime

Page 29: An Architecture of the Slot Games Platform

Maitainability

Page 30: An Architecture of the Slot Games Platform

e=mc2

errors = (more code)2

Page 31: An Architecture of the Slot Games Platform

It all worked out• EGR award• Fastest loading slots• Best mobile UI • Best Slot Provider in

2016

Page 32: An Architecture of the Slot Games Platform

Pros and dos• Invest time in automated testing• Follow good engineering practices• Keep it simple – ability to say „no”• Standardize everything

Cons and don’ts• Avoid freestyle/last minute/ad hoc changes

Page 33: An Architecture of the Slot Games Platform

Thank you!Questions?