Sothanks, everybodywho's inthechatrightnowwehave a tonofpeoplealreadysocialist.
Everybody.
I havebeenchattingwiththembeforebreakhereorbeforethewhile.
Wehadthemusicsortofcomingin, butitfeelslikeit's been a littlewhilesincewe'vedone a gamefromscratch.
I thinkbymyself, I mightbemisremembering, butletmegoahead, and I'm actuallygonnaswitchovertomylaptopoverhere, whichis I'm realizing, notpluggedin.
Onlycrap.
I didn't evenlikemylaptopwhips.
Um, well, whilewhilewegetthatsetup?
Um, I wanttoshoutout.
Actually, mydadwhosuggestedthatwedotoday's stream, so I thinkhewasconsideringpotentiallymaking a slotmachinehimselfin, um, inJavascript.
Herewego.
Mylaptopisallsetup.
Thanks.
I appreciateit.
Um, andsohewaslike, howwouldyouimplement a slotmachine, Youknow, inrahJavascript?
And I, uh, notasked, really, withjavascriptas I amwith, um, Louandloveto D andstufflikethat.
Um, but, youknow, I sortofhavethementalmodelas a gameprogrammerwhat I woulddotogetitworkinginJavascript, and I think I'd havetofindan A p I orsomethingtogetitworking.
Youknow, I probablyusesomethingphaser.
If I weredoingitinJavascriptormaybeevenwithrawJavascript, I couldfigureoutwaystodoitwiththedibsandwhatnotinimagesandmaybeJakeweary.
Butyou'regonnado a streamon.
Actually, I thinknextweek, nextFriday.
Um, butwe'regoingtoimplementitinloveto D, whichis a frameworkthat I ammorefamiliarwithtoseehowyouwoulduseitinthecontextofsomethinglike a properto D gamedevelopmentframework.
Um, andasLee T.
WhohaspoppedupinthechatsAsshole, Everybodyunderoneandthat's a rule.
Pointsoutthatlasttimewedid a gamewasactuallyonmybirthday.
Wasthatcookieclicker?
If I'm notmistaken, I thinkitmighthavebeen, umso I'm goingtopullup a actually, letmegoahead.
And I'm goingtojustswitchmyscreenoffhereforjust a secondbecause I realizedthat I needtograbtheimagesoffofmyemail.
Sogivemeonesecondhere.
Soyouhavemydadsuggestedthat, youknow, let's do a slotmachineexample.
Becauseyouknow, he's learninghowtododrop a script.
Youwantedto a slotmachine, andactually, hewaskindenoughtoputtogethertheartworkfortoday's game.
Um, andto a to a degree, I wouldsay, Probably, Yeah, um, it's definitelynotquiteasusedasitusedtobe, buttherealityisthatit's stillusedin a lotofapplications, isstillverymuchusedinlegacy.
So I wouldsaykindofprobablyit's dyingout, especiallywiththingslikeReactdoing a lotofmaking, takingcareof a lotofthethingsthatJakeworriedwasreallyusefulforinthepastandthingsliketheFetch a P I, whichJakewhereitwasreallyusedfor a lotofAjaxrelatedstuff, butitstillverymuchused, um, stillandprobablywillbeusedfor a longtime.
But I thinkthat I thinkthetransitionthat I'm sortoffeelingisthatpeoplearemoving, um, towards a less j queryfocused.
CertainlyatleastunlessJakewefocusedapproachtothefrontanditusedtobe a majorcomponentoffrontofapplicationsandnowreact a sortofsawplanted, thatreactviewangular, thosetypesofframeworks.
Umoh, I'm sureaskswhatis a slotmachine, andactually, that's a greatpoint.
We'regoingtobringupexactlywhatthatis, and I havejustfinisheddownloadingtheimages.
Letme.
I thinkit's now.
I couldbringmycomputerbackontothescreenlikethatBoom.
Andthen I'm goingtojustgoaheadanddownloads, Grabmypinksfolderhereanddragthatoverto a newfolder.
J.
HarvardDevStreamsslotmachine.
Sohere, I'm justgonnamake a newfolder.
We'regonnabootstrapthisapplicationthewaywedowithallofourlovetotheapplicationswith a newfolder, and I'm gonnashowyouthetoolsthatwe'reusinghereinjust a secondaswell.
I justwannamakesureallthefilesareintherightlocation.
Theratioissomoreapplesequalsmorechancetogetapples, whichmeansthatyougetlessrewardformatching a rowofapplesversusmatching a rowofpineapplesversusmatching a rowoforangesorwhateveryouwant.
Thio.
However, youwanttostructureyouryourrewardsystem, butthisishowcasinostypicallylookwiththeirslotmachines.
Nowthey'reverycomplicated.
Theyhave a lotofrose, butthesortof I guess, moreiconicillustrationofwhat a slotmachinelookslike.
How I thinktheytraditionallylookedbefore, youknow, Vegasblewupandthere's a 1,000,000 differentslotmachinevendorsissomethingthatlookslikethis.
Thereusedtobe 20 symbolsperslot, soyou'llhave 2020 and 20 allverticallyorientedorin a wheelyoucansortofthinkofand, um, byhaving 17 versushavingmaybefiveapplesorfouroranges.
Youmakethesevenveryraretomatch, especiallyifyoumultiplythatfactorbythree, youknow, going 17 outof 20 times 17 outof 20 times 17 outof 20 on.
I thinkthataddsuptobeingwhatwhatever 20 tothethirdpoweris, which I thinkiswhatWhatwouldthatbewonover 80,000?
Somethinglikethat.
Oroneover 8000?
That's yourchanceofgetting a jackpot, I thinkinthatmodel, althoughthenumbersmightbe, itmightbeslightlydifferentbecauseyou'reespeciallywhenyoustartgettingintochoosingrandomoffsetsafteryouendupactuallyslowingdownthewheel.
We'llseehowthatallworksout.
Um, butoh, yeah, niceastheykindlyplug a leverbasedslotmachinethereinthechat.
So I'm just I'm gonnaseparateaccount.
I'm grabbingalltheimagesthat I puttogetherinadvance.
I'm justgoingtograbthatgodowntear.
Soapologize.
Justgivemeonesecond.
Ifanybody's beenworkingontheirowngames, Definitelyno, because I'm verycuriousifanybody's doingtheirowngamedevelopment.
Like I said, I thinkit's beentwoorthreeweeks, threeweeks, maybesincewe'vedonegameanygamedevelopmentstreams, um, withmicroprocessorsnowubiquitousthecomputersinsidemodernslotmachines a lotmanufacturerstoassign a differentprobabilitytoeverysymboloneveryrealright.
Yeah, yeah, becauseyoucangetfancywithyouralgorithmandshifttheinfluencesthatitwillendupspendingthewheelin a certainwayandwaiting.
Youknowwhereitendsafteritendsupspinning.
That's certainlypossibletodiooursisgonnabe a littlebitmoreof a naive, randomapproach, which I thinkdoesgodowntowhat a detailwassayingof 8000 1 and 8000 Probabilityfortheforthethreesevensactuallyaligning.
So, yeah, that's youcanflubtheabsolutelycanfloodthenumbers, whoeveryouwant.
And I I wouldn't doubtthatcasinosactuallyendupdoingthisinpracticequite a bit.
Um, I'm justmakesurethat I havethisallsetintherightplace.
Uh, J R one's justaboutdonehere.
Copythese.
Over.
Thiswillsaveus a littlebitoftimeonstreamratherthanratherthancuttingalltheseimages, findingtheimages, etcetera.
Wegetsortofrightintothecodingwhich I thinkwillsaveus, saveussometime.
We'llgettosomeveryinterestingvisualstephereinjust a second.
I recentlymade a verybasicversionofBrickBreakerin, JavaScriptsaysbynearWarrior 76.
That's awesome.
Thegamecoursethat I teachteachishowtomakebrickmakerorbreakoutasweasit's called.
Um, it's a verygoodgamethatyoucanreallyactuallytaken a lotofdirectionsinthegamecourse.
Weendupusingproceduralgenerationwell, sortofproceduregeneration, randomizationofthegamegridfor a moreinterestinglayouttothegamesoyoudon't getthesamegrideverysingletime, and I thinkyoucan.
Butfor a 7 20 p demonstration, the 200 by 200 eyes a littlebitlarge.
Sotheseareshrunkdownto 64 by 64 whichisactually a fairlycommonsizefortextures, actually, especiallywhenpowersoftwotextureswormorimportantforopengeobackintheday.
Um, notsomethingthatusuallyhavetoworryabouttoomuchnow, butitwasanoptimizationfortheopengeoframewherethingshadtobe a poweroftwo.
Um, letmejustshowyouwhattheseimageslooklike.
Sohere's theslotmachinethatwe'regonnabeusing.
Sothisisjustanimagethat I foundonline.
Actually, I mightbeabletofinditagain.
Soif I decidedtoquitSpotifyhereif I goovertoGoogleimages, Solet's sayimages, slotmachine.
I thinkit'd slotmachinefreedaydothat.
Oh, youknowwhatam I done?
Freeslotmachineimageandshootoffhand?
No, I'm actuallynotrememberingwhere I foundit.
I foundityesterdaywhen I wasexploring.
Let's see.
Yeah, I'lltryandfinditinthefuture.
Butitwasessentially a royaltyfree, um, slotmachinepicture.
Thatwasjustanillustration.
Butthatwastheonedifferencethat I madewasthatyou'llnoticehere.
Youcanhaveanyarbitrarilysizetexture, andit'llworkgreat, I think, for, um, I thinkforunityincertainconincertaincontexts, having a poweroftwotexturedoesgiveyousomesortofoptimization.
I thinkthisappliesto, um, tocertainotherdomainsacrossframeworksbit.
And I thinkforthreeenginesyougetintomoreofthisbeing a thing.
Andthat's whyyou'llsee a lotoftexturesforGameseven.
Gameenginesareusuallylike 40 96 by 40 96 or 2048 by 2048 becausethereareterritoriesdomainswherethisisimportant.
Um, J p, I sayssoyou'd onlyneedtorendertoimagespercolumn.
Yeah, effectivelyorthree.
If I if I wantedtorendertheforexamplehereon, andwe'llseethissortofif I havethisslotmachinehereandlet's say I havemyimageheresortofinthemiddlerighthere, I I'm gonnawanttoalsorenderslightlytheimageaboveitandtheimagebelowitsareactuallyrenderingonlythreeimagesvisiblebehindit.
Um, andactually, thewaywe'restructuringeverything, we'regoingtohaveeverysingleimageinoursortofinvisiblewheelrenderedin a verticalcolumnandthenthescrollingupwards, andthat'llgiveustheillusionofslotmachinesrialsbeingscrolllikeanactualwheel.
Butwecansay, youknow, iftheimagestextureis, youknow, higherthanthispointonthe Y axisorlowerthanthispointonthe Y axis, justdon't renderit.
Andit'lljustmakeitlookasifthey'renotthere, right, eventhoughthey'rerendering, eventhoughthey'removingtheir Y positionandscrollingindefinitelyandloopingaround, whichwilltake a lookat, um, using a simpleifstatement, wecanjustmakeitnotrenderwhatwedon't careaboutseeing, andit's supereasy.
Solet's goaheadandactuallystartthisprojectandgetcoding a littlebit, uh, makingsurethat I'm notmissinganythingwhichitdoesn't looklikeit.
Okay, sowehaveourprojecthere, isgonnagoanddragitoverto V s code.
Andforthosefolkswhoareunfamiliarwithwhatwe'redoing, I typicallyimplementtotwogamesinloveto D.
Sothisiswhereyoucangetlovetodo, whichisanawesometo D gamedevelopmentframework.
Soyoudon't haveto, youknow, have a verytediousworkflowandlookslike, hey, visualstodecode.
Updated.
So I'm curioustoseeiftheLuasyntaxstuffgotfixedfromlasttime, whichlasttimeiskindof a pain.
I usevisualstudiocodebecause V s codeactuallyhas a reallycoolextension.
Thispixelbitestudioslovetothesupportpluginifyougetthisandusing V s code, ifyou'reon a Mac, youcouldjusthitcommand l andthatwillactuallyrunyourgameimmediatelyifyouhavelovedtobeinstalledintherightlocation.
Ifyou'reonWindowsatthesamething, butit's alltell, soitjustsaves a lotoftime.
It's superhandy.
Um, I don't reallylikeclickinganddraggingtoitan e x c or a nap.
I don't likegoingtomyterminalunnecessarilyandpertheinstructionsondelectiforms, forexample, I couldgolovedotandthatwilldothesamething, althoughrightnow I don't have a loveapplication.
I canjusttypelove, forexample, thatwillpullup.
ThisiswhatLovewilllooklikeifyou'rerunningitwithout a game, forexample.
Butintheinstructions, there's a wayforyoutoaliasatthecommandline.
Thewordlovetopointtowhereyouhaveitinstalledon a Mac.
So I justlearnednowthatifyoudon't have a sourcefileinyourprojectwhenit's loaded, I guessitdoesn't recognizethatit's a sourcerepositoriesandwon't letyouaddnewfiles.
Soifyoueverexperiencedthat, justmakesureyouhave a newfile.
Youconnectcommandendtobringup a newfile, etcetera, etcetera.
Somaynot.
Louisthefilethatyouneedin a lovetodeapplicationinordertogetittowork.
YoudownloadontoyourcomputerandthenyouwritethesLouFiles, whichlovetodeloadsandthenrunsthoseandbasicallyhasthefunctionsimplementedin c++ thatgetcalledbyyourLouiscode.
Soitrunsreally, reallyfast, butitallowsyoutoprogramin a dynamicscriptinglanguageasopposedtohavingtheprogramin c++ orseeorsomething.
Andinordertodothat, what a typicalliketoDioisallcreateddependenciesfiles.
I'llsaydependenciesdotLuaAndinhere, I'm justgonnacreate a texturestable.
I'm gonnacreateanindex.
SothisishowyoudotablesinLuaorinPython?
YoumightknowthemasdictionariesinJavascript.
Youmightknowthemasobjects, essentiallyjust a waytoassociatekeyswiththevalues.
Sointhiscase, I wanttoassociatethekeyslotmachinetoanimagelovedoggraphicsdotnewimagecommandbethatandthisisgonnabegraphicsslashslotmachinedotPNG.
Andsonow I have a noticethat I havethislowercase G.
I have a globaltexturestable.
G textures.
It's why I prefaceditwiththe G, thelowercase G.
I havethistablethat I canaccessanywhereinmyapplication, andsowhat I candothereisnow, eventhoughthisisn't mydependenciesdotloufileinMaine, I cansayrequiredependencies.
And I cansayinmydrawfunctionmember, thisiswhereyoushoulddoallofyourrendering.
Itwouldn't haveworkedat 7 20 p, whichiswhatweusuallystreamattheirwhat I usemylaptopatforstreamingpurposesbecauseeverythingisniceandbigbyneverwarriorsays, Haveyoutriedthematerialthemefor V s code?
I don't mindtheothertheme, though, Soall I'llusetheotherone.
Sothatwouldbethematerialtheme.
Darker, highcontrast.
We'llusethisone.
We'llusethisone.
I am.
I'm happytousethisone.
Andyeah, Adam, itlooks a bitdim.
I agree.
I'm not a hugefanofthe, uhitwas a hugefanoftheblue, butthefolkslikethistheme, Thematerialhighcontrast.
I'm diggingthisone.
I'm happytousethisone.
Inthemeantime, let's goaheadandactuallyaddtheabilitytoterminatetheapplicationwith, um, a keypressbecause I don't likehaving a commandorpressescapeor I don't likehaving a command.
Q.
I wouldmuchratherbeabletopress, escapeandquitthegameSothislovedotkeeprestfunctiontakesin a key.
Ithasthatsameeffect, but I wanttoessentiallycalculatehowmuchweshouldmoveittotherightbasedonhowwhiteitISSandwhatwecandois, wecansaythepaddingforthatisgonnabethewindowwithminus.
Youcansortofassumethatcolonishowyouwouldaccessandobjects, fieldsormethods, sortofhowyouwoulddoitinJavaanddotwouldbehowyouhadaccessstaticmethodsorstaticfieldsinjobwar c++ samesortofideaAndthenwecandividethisbytwo.
I think I waslookingtoseewhyyouneededtopassinthedimensionsof a texturetothequadconstructor.
If I'm notmistaken, I don't rememberoffhandwhytheexactreasonwasButifwegoto, let's seegoodofmodulesandwhattheeventandisaneventdotCPP.
Maybeso.
Isthere a quickfunctionhere?
Sobigsearchforquit?
No, it's nothere.
Okay, it's maybegoovertotheheader.
Isitintheheaderfile?
No, it's a rapidevent.
CPP.
It's probablythis w quit.
Um, soitlookslikeit.
Itpassesin a bullyintwo.
I'm notsure.
Oh, totheLouisSTOkay, Push, bullyandtrue.
Yeah, thisisthisisdealingwiththelieuofvirtualmachineandessentiallypushing a variabletoitfrom C R.
C plusplus, and I'm notentirelysure.
Okay, soconstructs a newmessagecalledQuit.
Okay.
Oh, andthenitpushesthatquitmessageontothestack.
And I'm assumingthatintheinfiniteloopthatrunsunderneaththehoodforloveto D thatit's essentiallylookinginthestateforthisquickmessagesothatthere's probably a It's usingthissortofbroadcastmodelwhereyoupushmessagesonto a stack.
Andthenthere's listenersthatlistenforthesemessagesandperformfunctionality, andit's probably a functionthat's initializedsomewhereelsethatsaysonquit.
Underneathallofthat, theremightbe a simpleinteger, a simpleBooleanthatthewildloopischeckingfor, andifthatbullyinggetsset, thefaultswilltheneverythingjustterminatesatthatpoint.
ThisisLouisDrinkandCatNationoperatorandthen V forthenameofyouknow, whetherit's 50 applebananaceteracancabinetagaindotuh, J Peginthiscase.
Andnow I have, ah, listofour A tablewith a collectionofallofouriconsandactuallymakethisglobalbysaying G icons.
Sonow I canreferencetheseiconsthislistofstringsanywhereinmyapplication, which I'm actuallynotsureif I neednowthat I thinkbackon, um, I started a trialrunofthis.
I don't thinkyounecessarilyneedit, butyeah.
Uh, answerAdam's question.
Youknow, mydadmadetheimagesfromscratch.
Correct?
Yeah.
Um, ifhe's sayingthatisgreat.
Yeah, Andre, it's onlythetop, Terry.
Unfortunately, Unity's licenseforthatis a littlebitlessthangenerous.
Butunityas a platform, I think, isincrediblygenerous.
So I'm notapttocriticizethemtoomuchforthatpractice.
Havingitrelativelymakessense.
Um, I think I'm notmistaken.
UNrielsourcecodeisopen.
SourceDon't quotemeonthat.
ButsomebodyWhen I taughtthegamescoreslastyearlastspring, somebodybroughtthisupand I thought I rememberedresearchingitandfindingoutthatitwastruethatunrealenginedoeshavesomesortofopensourcelicense, but I don't know.
Umokay, let's goahead.
Andnowlet's justtestjustsandycheck.
Let's makesurethatalloftheseimagesarerendering.
Let's make a loophere.
So I'm gonnasayfor, umlet's say, actually, fourkeyvalueinpairsof G icons.
D'oh!
Um, lovedartgraphics, docdrawandthen G texturesat V at, actually.
Well, Kaywillbe a numberinthiscase.
Willit?
No, itwon't, actually.
Yes, itwill.
Yes.
Itwillbe a numberbecausewe'reusingitasanarray.
Thisis a nicethingaboutusingtablesinlieu.
Uh, isthatifyoujustifyoujustusethemas a raisetogetimplicitlyindexedbynumbers, sotheydoworklike a raiseifyoudon't usethem, um, likedictionariesorobjects.