Placeholder Image

Subtitles section Play video

  • Hello, world.

  • This is CS 50 on Twitch.

  • My name is Colton Ogden.

  • And today we're going to journey back into game development.

  • These last few streams have been sort of catered towards web.

  • And actually, David and I did one on the CSU the sandbox after day.

  • So if you're looking for a quick way to spend a coding environment in the Web browser, go to sandbox dot CS 50 dot io super awesome website that we talked about yesterday.

  • So today we're going to go back into game developed The last game that we did actually was mine sweeper, I think, which was, I think over a week ago might have been two weeks ago.

  • Actually been doing a whole bunch of different stuff, actually, a lot of Web development, but indeed, we're going to go back into games today.

  • So I'm gonna switch over to my computer here.

  • We're gonna be using love to decide you're not familiar with love.

  • It's an awesome to D game development framework.

  • You can go to love to be dot or ge and download it for your operating system.

  • They have quite nice availability for on Windows.

  • Efron.

  • Mac, if you're on Lennox and some other operating systems.

  • We've done a lot of streams on this in the past, so definitely check out our prior playlist.

  • On other games, Mind Sweeper was the last one.

  • We did that in love today as well.

  • Today we're going to be doing a card game.

  • Gonna be taking a look at solitaire.

  • And I thought I would pull it up here.

  • Just we could see what it looks like.

  • It looks something similar to this where you're essentially given a deck of cards.

  • Standard 52 card deck.

  • You have normally seven piles here, which are I don't think the technical term is tableau.

  • I think tableaux are first to the portion of cards that you have actually revealed and set on a given row or a given.

  • Call him in this case, and then you have the four.

  • Um, what are these called?

  • I forget what the exact name of these is called.

  • Do you happen to know in what the what?

  • The name of these is called?

  • Four sections.

  • We're joined today by in the back who's kindly helping us get everything set on all of our platforms.

  • But the goal is to basically fill these four sections of the top of the board with all of the cards.

  • Ace to King of the different suit so you can see there's hearts, spades, diamonds and clubs.

  • And if you're unfamiliar with sort of how cards are laid out, you start with a CE 23456789 10 and then Jack, Queen and King.

  • And that's the sequence of cards, and all the cards are also given a suit, so you get all of those secrets of cards.

  • In addition, they have a suit of hearts, spades, diamonds and clubs and essentially, you.

  • Your goal is to get all the cards there in order, but Nor to do that.

  • You can lay them out here in reverse order.

  • You know, starting with the top card, the king card going down to ace.

  • And you know, once you have all your cards that have laid out in this way, it's very easy to take those cards that sort of lay them out in that sort of ascending order at these top level here, for example, this four I could easily just bring over if I if I had the three of hearts here.

  • I could bring that four parts more easily to the top than if it were in sort of descending order.

  • Or rather, a sending order laying from the king down.

  • Richard from the ace upwards.

  • So, thanks to everybody who has been in the chat here, have the dialogue here.

  • Open jeans.

  • 02 to sing big up guys doing nice work.

  • Keep it up.

  • Very much appreciated.

  • Um, Andres here in the chat, Bella cures crazy Flock.

  • Sharlene, I presume this is a lu love to de stream.

  • Are you using any love to de libraries like love frame or is it just going to be done from scratch?

  • Excuse me, and I just realized I apologize.

  • I had the chat visible on the, um, screen there, but the we're not going to be using any library.

  • Well, that's not true.

  • We will be using Some libraries will be using the class library from helper utilities for maximum productivity, which is an unfortunate acronym.

  • I brought this up in multiple streams.

  • You can look that up.

  • So if we go to class helper utilities Lua love helper utilities for massive progression.

  • Sorry.

  • Massive progression on and they have a class dot lua here so you can visit this girl.

  • If curious, I can actually plug it here in the chat, unfortunately named.

  • But that's just part of the loo ecosystem.

  • It's a very good set of libraries.

  • I highly recommend using it will be using that for object oriented programming and lua when we've used this on prior streams.

  • But if you're unfamiliar, object oriented programming basically lets us instead of using raw numbers and tables and those sorts of variables, we can actually model things like cards and decks and all sorts of other, more complicated objects that we wouldn't traditionally be able to get with the language sort of as it comes.

  • Standard language.

  • Shalini saying Gotta love all the love to t library names.

  • Yes, indeed.

  • Some very funny names.

  • Libraries.

  • Um, awesome.

  • So thanks so much.

  • Everybody who's here already.

  • I'm gonna go ahead and just shift this Which over here their shift.

  • The chat Over here.

  • Um, let's get started.

  • So we know the rules sort of.

  • At a glance, we can see that we're gonna be using cards, so we're gonna need some way to sort of have cards that are visible in our game.

  • Um, so for this, we're probably gonna need some sprites so we can go to something like open game mark dot org's.

  • For instance, I'm gonna go here.

  • Open game are dot org's an awesome website that I use in the games class that I teach s.

  • So this is, uh, CS 50 dot except orc slash games, which will allow you to go and learn game development from the beginning so you can learn pong.

  • We go up to Flappy Bird, match three Super Mario brothers all the way up to unity stuff, actually.

  • And in that course, we end up using a lot of open game art dot org's stuff.

  • Um, excuse me for just one second.

  • Let me make sure everything is okay.

  • Um, I apologise.

  • Let me just make sure my mike is good on battery, but I just want to make sure that it's 100% okay for the rest of the stream because this one's going to run a little long, so give me just a second.

  • You might hear me cut out my audio.

  • All right.

  • We should be back up with a fresh battery.

  • So awesome.

  • I want to make sure we don't die suddenly on street when everyone's wondering why I'm completely gone.

  • Quiet.

  • Um, awesome.

  • So David's in the chat.

  • Everybody shut up David David Jamil into the stream yesterday on the sand box.

  • Seats for the Sandbox, which sandbox?

  • ASU's 50 dot io, if you're curious, allows you to spend up a temporary programming environment from scratch, which has a lot of awesome preinstalled languages and environments and libraries and stuff.

  • So definitely check that out.

  • If you didn't want yesterday's stream.

  • And if you have a Marchesa extreme, definitely do so so that you could get a sense of just how it works and the things that you can do with it.

  • So open game are dot org's, as I was saying earlier is a platform, a website that has a bunch of completely free gamer game programming, artwork, sprites and three D models and also things like audio, which can be kind of important to if you're not a sound designer and maybe you want some free audio assets, you could definitely check that out.

  • Um, but what we want to d'oh is I don't want to make a bunch of cards from scratch because when we didn't mind sweeper, I ended up doing a bunch of sort of making minds from scratch, and that was okay.

  • It was a pretty simple set of sprites to develop, but cards a little more complicated, and they all have suits, and I don't really want to be bothered with actually making, and I kind of want to make it look nice to begin with.

  • So I know that there is a pack of nice looking cards that we can use here.

  • So if I go over to Simon Type Casino, I ended up looking at this in advance just to, um, sort of pre curate the kinds of art packages that we might want to use.

  • There's a nice package called Board Game packed by Kenny.

  • And actually, Kenny is a artist that I use a lot in the Games course who kindly makes a lot of his artwork available here for free.

  • I'm clicking on the board game pack, and this, I think, is actually a fairly high resolution piece of artwork.

  • Yeah, they're 68 playing cards.

  • They don't necessarily specify the resolution here, but I'm just gonna download it there's a link right here.

  • Most of the artwork, as I said on this Web pages, very kindly made available.

  • In this case, you can see right here the license is public domain, which is really cool and answer great beram question.

  • What's the topic today?

  • We're going to be implementing the game solitaire so you can see here if I go back to this page.

  • The game Solitary is kind of, Ah, classic card game that was popularized in the Gold Rush age in a sort of in Canada and America Mech in the late 18 hundreds.

  • But essentially, it revolves around you getting a deck of cards.

  • You lay out a bunch of cards sequentially, Um, starting with one cards, two cards, three cards, four cards, most of which is actually unrevealed at the start of the game.

  • And your goal is to get essentially what's that was an accident.

  • Your goal is to get, um, all of the cards in the deck from Ace to King up here on these four sections, and they're all suited to so you get you get your heart's cards, your spades card, your diamond cards and your club cards.

  • Another important thing to actually is as you're laying cards out in these stacks here where you're trying to lay them out, sort of in descending order where you start with King and go all the way down to ace, You want to make sure that they're all in black Red order.

  • So notice here in this particular area, you can see that it goes black, red, black, red, black, red.

  • So King Queen Jack 10 98 So not only do they have to be in descending order proper order, but they also have to be cross colored.

  • Have to be in a pattern, that sort of pattern.

  • And you have seven sort of sketch areas.

  • I guess you could think of it as in order to lay things out and then call the tableau is the term I believe for the set of cards that you've laid out in any one of those given stacks.

  • All right, so let's go ahead and check on that pack.

  • Let's see what we have to work with.

  • So we're gonna download this.

  • These assets were gonna get a bunch of folders here, so I'm gonna look in the probably in the P and G folder for the cards, and the nice thing is, they actually give it to us.

  • They give us card backings as well, which is nice, because we will need to show some of the cards as hidden.

  • We'll see.

  • Let me see if I can actually pull up an example of what the solitaire deck looks like when you first start out the Salter Salter's starting layout.

  • So this is great.

  • So this is exactly what it looks like when you first start out.

  • And this is actually playing a version where you lay three cards out at a time from the deck and we're just gonna be doing one card at a time, which is more of the Windows version of how it's implemented on and also a little bit easier to win.

  • I think you have a 90 something percent chance to win, as opposed to a 75% chance to win.

  • But these are the four decks where you're supposed to lay out your cards from a sticking in the different suits.

  • These are you're sort of starting staging areas, and this is all completely randomized, all drawn from the deck.

  • You start off with one card face up.

  • Then you start with two cards.

  • The top of witches face up on the bottom, the rest of which are faced down.

  • The same thing happens here.

  • Then here, then here, then here.

  • Then here you only get one card, face up all the rest of the cards, get face down, and then here's your deck.

  • And then here's the one card that you get to draw from the deck at a time to place down either on any one of your staging areas or if you happen to get an ace, or if you've laid an ace down and maybe have laid down some other cards in your four deck areas, you can place the card there, and we'll sort of see how the rules work out and mess around with it.

  • But this is the starting lee out.

  • This what's gonna look like?

  • Ondas.

  • You can see my Prior note was, we are gonna want to display cards that air face down.

  • So not only are we gonna want to show face up cards but also have a card backing so that we know we're drawing a card or we don't know what the card is yet so kind of an important consideration.