YouTubestream· Aug 2, 2024· 1:46:40· 2,600 views on YouTube
React at a moment you like. The best moments light up here.
[Music] a [Music]
now [Music]
a [Music]
all right what's up people how's it going I think my microphone should be good let me know if um the audio or the uh the music is a little bit too soft too loud that kind of thing yeah it's been a while since I've actually streamed just by myself I've been on a couple streams before for uh but I
figured uh I was setting so the the reason I wanted to stream today um was because I yesterday I had figured out how to do like uh multi streaming across different platforms and so I had set up um I had set up you know just to have it dued to different platforms I had set up YouTube and twitch and cuz previously I
had only streamed on YouTube I guess for like the lville documentation reading I streamed on Twitter for that too and I had everything working um and then today it just like it showed that it was connected and live on Twitter but there was no video at least in my tests maybe maybe there was actually video and I just ended it for no reason um but yeah I like YouTube better anyways and like
I'm on YouTube more it is crazy though how much um Twitter pushes if you're live like everyone gets a notification for it uh but I don't really care about that I just want to be live on as many platforms as possible so I'll figure that out later uh but yeah thanks so much for everyone joining already uh on YouTube that's like where where the where the part's at
um yeah so maybe I'll just stream on YouTube maybe I'll I'll give up my my uh delete my Twitch account and you can only find me on YouTube so if YouTube you're looking for um any kind of sponsors sponsorship I should say I am willing to take uh I'm willing to foro Twitch sponsorship and stream
solely on YouTube uh but yeah let's uh let's get into it so I the the premise for this um I let me switch this over here um I so hey everyone on YouTube and then hey no one on Twitch right now uh I plan to do the same when getting to regular streaming just YouTube yeah I don't have the so I you I have like overlays I might not have them like set up right
now but I have overlays of on chat so if you're chatting on Twitch I have like the overlays but I'll probably like just switch that so like it's just YouTube that has overlay chat like on here um don't worry Josh I'm representing there we go there we go Nick I appreciate it and look at that first time chat see it pops up for for for twitch like underneath my chin um cuz that's why I
had set up previously before I switched primarily to YouTube so I either I'll turn that off maybe I'll turn it off right now um either I'll turn that off uh completely or maybe just do it for YouTube and twitch yeah YouTube is where it's at we're not writing JS over here uh Hey on Twitch hey gummy beer um
yeah I I don't know if uh if I'll if I'll keep doing like both I know it's nice to have it on everything just just in case uh yeah I'll have to decide what I want to do with like actual actual overlay stuff like that uh but yeah long story short I saw a bunch of people well ever since a lot of the twitch um and you let me know if the uh the kick stream win yeah I don't know if
I'm going too far over that way YouTube Twitter and twitch that will be I'm not even streaming on LinkedIn I think LinkedIn is like a little bit too professional for me Aaron Francis streams on LinkedIn and uh good for him uh but yeah when um the like the twitch Awards like with um uh a lot of like game development
stuff going on and stuff like that I was like okay for the longest time I've wanted to make a like turn based multiplayer strategy game so think of I think I had this idea when I was like seven um and I was like okay chess is cool but like imagine there's been multiple games like this chess is cool but imagine like uh chess with
like abilities and hit points and stuff like that so I figured what better way to learn a bunch of different weird things within game development than trying to build it in larl and I I admit um I'm the larel streamer working at larl so LinkedIn is too professional yeah I don't know it's a little maybe it's a little uh Hey PHP
anit nice to have you here hey Jesse um yeah maybe I don't know maybe maybe it's too I don't like I'm it's it's still weird combining my cuz there's a lot of like people who know me personally on LinkedIn um and a lot of them don't know what I do like they're like oh yeah you just like work on computers right and so it's always been weird of this kind of combining those two worlds and but maybe I should do it maybe I
should do a little bit more um yeah so a turnbas strategy game let me pull up some like notes here so I was like I want to do a turn-based strategy game uh think like chess with character abilities and hit points and I the reason why I want to stream this is one because there's going to be so much stuff that I don't know
how to build this is this isn't going to be like a onetime stream I don't I don't we might we might like I have about an hour and a half which means we might be able to like we might be able to like uh get Lille installed and it takes a little a little quicker than that but I think I think the point the the reason why I want to build a game is one it's always been on my mind two it's great to use
technologies that you actually know to learn new things within those Technologies so the stuff that like uh the stuff that I want stuff to learn is this is going to be like a trigger word for people who are watching on YouTube or um any any uh uh too bad it's not on Twitter because I feel like people would love this word but I think
I can learn event sourcing from building a game so for those who don't know um uh for those who don't know there is verbs a larel package and I think there's actually a yeah board game example so I I don't know anything about event sourcing I know that uh Daniel has been trying to get me to figure it out and uh Josh
Hansen is uh is is trying to get me to figure it out as well um but I really just don't know how it works my guess is here's what my thought of that um Here's my thought of what event sourcing is is you have the ability to figure out where you've been so that you know where you're going
that's my thought wish you could stay and watch this joshh you got to go do household chores catch up with the VOD yeah I don't know if we're going to get too far into it but it'll be nice to get see you uh see catch up in the vond so I appreciate that um almost 11:50 p.m. there wow in India uh sick or Hat by the way yeah I wear hats all the time um yeah I I stayed up pretty late last night myself so I appreciate you uh
hanging in there chandan uh gummy beer in case you want a mingle I would be available for seconds stream working on a game as well and I built several games already during game perfect I'd be I'd be down for that yeah there there's stuff that like I know the reason why I want to do this in laravel one is obviously like that's most of my community and most of the people who are who are watching probably who are just interested in larabel whether you uh
build in larel or not two when you are familiar with a software like laravel or just like any software development in general you automatically know how you would think through building a game or building whatever solution that you're trying to solve and that's why I want to stick with larel I know one thing I've always wanted to try you're also building L there you go you're building a gameing larel gummy I
don't know if I should call you gummy beer or just gummy I'll just call you gummy are you building a gameing larel uh I've always been interested in love 2D this is if like Lis seems really I've never built built in Lua but Lua seems really interesting and I would build in Lua if I wasn't building in Lille like again the reason why I want to build this in laravel is I know how I would approach
this and so I think I can build it faster but also there's going to be so much stuff I'll learn and which really excites me so I've always been excited about things to learn so when it comes to like event sourcing or you know how to Think Through multiplayer Lobby use and stuff like that so everyone always says Hey the first game you should the first game you should build should not be a multiplayer game well too bad I'm going to do it anyways louw kind of
if you know modern pH there you go see I'm ready you can also call me Tom hey Tom uh do I do I follow you on Twitter or do you follow me on Twitter gummy like is that how I might know you it's always weird combining those two worlds kind of thing neoven by the way um uh I know but uh I don't use new of him so sorry Jesse um you you would convince
me of split keyboards for stream ban you would convince me of stream boards uh stream boards you would convince me of split keyboards before neovim just because I'm really interested in Split keyboards but I also know that that's going to take a while for me to get used to uh so yeah the we're going to learn event sourcing I already know quite a bit about Lille Reverb just because I've made one video
on it on the Lille Channel and then I have a lar cast course coming out that uses Reverb pretty heavily in the sense that uh you have kind of like these live listening rooms for podcasts and so that's what I would build with this game and some other stuff I'll probably learn is a lot of like just fun Js
maybe like uh what's it called like canvas type stuff and that's not even JS like HTML canvas stuff I feel like I would learn a bunch of that because I don't necessarily need it to be really flashy Graphics wise I'm okay with it looking just like a regular like a flat 2D board but this could be like something where I could I could bump it up so again those tuning
in first time I have not even written a single line of code this is me dreaming cuz I've always wanted to make a game and now I'm like why would I why would I just build it in Lille I know enough about it where I know how to do this so turnbas strategy game it's basically chest with characters abilities hit points I think I could use
um I could use uh Caleb porio Sushi to basically set all like the the characters also one of the reasons why I I've always wanted to build a game is I love like the uh I love the what's it called I love the um the like stats aspect of building
a game so when I was playing a lot of like League of Legends or when I was playing um I I I played this this is basically what I'm going to base it off I don't know if it's even still like available to see but there was this game that I played in middle school called tactic Arena online yeah it looks like it's still there's still like some stuff available but it was basically like this turn-based strategy game with like hit points and like different characters so
I'm I guess I'm just trying to replicate the feel of what it felt like when I was in Middle School playing this game there was some Randomness aspect to it which I think I would have to introduce and stuff like that but there was a lot of uh like strategy to it as well so it was basically like um it was basically like you know a uh uh like a an action chess game and so that's the the kind of like feeling that
I want to try to replicate when I am building this again is one just getting the ability to Think Through okay like how what makes a game balanced what makes a game fun but then also like how do you still have an aspect of strategy without it being too without there being that balance of overpowered and underpowered like players and strategies and stuff like that uh going to use C has got you a
play dat for your birthday I've always wanted to play use a play dat play dat uses Lua that's interesting uh I'm going to I love using Alpine JS that's actually what in the lar cast course that I made that's going to be probably releasing soon I would imagine that's what I used a lot of we built it was basically just Alpine JS straight through uh SVG instead of canvas okay geometric is way easier as see see that
makes sense okay so see there's stuff like that that I'll be able to learn so uh we'll probably use like sushi just hold like the characters abilities hit points that kind of thing so that way it can it's easier accessible and cuz we don't necessarily need this to be fast if that makes sense like this turn-based strategy game there's probably going to be you know a
specific time limit for each turn um maybe like I don't know 60 seconds or something like that so this this doesn't need to be a real time game in that sense like technically we don't even need to use Reverb we probably do just for this time limit but like we could do we could start it off and not even have a time limit and just say like
you joined this room and now it is your turn to uh make your move and until so it's kind of like this it can be done in real time or it can't be and we can use you know polling for that as well uh but this is going to be still important because if we wanted it to be any sense of real time strategy game even if it's turn based you still need that
multiplayer aspect to it or if you want to like have chat or something like in there um yeah so I guess I'm just trying to replicate that game that I played a lot of uh tactics Arena online uh cuz that was probably like the first multiplayer game I played other than maybe like Battlefield 2 I think back in the day uh do you work for get paid by Lille I do work for laral now so I am um
officially a uh kind of like a a support engineer for larvo as well as kind of half and half so I I do like some support engineering stuff mostly helping out with the larl vapor product which is something that I've used for a long time and still love and then I also uh do a lot of videos for larel so on the larel official Channel you'll see some of my videos usually I try to do one or two a week as well as my own personal Channel that I do on the
side um yeah you need Reverb to Ping the opponent that their round starts yeah uh yeah that's probably like a a good a good reason to as well you could probably use like the database and like uh like Livewire events to do it too but yeah you still like like if they're in the same room it's helpful to do it instead of having 5sec pulling and stuff like that um real time match between two
players exactly that is what the the goal is to be able to have this again ever this is probably the wrong way of trying to accomplish building your first game is basically making something that is already incredibly difficult like if you were to say let's build chess as a first game most people would say hey that's probably not a good good idea like build
tic TCT toe first but I've never done anything the easy way so we're going to build a multiplayer chest with specific hit points stuff like that okay what else would we need so we'll probably handle this just in like flat file and then we also we we obviously need like
multiplayer ability so like there should be different accounts so there there's accounts for each game um yeah see in my head is this doesn't seem like that hard of something to to accomplish you know so why don't we I'll
go ahead and flip to this view right here why don't we we start uh start doing it so let's see open this up okay uh your approach is a good deserve your exercise thank you yes that is that is the goal there's so much that
I think we can learn from building a game and anyone who has built a game like I know gummy you have or you're building a game and there's probably a bunch of different people who have either built game whether it's small or big or anything like that you learn so much stuff of all this stuff and it's going to be applicable not to games as well so just like thinking through so we we'll start um I don't even know what I would want to call it but it's it's going to be like a chess action game
strategy so we'll we'll just call it something extremely generic and we'll just say uh strategico there we go uh I'm going to use larel Breeze with class API and mostly that's just so we can get like accounts so the first thing I usually like to do when I'm building
anything new again first time game but I already know in my head of like how I think this should like start off and it's because you know it it's it's very similar to applications in a lot of ways uh um yeah you learn so much by building it's obvious but still a bit mind-blowing exactly you learn so much by just doing things over and over I've I I've built like a couple real world
applications and products that are in the wild right now but at the same time the stuff that I've learned the most and obviously I learned a lot from like building them from start to finish but even the very simple stuff that I've done for videos or for you know demos and stuff like that I've always learned so much too because
um you there there's different like tasks and stuff that you come across where you're like Hey how do I now have in a event room like like how do I have multiple people able to be in an event room but only the people who are registered to that game be in event room for example like there's going to be so much stuff and that going be applied two different applications to so strategico it's actually pretty cool
name I I'm not going to stick with it probably but like I I it I honestly think that like making a game is so much more fun than building an application but I I know that it's because it's hard to um so yeah let's go ahead open this in vs code and um I'm going to pull open
the chat over here just so I can like read still while I'm while I'm building uh but the first thing I want to do let's go ahead and open this in a web browser and we'll pull that open here okay so I'm not even going to like worry about oops I'm not even going to worry about um like styling yet I just want to
have the ability to have um basically like set up all the structure for it so like the models of okay you need a game should have like its own game room and stuff like that so like how thinking through the different models um oops there we go okay so we can start building it in the dashboard
itself with games you get a whole different gummy says and twitch with games you get a whole different relation with the container and events yeah that's that's a good point of thinking and it it's really similar again I'll talk about this just because this is what kind of reinvigorated it but I was building um what we're going to be building in the latest lyric cast course that I created um is basically a
realtime podcast listening app so in the sense that there's a specific start time for when that podcast starts and then you can join that room and listen to the podcast together so imagine like live streaming a podcast but it's only like a one-time thing and there was a lot that I learned from building that that I think can be applicable to building this
game in the sense that um you know it's you don't have a game that uh uh usually like within like a multiplayer game there's a start time and an end time like that's it and you you have to have this synced on the server and like all this fancy stuff and that's what we're going to like think through in the game so like it I learned a lot just from building that realtime podcast listening
app and so I think I can apply it to the game as well so um let's see so we have accounts turnbas strategy game so let's look at um why don't we say uh let's see like some models so first
we need games so a game would probably have like uh has like two two accounts so like two users within the game it has like a set start time um game probably also have like their own there's multiple turns
per game and each turn has its own uh turn time and the turn is also associated with the user and yeah turns turn time turn associate
with the user and a turn has like an event and that's probably like a terrible word yeah gummy actually metion recommendation gummy on Twitch says don't use the game keyword while building game limited to two players open the more it's going to be limited two players so two players per game and maybe that's like a good is a room maybe a good word for that yeah Lobby room match I think there's lobbies to find games and so a game would then be maybe
like a match that's a that's a good word match so a match has two users uh uh um yeah a mod I actually have a video about how my my vs code set up it is the Capuchin frappe theme and the icons are capuchin frappe as well I'm probably butchering how you say that um so match has two users there's a start time per match there's multiple
turns there's obviously like a winner per each match um the turns have a turn time they have a user and event is probably a bad name for this but my thought is a turn has um my thought is a turn has some an action that's a good word a turn has an action so in the sense that each turn is going to hold the
the what happened in that turn and so a match has a lot of actions based off of turns and I don't know if this would be like a good like polymorph relationship um I'm open to ideas from from you because I think you're you're the most the most experien and anyone who has an idea but my thought is should a match have actions or should a match just have
turns that have actions my thought is a match has a bunch of actions so there are actions related to the match but they're only related through turns because I probably wouldn't need to say okay this match has all these actions uh make the action events on the aggregate okay that probably makes sense yeah so the the turns have a bunch of
actions and a match has a bunch of actions that are related through turns and then so match has a winner start time two users turns each turn has its own turn Time It's associated with the user it has an action in this case the action is what happened during the turn a match
has um characters I don't know if that's the right word for it but it has yeah characters um models your match is your gummy says your match is your Aggregate and each turn is an event on that AGG modifying the match State matches your
aggregate each turn is an event on that aggregate okay yeah yeah yeah so there's there's turns matches the Aggregate and each turn is also an event on aggregate don't think an eloquent models when doing event sourcing see that's that's the that's the stuff I probably
need to uh to learn so like in verbs I I I'm guessing this is what I'm going to learn a lot through this there's events and [Music] okay instead of knowing just the current state of your app every change event
that leads to the current state is stored okay yeah so that's why I'm I'm missing how it's thinking because I'm not necessarily storing all of these turns in their own database model that's why event sourcing happens so a a a a match would be a um a match would probably be an eloquent model in the sense that we
need a match to start all of this but the the turns would be the event sourcing piece where every action has a turn that kind of thing um okay I think I get it are you going to these Live Wire yes I am so Livewire Alpine that is that is the that is the goal so I'm going to use Livewire for a lot of like the live actions events and
stuff like that um within Lille Reverb and then we'll do a lot of um hopefully the ability is for me to understand see combating jarin okay Aggregates there we go state in verbs there we go okay now I'm now I'm on the same page as you got me I've I have not read any of this verbs documentation I've never heard about event sourcing or learned about event sourcing
um until now so we're going to do it we're going to do it live so Aggregates so in this case the state would be our our match uh state in verbs would be our match and then okay Aggregates or states you have a projector many event sourcing system you have dedicated projectors that listen
for events and project data in a convenient shape for your views they're sometimes called projections or maybe view models then you have reactors okay I think I get it so States and verbs are simple PHP objects containing data um stairs so the entire grouping of stairs is the state in this case our
match is the state or the Aggregate and the database models reflect where we are now that we've traversed the stairs yeah so the match is the state within verbs or Aggregate and then the events I'm assuming source of your data changes so yeah the events kind of fit into the state so events would be our actions
yeah events on aggregate um events on state in verbs there we go it's making more sense in my head we're creating a new match that's its own separate State related to each two users within our uh models and a match has a start time has a winner there's turns which are events
and verbs we can have a turn time and and so each turn has its own turn duration so probably like uh Max of 60 seconds each turn has its own user Associated to the turn and an action and so uh actions are related through turns to the match so a match has multiple
events of actions through turns M okay I think it is making more and more sense see if I missed anything here did you miss anything important no not not yet okay this is this is me just brainstorming with you the viewer along
with me of like how would this work cuz in my head it's going to be really difficult but it's also going to be really fun um yep Capuchin theme frappe and yeah yeah uh great idea to be chess oriented yeah um okay so what's the first thing that we can do the first thing that we can do
is let me set up I'm probably not going to get to figure out what uh what verbs is but let me like install this so that way like we're ready to go so we're going to install verbs we're going to publish we're just going to I always like to get things set up so that when I actually do need it I
know that okay things are like in a good spot so we're going to publish the migrations uh migrates so that we have verb events snapshot State events table and now we can generate a new event and so the event would be our actions right because our state yeah yeah utilize in States states and verbs are PHP objects so create a new state customer State yeah yeah so state would be a
match okay that's making sense let's do Reverb as well because I know I'm just going to use it so again I always like to just install things that I'm going to be using um just so I can have things like out the gate so the first thing I want to do is um create new rooms for users so two users
can join a room in this case a match and maybe we'll create th this is probably uh probably the wrong way to start breaking it down but the first thing I want to do is make the ability to have a countdown timer um for a match so a match has and maybe we'll do like turns um and I'll think of this in models first and then maybe can I can
push it to like a event sourcing and stuff like that later uh but I think a good starting point would be no more than two people can join a match once two people have joined a match again this is super basic level once two people joined a match let me write it down oops so what's the first
start first start let's create the ability to have uh matches so once two people have joined a match the turn timer starts and I only want turn timer so basically just one turn timer just to start off with uh so um 60 seconds there we go so that would be a
good start to say there are now matches and now we can have that place to store all of these events so let's go ahead and um start the Reverb
server nope it's because it's already started it's probably because my lville herd setup let's see here yeah I can just do this instead
EnV there we go all right so we have strategico do test here the ability to be able to join a room we need to see how many people are in that
room so that you can only join a room a match so room starts a match we we'll we'll we'll keep him together so room has a match uh let's show all the matches available here and how many people are in that match so just to start it off why don't we say
PHP artisan make model and we'll just call this a match and create a migration for it and a factory name match is Reser wow I did not know that that makes sense ah so a room it is what's another word for match let's see anyone have any ideas here uh you also need one shared timer
for all players it's a good idea you might want to manage the match time on the back end lazy Dolly thank you so much for uh for joining cool Hat by the way yeah do you like my uh indoors hipster hipster hat um you might want to manage the match time on the back end to prevent front end refresh and reset timer okay yeah one shared timer for all players that makes sense yeah so like a turnaround timer so not only does each turn
and so maybe that's like a good way of saying it like um a turn has a timer but that's technically associated with the match the match timer just resets on every turn so maybe that's a good a good start so we have a 60-second timer um and can pass turns like that's a good I think First Step that maybe in the next hour I
think we might be able to get there depending on my ability to code live sometimes that's really good sometimes it's not that good so if we have rooms and maybe we'll call this a room now instead of a match room bunch of different rooms once two people have joined the first timer
starts um so randomly randomly selected one player randomly selected uh always 60 seconds on the back end and they can pass turns I like it PHP artisan make model we'll call it a room okay let's create our rooms table and again um this is probably the backwards way to do it if you're doing
event sourcing but I'll do it this way first and then then I'll then I'll figure out event sourcing later uh Famous Last wordss so room um there a room it has an ID that's pretty much all we I mean we're going to add a bunch of stuff later to this
because and maybe maybe the uh oh this seems neat thanks will nice to nice to see you um timer might wait until two players are there yeah okay that makes sense yeah one's two players the game I know game is probably a bad word for so like what's another word for game um contest meet event
um event that's a terrible word because if I'm like doing events or say this is this is tough for for name games I feel like that's probably the toughest part because I like a room holds people but do I want the room actually being like the match like a game match and maybe like that's a um so I'll take I'll take advice on
specific wording I can tell you that switching from model to EV sourc is pretty tough as you haven't planned your app as event sourc okay that's a sentence the makes Daniel and John all the dolls uh yeah there we go I'll just we'll just like teach them battle that Nick says battle that's a challenge battle challenge that's that's probably just call it
game uh I feel like I'm going to be rewriting so much of this if I uh match is I I I learned that match is a a PHP reserved words I can't necessarily call it um room being a Lobby is just a state of the room it's a good idea too battle game match
fight uh the app I'm using for taking notes is reflect reflect. apppp I believe you have the pre- running and post state but all in the same room that's that's probably true you I I that that that does that uh that does make sense so it could it's still a room once a room has two players the match has started the room is commenced the room is in in action
State turn timer starts yeah so I guess it could just be room um so we have an ID and yeah let's just let's just do that for
now we'll just get a bunch of rooms on the on the page so we'll just say uh we'll create a new Live Wire volt class we'll say that this is like the the room Lobby again we can refactor a lot of this here I just want to get all of the the rooms
um in one place so if we have the room we'll also just say State this is this is where event sourcing comes in I know it I know this is where event sourcing comes in and I'm just going to have to figure out how this works okay why don't we do that instead we probably won't get where I where I want to be but we'll learn about vent sourcing together okay so
so our state is our room which accumulates and holds every step because and maybe it's not bad maybe it's not bad to have the room have like two dates because we need to know is the has the match started or has it finished and maybe
that can just be a Boolean in the room of two players join the match is started once the game's finished like is game finished um generating a state so example States
let's see loading a state card State load using States in routes States Implement okay let's see this the board game example so you have a game state who's the current active player okay and then you have a player state
for Monopoly so game when game started and now we can set game start okay so this makes sense of why room is
probably going to be a state in the sense that a room is a game room State game State and maybe that's like the way of of saying it so it's not necessarily a room it's just a game State and maybe a room has a game state that might be a good way of doing it too like a room has a game
State hello sorry for Bing you okay I don't know how to where my uh well uh there we go I don't know why it doesn't like let me uh moderate this I don't know how to do moderation
in uh in twitch chat um two states probably will not work turn games probably have more than just game started and game ended okay yeah that makes sense that it makes sense then of why I would need this to be event sourced and why I'm just going to have to bite the bullet and figure out what event sourcing is your bank account is a state and each transaction is an event but you don't
start a new bank account only because you switch your address or your employer that makes sense I also don't know how to do do that as well I'm sorry uh I'll figure I'll probably have to to figure that out let's see chat settings I don't know why it doesn't
users in chat that what it does oh well um I I I still need to learn all the all the stuff for for everything uh each room battle could start and end in one unique State lazy Dolly says um big boy pants go on and go event sourcing I probably just need to do it players gets experience or stats yep yep
so each player is going to have their own unique state within the game enable uh showan icons
uh there we go thank you I appreciate it okay let's just do this then so if we create a new state PHP Artisan verbs game
State and the game state does is game State tied to a room or tied to a model or is it just completely separate like is event sourcing tied to models or is it just all in memory ability for your events to be
replayed yeah that's I can see how event sourcing especially for games is incredibly pop like is is necessary cuz we have our state and old Jer in a fresh app States directory
okay so if we had all of this state so game state so like imagine just everything that this has here and are are these
things use thunk verb okay so like is this stuff models like in the Monopoly example I would imagine these would just be models then like like
um a game state has a a room and a board all that what I miss I think you need a que maybe been sources to use this player press start button then fire event with math matchmaking with opponent player randomly okay yeah um no model directly in the state okay so
like state I don't use models at all then that's that's what's confusing me I've never um like I get that this would be incredibly difficult to build out within models but in my mind I'm thinking okay like how do I list or how do I show all of the the available rooms
within like how do I Loop through them player user ID in the State uh the resol the model so yeah I would I would have I would probably have a list of rooms but each room has its own game state so similar to how like each user is in the the
um as soon as I'm used to it I want something else that makes sense yeah I'm going to start with the the basic room Lobby where I'm just using models and I won't even worry about State here so I'm not going to try to do that I'm just going to say that um we'll list out the room and then just have players be able to to join so
we'll say again this is probably the bad way of doing it but we'll say um we'll say that a room has like a a room limit so first we'll just
get and our room factory we'll just we'll just uh a bunch of them so we'll say that this the the room has h
I'll just have a name for it right now that way I can just generate some in the Cedar so I just want to have a bunch of rooms created just to list them
oops so in the create um in the room Lobby I just want to for now just get them listed
and then we do need to put this in the dashboard okay so the idea is each room can have its own two players and if I was to take a look at the event sourcing piece again
and maybe that's what it meant by then the um where was it in events or in States using States and routs because this is what you would want to do you would need to
pass uh okay yeah you need to pass the state into the route to get the state for the game and so that's probably what we need to do in the dashboard is get all of the game States see yes I guess rooms uh with the toddler to sleep uh what did I
miss models are easy with lay V but I don't know how to yeah I I I'm guessing by the end of this I'm going to be like I'm going to be a full-blown event sourcing shill but we'll see you have to get used to Event Source but soon as you do you don't want something else um uh I don't think I actually have Discord installed on this laptop right now um yeah I I'll take you up on that next stream for sure let's do that uh maybe I
can read a little bit more just to make sure I understand it uh I think you need a CU maybe Vin sour uses this hello a nice to see you um and I think that's it it it's starting to make more sense of why event sourcing needs to happen within a game because
you would need the game State and is a game state I'm that's where I'm think I'm confused of like for this state how do I have multiple game States I know that let's see if there's a a list of them St
cash because I know that each each game state would have its own kind of like what we what we see here in this board game each game state has its own um set of players player IDs so how do I make sure game state is
unique in that sense though that's where I'm a little bit confused about like so does do I still have to have rooms and each room has its own game State and how do I kind of connect the two state is part of your events syst models are mostly for your application youi should always be possible delete all the models that are created and
updated via events and rebuild them all by replaying your event our event life cycle is built to emphasize this before we even fire an event we can check you are authorized to do so okay so this makes me think that that the room model is still important because because we need unique rooms that hold a game state so maybe I can I can I can keep
doing this within with within the room model and then I can put the game state in the room um so let's just do this oops that way I can set that up um for the create rooms table I don't know if I want a a string of name
instead maybe I just want like [Music] cuz a broom will hold the game State and then how do we get those pieces put
together room would hold let's just for now have a Boolean of not is private but like like has started or not that way we can
check how many players are in a room first before cuz the game State's going to hold all of that information but a room and I get I I know this is probably going to be put in the game State eventually my
great fresh just to do that cuz we have a has started default or false I I just want to switch has started to true when two users are in that room and then the game stay can hold all of
that and so we probably need an event maybe this is like an interesting part within uh cuz like there there's the events Within verbs within event sourcing but then there's also like events within Reverb
which like if we're broadcasting we have these specific events that we need to create in this case I just want to say like we probably just need a a a presence Channel
cuz I basically just need to say when two years in the room we're just going to switch it to has started data returned by the authorization call back will may be a presence Channel event listeners and yeah yeah um maybe not even a presence Channel because we
can when a user clicks into a room we could even like fire off the event like there there's there's someone else here H like joined room
and in our room factory just so we have
nope okay so each room probably has its
own does Live Wire work uh but the room only has a projection of the game start state but the room only has production of the game State like start with events then States and only after States the models okay interesting I'm I'm doing it backwards in a lot of ways it seems like uh does live work with State full how do we deal with State here I'm used to with Lille
API and vuejs for my state anyone guide me um yeah Live Wire State full by default you're sending the state back and forth via Ajax calls is basically what Livewire does I doubt we want every event to be stored in the DB what about the DB calls versus performance and round base so nothing to worry about it's not real time give with hundreds of events per second only one every few seconds yeah that's that's that's the key part so that that's helpful in this specific instance is we don't
necessarily have to worry about you know player location everything like that um yeah I think everything's going to be saved in state using event sourcing and we're going to be using Reverb to kind of uh have the timers timers is going to be the biggest thing to and kind of like player actions and everything like
that um we can use session for this probably that'd be a good idea you could put an ID on the game State okay so the game so I don't necessarily need a room then I could probably have a game State and can kind of loop through a bunch of different game states that are available so someone was like Hey I want to create a game they create their own game state which has its own
[Music] ID uh Daniel curn yeah that's who I really need I know um I know Josh also mentioned showing me all about event sourcing as well uh hopefully you get some good sleep you don't want to miss uh I don't think there's going to be too much to miss I only have probably like I only only have maybe like uh 10
or 15 more minutes before I have to call it for today but I think I got I am good on like the next steps of one what I need to learn about event sourcing but then two of what is going to have to take place with this yeah I know I probably need to do this I I I do not do Faker extension as much as I should I don't have it um yeah I do need to get
Daniel on tell me just show me how to do this show me what I'm missing um but I because I think that's the biggest thing that I'm I'm thinking through right now cuz I know that a game state is going to have to be in a state but how will I like how do you create new like how do you have a user create a new
state like cuz I'm I'm thinking in the form of models um and so think think through me here this cuz I'm thinking in the form of models in the sense that I have whenever I'm creating something I have a new model that I generated and a user can now create a new instance of that model because they're creating a new record in the
database in my mind that room would then hold its own game state but if I'm reading everything oops if I am reading everything here correctly then this looks like I probably need to have like not models at
all let's take a look at this one again everything is purely in event state in a real world application you would need to implement a way for users to interact with the state either through digital HP something like that work okay yeah no controllers or laar components everything is purely in event State the current status of the game with information like who is the current active player what's the current yeah okay I get
that let's take a look let's see do they have like here this this is what I'm going to need then I uh I am going to take this examples going to grab [Music] Monopoly let's see if I can set this [Music]
up oops so we have Monopoly views they're signing in okay
components okay so yeah the there is no [Music] models you have the game ID so how does that get
set yeah so there's no models let's just all of uh so game okay very interesting is this just his own yeah these are just his own classes okay game
controller where it shows the index it's not even like passing any and then we can start events redirecting to the games after
login I think this is just all the actual state of the game cuz then states you have game State okay yeah so these are just all classes like these like the the bank board and phase those aren't even those aren't models okay it's just all there's no models very interesting I don't know if I'm smart
enough to understand all this um so then in routes so then we have games we're passing in the game index I I this is where I'm getting lost at like how you can have multiple games because in the games
index game ID the Monopoly layout like where is it getting passed into maybe maybe someone someone Els a user isn't a childhood game so user can be eloquent only okay so the user is
probably the only model that I'll have um we feel quite dumb when we don't understand exactly that's why I love live streaming this I love like showing one um that I I it takes me a while to understand something so when you watch like a video of me uh talking about something usually I have spent double
that time first making sure I understand it properly and this is going to be turned into a great video in the long run of like what the freck event sourcing is uh I'll get Daniel coor on Daniel if you're watching I need you um you can mix models with event sourcing so users can be models it sounds like users is probably game over
no models um sounds like users is probably the only piece that I need as a model then I don't need a room because those are just going to be like in in this Monopoly example it's just going to be um it's just going to be Gam States so there's new games and I can Trash all of my all of my notes then in the sense
that um these can be like game State match State I like match better than than game um so match State and turns are still going to be events [Music] so like uh and if I'm following what
the um Monopoly setup is for uh States the player state would be then the turn and so maybe it would be except this player stay is more of like the um H cuz this this is for Monopoly like
how much money you have but that that might be something to think about because in a player State instead of turns it might be like a like a player state has turns so match State match state has turns and then I would have a separate State that's what it is have a player state where it has uh you know what the because these these turns and player state are probably
going to talk to each other in the sense that a player state has its own characters or um maybe we'll just say Champions that's a bad word for it all like uh characters what's a good word for that like models um pieces yeah we'll just say so player state has like what is the state of the
pieces and there probably is also like a pieces State too of like what is there like points that kind of stuff but I would imagine that could just live in the player State because then you know how many pieces they have what are the hit points for each piece so pieces separate State player state
has action state or match State also has how many turns have passed I guess that would be like the event history and then player state would also have in as well as pieces that might even be their separate state of I don't know about player State then it would just be pieces and maybe that's
its own state so like player state has its own pieces that have their own state so that part I'm still thinking through game states which has its own players IDs I I'm still missing that piece cuz we have the controllers game controller we have the index but it's not passing any games into
it where is this game ID coming from and how is it being passed I know this is a work in progress so maybe like it it doesn't exist yet um events setup game started okay yeah so here's where the
game ID is and maybe so that just like has its own event that applies to State that's really interesting am I gonna love event sourcing I think that's the that is the the question of the day why would you here's here's like here's like a legimate question for for
those um like with Among Us you have to know the six-digit game oh okay okay they have to probably manually inter it that makes more sense but there probably is some way to like query for all the game States I would imagine you could say hey give me all the game states that have not yet started and show them in some way shape or form um how come you're not how come you're starting with Monopoly not
something similar to TI to I'm not even starting with Monopoly I'm doing it more advanced than this um but the the premise is is like I love learning by figuring out hard things and so we're going to figure out hard things together and so I'm building a chess basically like an action chess game so turnbas strategy um with events sourcing I've never learned event sourcing before so this is going to take a little while
this is only Hour 1 hour and 15 hour and 10 minute one the first hour and 10 minutes and we have some notes but that's a good thing cuz I think I've learned that there is no um there is no models in event sourcing um you would still have models to anything you want to dis play in the UI
but they are built around what you want to read not what you have to write as far as I know if that makes sense that makes that makes sense so you're not in this sense the only thing we would probably need in the UI if if I can show and list the game states in the lobby let's say there's a there's an entire Lobby and you
can um click on open and available games so let me put this in in in words right here um so uh how to start a game so users can log in or create an
account in the dashboard they can view a list of available and open games or they can start a new one once two people have joined a
room the game begins so like I I imagine a a a grid of different lobbies in this case so like there's one big Lobby of multiple different waiting or games to be started and so in that whole scenario there is probably no models if I can show a list of Game
states which I imagine I should be able to do that if I can join a game state by an ID I could probably view all game states by ID would be my guess and then once uh once the game begins it becomes unavailable in the mod in the main
lobby but there could be models for example outside of the users because I I would imagine a user could be a model because I would need to display like information about their profile that kind of stuff outside of games um and maybe even like uh you know things like experience level you know that kind of stuff like so a um
so a user might have things like experience level their profile maybe like stats on games like all all that stuff would technically still be stored in the model or probably best to be stored in the model because it's not necessarily part of the game state or player state which exists within a game or match
um but the there could be like a chat room for example in the main lobby and that would be its own model like you wouldn't want that in state um only from yeah Event Source models are read only okay Event Source mod so I could have a list of Game States though like
if if I had a list of match States in this sense views is in the navigation so views games
index join an existing game [Music] start a new [Music] game okay so they are asking for the game
ID but then yeah I don't know why I'm I'm I'm being kind of dumb in that sense because if if they're asking for a game ID in order to start a game in this sense the components oops Monopoly Source uh we'll do the controllers uh Source controllers game controller when you're starting a game
to show the game you're grabbing the game State and in this case we could probably there's probably a way to load game state for all games or at least have a list of all games so I I that that is the one piece I have a question for and I'll ask Daniel or whoever um what's the best way to show a list of all games on one
screen all game States based off of I just want all game states that the game has not started and since that is loaded in the state like is there a way to query events in that sense or event States let's see is there a way to query
States loading estate state is loaded once then kept in memory even as you apply events and maybe that's what you can't necessarily load a bunch of different states State
Collections find it helpful real done to pair your states to your models states are there to manage event data and memory which frees up your models to better Ser for facing gu needs once okay okay there we go this makes sense there we go so once you convert to unique IDs you can use your state instance's ID to correspond directly to a model
instance probably need another state okay so I think I think I have the answer a room has a match State and this state ID this ma the match state would be linked
to the room ID so that's how I Loop through a bunch of like rooms now I don't know how I can query give me all the rooms with the state of um like not started cuz it sounds like here here's my uh next steps
it sounds like rooms are models but linked to match state which we can do here so the question would
be how to query models based off of state or should State Control the model by like um modifying the has game started column does that make sense my question is does stuff like this just exist in state which I'm guessing not
because then there's no way of like showing has it ended as it started that kind of thing I should probably have this in the model but have the state control the model cuz this this is what I need to show and if I'm basing off of what this I use my UI or models to serve your front-facing UI needs I need the rooms to show based off of if they've started or not or available whatever wording I
want to say so that's that's the biggest question um and the next question would be the user has all their stats so that should be good do I need and a room probably as the Reverb ID event okay I think those are the biggest next steps like rooms are
Miles blink to match state I'm probably going to have to start wrapping it up shorter stream today um but I liked jumping back into it it's been a while since I've streamed and now I got like solid next steps so again this was just kind of like planning phase we didn't get that far that's okay [Music] um I've left you a Twitter DM okay I appreciate it uh a match state has a
room okay the room can be deleted and reprojected from the match State okay so I don't need the mo model that's going to be my that's going to be my homework before next stream I might be able to stream tomorrow to to learn a little cool concept I planned on making a few games for there by myself verbs look a go yeah that's anytime I'm making something it's to learn something new there's very rarely times I'm make something like oh like I've never learned how to do this or I know exactly
how to do all this I don't know how to build a game at all I've never built one and I've never used event sourcing so this is the this is the way I'm going to do it um let's see let's see let's see let's see are you using some kind of filter in OBS looks pretty cool your camera lighting thank you yeah I am um it's very uh I'll have to make like a quick
look video of of how I do it um yeah every like all of the different like ways or like scenes are in OBS so like stuff like this is all OBS um and I have I believe I have a a um what's it called let me pull it
up I have on my camera I have like a a a mask to askk get to like the the rounded corners but then I also have a little bit of color correction um so I'm using a Panasonic Lumix G7 as my webcam and then I have a l that is a free Lut for the Panasonic G7 and that's like set to maybe like 60%
so that gives it like a little bit more of like that cinematic type look um but the good thing is I love having it all set up out of the box so I don't do any kind of like color grading or editing when I'm making videos I just record and then I add some music or whatever afterwards um after games finished add column finish game okay yeah so that's
that's the part that I'm going to get some help in of like cuz I know that I could probably like redo all of this once I get it done but I want to make sure I'm understanding it properly and that's that's the thing is like it's good to just kind of like build and then reiterate when you learn more but with this I do like it is a different mental model and so I do want to make sure I understand okay what stuff am I storing
in the model in the database and what stuff is just event State especially when it comes to games and this Monopoly one is going to be one I I I take a closer look at I'll go ahead and uh I'll throw this this in the chat for people who are people who are watching um because I think that's one that I'm going to do a little bit more digging off stream at just to make sure
I understand it completely and maybe I'll try to get this like set up as well uh but where does State actually live when there is multiple games and it's basically trying to get it out of my head too of the sense of there can be multiple games in a uh that that these users let's say
there's 100 users on the app there's 10 games that are ready to go who have one user each in them once a second user joins that game the game starts uh but we need the event history also of okay how many how many games is this person one um and that's going to be in like the user stats so that's technically probably being saved to the model so stats on games maybe they have like
maybe the experience level is like an ELO kind of stuff all of this is probably saved to the model I understand that the rooms SL a match piece is where I'm I'm I'm confused of which stuff am I going to save to the model which stuff am going to keep in the match State um yeah I think that will be where I call it for today um Josh love you
could you make videos on filament I'm recently getting PHP honestly never leaving so would love to see such videos thank you I appreciate that um yeah I I am planning on doing like a more of like how to use filaments like forms and actions and stuff within like a live wire app so that's kind of like the one of the next videos that I have kind of in the pipeline um one thing also to note is if you go to C not r SL suggest
that is where you will see a little bit more information on um kind of like what people are voting on as the next video I should make this is obviously a pretty popular one um uh but the which kind of like these two link together I'm probably going to make one video with both of these um but the building aass of filament 3 is something that I'm uh contemplating or going to start planning
as well um but yeah hopefully I'll see most of you all tomorrow I probably should be able to stream a little bit and maybe we'll see how see how far I get off stream of just kind of like learning and trying to understand all this uh yeah maybe we'll do some some fun stuff once I once I get it all but yeah I think this was a this was a good stream overall I think I learned a lot I thank I thank you all for for for joining and for for being
here with me learning event sourcing I appreciate it um yeah hopefully you have a good rest of your your day I'll see some of you tomorrow hopefully um until then have a good one