Placeholder Image

Subtitles section Play video

  • SPEAKER 1: All right, welcome to GD 50, lecture 7.

  • This week we'll be talking about one of my favorite franchises of all time,

  • a core part of my childhood--

  • Pokemon as shown by the Poke Ball on the screen there.

  • So back in 1997 I think it was, the first Pokemon

  • game was released, Red and Blue.

  • I believe it was released a year earlier in Japan where it

  • was released as Red, Blue, and Green.

  • And the overall goal of the game was fairly straightforward.

  • You were a Pokemon trainer.

  • Your goal was to go out into the world and try and capture

  • any number of 151 different types of these creatures called

  • Pokemon that were based on a whole bunch of different types of creatures.

  • Shown in the screenshot here, there's a Weepinbell fighting and Geodude.

  • A Geodude was a rock type, Weepinbeel was a grass type.

  • You had different types of Pokemon.

  • When they fight each other, some types were better than other types,

  • like this sort of very large rock, paper, scissors relationship.

  • And it was just a very addicting formula.

  • You'd have a team of these creatures that you had caught and raised

  • and battled, and you'd fight other trainers.

  • And the awesome part of this was you could go

  • and you could actually fight your friends,

  • or trade Pokemon with your friends that they had caught.

  • And you would often share stories back and forth

  • about the different rare creatures that you would have encountered,

  • and all sorts of things.

  • You'd have a customized party that was sort of a part of you.

  • And so this is Pokemon Red.

  • The series has evolved over time.

  • This is a screenshot of Gold and Silver, which was released a couple of years

  • afterwards for the Gameboy Color.

  • Again, this was released for the regular Gameboy.

  • Gold and Silver introduced a bunch of new features including breeding,

  • and a day, night cycle, and a lot of other things

  • that became part of the core series.

  • Here is Ruby and Sapphire, which was for the Gameboy Advance

  • and got a significant graphical update, but the core formula

  • stayed much the same.

  • Here is Diamond and Pearl, which is for the DS, which

  • it made use of two screens, as seen on the top and bottom there.

  • Here is Black and White, which was another step forward

  • in that it introduced three dimensional graphics for the over world,

  • so you could actually see some sort of 3D for the first time in the franchise.

  • And then more recently, we've seen for the 3DS, games like X and Y,

  • which is shown here, and Omega Sapphire, Alpha Ruby--

  • Alpha Sapphire and Omega Ruby, and Moon and Sun.

  • And so this is a great illustration of why

  • the RPG genre of video games, role playing game,

  • even though it's sort of its own unique take on the formula.

  • But it allows us to, we can sort of dissect this and take a look

  • at what makes an RPG and what makes a Pokemon game altogether

  • for a nice cool demonstration.

  • So today, we'll be talking about a few new things.

  • We'll be doing things a lot differently in this lecture example

  • relative to other examples, because we're transitioning away from the state

  • machine and talking about a construct called the state stack, which

  • is effectively a more advanced version of the state machine.

  • Whereas before, we had a state machine that was in one state at a time,

  • whereby we could be in the play state or the start state or what

  • not, we can now actually have multiple states

  • that exist in parallel that are on a stack of data structure, which you've

  • seen in CS 50 if you've taken, where we can have,

  • for example, the field state, the play state at the very bottom,

  • which is always there, and then we can push states onto the stack

  • as we need to for example, a dialog state

  • so that we can actually display some dialog,

  • some text to the screen without getting rid of the play state

  • that we had there before.

  • It allows us to render multiple things at the same time,

  • and then also return back to prior states,

  • rather than completely create new states every time

  • we want to make a transition.

  • We'll be talking about turn based systems.

  • So an RPGs like Pokemon and others, there

  • are often battle systems that are usually

  • turn based in this particular genre where you're fighting-- you have

  • one team or one character fighting against against one other team or one

  • other character, and you take turns fighting each other.

  • And you have an indefinite amount of time to make your decision

  • and then form some sort of strategy as to how

  • you want to approach the problem.

  • We'll be taking a look at a very primitive turn based system,

  • but a fully functional one today.

  • Another huge aspect of this genre is graphical user interfaces or GUIs

  • as they're shortened.

  • Things like panels, and scroll bars, and text boxes, and menus, all

  • sorts of these things that allow us to get a more visual sort of look

  • at our data, and allow us to navigate a much more complex game ecosystem more

  • efficiently.

  • And to tie it all together, RPG mechanics at large,

  • we'll be looking at things like leveling up and experience

  • and how to calculate the damage that one party does to the other party

  • throughout the course of a battle.

  • And so it will be a fairly complicated set of examples,

  • but fairly illustrative of the genre as a whole.

  • So I'd like to demonstrate sort of the example that I put together.

  • If I could get a volunteer from the audience to come up and take a look.

  • Tony that'd be awesome, thank you so much.

  • So this is my simple but fully featured, more or less, demonstration of Pokemon.

  • So if you want to enter or return.

  • So this is a--

  • so here we have a--

  • we can see right off the bat, we have a text box and a play state

  • like we did before.

  • So this text box is actually a state that's layered above the place.

  • So you can see it has some instructions about, if you want to press P,

  • you can heal your Pokemon.

  • You can press Enter to dismiss.

  • So if you go ahead and press Enter, you'll

  • be able to actually move around now.

  • And so something to note is before, input was actually

  • halted while the dialogue was on the top of the screen for the play state.

  • You're actually not allowed to access or update this bottom state,

  • because the state stack is only allowing input to the top state.

  • And so I have limited the play here just to this box,

  • but if we walk in the tall grass down here, in Pokemon,

  • in order to actually initiate an encounter

  • with another Pokemon or another wild Pokemon, you walk in the grass.

  • So here we've walked in the grass.

  • There's a random chance for this to happen, there's a 1 in 10 chance

  • basically.

  • So it's saying that a wild Bamboon appeared.

  • So a wild creature appeared.

  • He's level 5, we're level 5, should be a fairly even battle.

  • So you can press Enter, and it will say go

  • the name of your Pokemon, which is an Aardart in this case,

  • and it's randomly allocated at the moment.

  • So go ahead and press Enter one more time.

  • Now we can see on the bottom right, we have a menu.

  • So we can fight or we can run, so those two choices.

  • So we can go ahead and fight.

  • So we fight, whichever Pokemon has the higher

  • speed will go first and do damage.

  • We obviously, do a lot more damage, but he's a little bit faster,

  • so he's going to go first.

  • So we fight one more time.

  • We should be able to knock him out.

  • So as soon as we do, we get a victory message, we get a victory song.

  • If we press Enter, we'll actually get some experience

  • for defeating that enemy.

  • So we've got quite a bit of experience, we got 65 XP.

  • In that bottom bar, we can see we have all these GUI elements,

  • we've got a panel here, we have text boxes, we have progress bars,

  • all these pieces are coming together to give us sort of this turn based system.

  • And so after this, we may level up just to demonstrate

  • leveling, which is part of the RPG mechanic side of this game.

  • So we have to press this one more time.

  • We did, perfectly.

  • So they leveled up.

  • And so now we're level 6, so we can see the 6 changed above our progress bars.

  • So now will be a little bit stronger every time.

  • And the stats aren't shown here, it's actually a part of the assignment

  • is to create a menu that will actually show you how you leveled up,

  • what stats actually increased.

  • But underneath the hood, behind the scenes,

  • you actually are getting stat increases.

  • And so here we can see that if we our HP goes all the way down to zero,

  • we faint.

  • And when we faint, the screen instead of fading to white

  • will actually fade to black to illustrate the difference

  • between the two transitions.

  • And so that we can keep playing indefinitely,

  • the game will restore your Pokemon back to full health.

  • And so this will go on forever.

  • This is effectively what the simulator is, it's just

  • a simple series of infinite battles.

  • There are random Pokemon in the grass.

  • There