S c al a Qu e st: T h e S ca l a A dv e nt u re 1 A le jand r o L ujan 1
W h o? D a vi d , C h ri s ti a n, E d ua r do, M a ur i ci o 2
W h y d o y ou c a re? 4 Y ou wa n t to l evel up yo u r S cala 4 Y ou wa n t to gr o w yo u r t eam 4 Y ou wa n t to e ncoura g e o thers 4 Y ou wa n t to ha v e f un 3
W h y d o I c a re? 4 I'v e be e n t eachin g S cala f o r 5+ y ears 4 I'v e be e n t eachin g s ince hi g h s chool 4 I l earned e nglish by p laying a g ame 4
5
F u n i s a m u lt i pl y in g f a ct o r f or l ea r ni n g 6
P l ay i s t he h ig h es t f o rm o f r es e ar c h. 1 A lbert E instei n on t h e Z elda s eries 7
S e ri o us G am e s l ea d s 4 J ane M cGonig a l 4 T om B aranow s ki 4 L earnin g G ames N etwork 4 M IT Ga m e L ab 4 I nterna t ional J ournal of S erious G ames 8
T h e b es t m o me n ts u su a ll y o c cu r w h en a p e rs o n’s b od y o r m i nd i s s tr e tc h ed [...] i n a v ol u nt a ry efg o r t t o a cc o mp l is h s o me t hi n g d i ffj c u lt a nd w or t hw h il e . 1 M ihaly C siksze n tmihal y i , Fl o w (1 990 ) 9
L e ar n in g S c al a i s d iffj c u lt a nd w or t hw h il e ... b u t c an w e m ak e i t f un ? 1 0
L e t m e t el l y o u a s t or y ... 1 1
J u an E x 4 D ataLan d 4 F armers h arvest m anuall y 1 2
C o mp u te r s 4 A w hile b ack , c ompute r s a ppeare d 1 3
C o mp u te r s 4 A w hile b ack , c ompute r s a ppeare d 4 P owerfu l f orces a rose 4 4-t rain 1 4
C o mp u te r s 4 A w hile b ack , c ompute r s a ppeare d 4 P owerfu l f orces a rose 4 4-t rain , S ea -c ross -c ross 1 5
C o mp u te r s 4 A w hile b ack , c ompute r s a ppeare d 4 P owerfu l f orces a rose 4 4-t rain , C-c ross -c ross , H ava 4 D ata h arvest i ng mo r e e ffj c ient 1 6
C o mp u te r s 4 A w hile b ack , c ompute r s a ppeare d 4 P owerfu l f orces a rose 4 4-t rain , C-c ross -c ross , H ava 4 D ata h arvest i ng mo r e e ffj c ient 4 F or a t ime , it w a s g ood 1 7
C o mp u te r s 4 A w hile b ack , c ompute r s a ppeare d 4 P owerfu l f orces a rose 4 4-t rain , C-c ross -c ross , H ava 4 D ata h arvest i ng mo r e e ffj c ient 4 F or a t ime , it w a s g ood 4 T hen , t h e C omplex i ty P lagues a ppeare d 1 8
S k i 4 R oamed D ataLan d f o r l ong 4 T amed ma n y f orces 4 D iscove r ed a p owerfu l o ne 4 N amed it S cala 4 W anted th i s g reat p ower to be w ielded w isely 4 G atheri n g o rder of a pprent i ces 4 O rder of t h e S ki 4 O rder [S ki ] f o r s hort 1 9
T e mp t in g t h e D em o g o ds... 2 0
W h er e w e a r e n ow 4 S uccess f ul K icksta r ter 4 T hree l evels r eady 4 L evel 4 on t h e w ay 4 L aunchi n g in a f e w w eeks 2 1
T h e i nt e rn a ls 4 P haser .j s f ronten d 4 P lay a n d S cala b ackend 4 M icro -c hallen g es e valuat e d on t h e c lient s ide 4 F inal c hallen g es c ompile d a n d t ested on t h e b ackend 2 2
S o me i nt e re s ti n g a ch i ev e me n ts 1. L evel d efj n itions 2. K eeping us e r s tate 3. C ompili n g us e r c ode 2 3
1. L e ve l d efj n i ti o ns 2 4
1. L e ve l d efj n i ti o ns 4 M ap si z e a n d t iles 4 I tems : l ocatio n, s prites 4 A nimati o ns 4 S ounds 2 5
I W ON D ER I F T HE R E'S A B E TT E R W AY T O D EC L AR E T H ES E ... L I KE A ... T Y PE S AF E W A Y... 2 6
2 7
1. L e ve l d efj n i ti o ns - P u sh i ng t o b ac k en d Image("goblinAvatar", "goblin_avatar.png", 124, 124) Sound("ambient_02", "ambient_02.ogg") Animation("left", (11 to 21).reverse, 8) smallGoblin = NPC("small-goblin", power = 5) smallGoblin.withRandomHP(min, max) val sprites = Sprites(player, npcs, items, prizes, exit, statics) 2 8
1. L e ve l d efj n i ti o ns - t h e g oo d 4 S eriali z ed to J SON 4 F ronten d h a d m inimal c hanges 4 U nit t ested 4 R educed d uplica t ion d rastic a lly 4 C aught d ozens of b ugs 4 R efacto r ing is p ainles s 2 9
1. L e ve l d efj n i ti o ns - t h e b ad: 4 (t here is no b ad ) 3 0
2. K e ep i ng u se r s t at e 4 E vent S ourcin g 4 A kka p ersist e nce 4 O ne p ersist e nt a ctor p e r u ser 4 D ynamoD B 4 C areful a bout m odel e voluti o n 3 1
E v en t S o ur c in g // This function is applied to all incoming commands while the actor is running val receiveCommand: Receive = { case command: String => EventParser.parse(command) match { case event: GameEvent => persist(event)(updateState) case invalidCommand => log.debug(s"Command was not a valid event: $command") } } 3 2
def updateState(event: GameEvent): Unit = { log.debug(s"Updating state with event '$event'") event match { case LevelFinished(ts, levelId) => levelState = LevelState.startLevel(levelId + 1) case MainChallengeSuccess(ts, levelId) => levelState = levelState.copy(mainChallengeCompleted = true) // An item that is collected goes to the inventory by default case ItemCollected(ts, levelId, itemKey) => levelState = levelState.copy( collectedItems = levelState.collectedItems + itemKey, inventory = levelState.inventory + itemKey ) ... } } 3 3
3. C o mp i li n g u se r c o de 3 4
W e n e ed e d 4 I nexpen s ive 4 S calabl e 4 S ecure 4 E asy -i sh to u se 3 5
3 6
3 7
A m az o n L am b da 4 C an r u n a n y J V M a pp 4 I ncludi n g o n e th a t p acks a c ompile r 4 V ery r estric t ed 4 P riced f o r e lastic i ty 3 8
C h al l en g es 4 P ackagi n g t h e a pp 4 T uning r esourc e s 4 W armup t ime 3 9
R u nn i ng o n L am b da - a s am p le S cala a p p + i nstruc t ions on h o w to p ublish to A mazon L ambda : h ttps ://g ithub .c om /m vinesn /a ws -l ambda -e xample - s cala 4 0
W h at n ow? S c al a Qu e st.c o m @S c al a Qu e st 4 1
Recommend
More recommend