#100DaysOfCode in Python Transcripts
Chapter: Days 97-99: Building JSON APIs
Lecture: Introducing our online game server

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Welcome to Day 97. Michael again here with you and we're going to bring a bunch of things together that we've previously done
0:09 and what I think is actually a really cool way of pushing and combining what you know. So we're going to build an online game.
0:18 And it's going to be a multiplayer game, not multi-interactive real time game, but multiple players from multiple places
0:24 log in and play this game online and you get things like high scores, who's won the most games, active players, things like that.
0:32 And what's really cool is you basically already know like 80% of what you need to do this. The final bit we're going to put together here
0:40 with a little bit of APIs and Flask. Online games are fun, right? Here's a cool one, Eve Online. This is actually powered by Python on the backend
0:51 in some really, really important ways and it's this MMO, massively multiplayer online game. And I actually interviewed the guys from Eve
1:00 over on Talk Python in Episode 52 if you want to learn about that. That's all pretty interesting. So we're going to build an online game.
1:07 Now, it's not as amazing as this, right? This is incredibly cool, taking hundreds of people working on it for a really long time.
1:13 But let's see what we have and how we can piece it together. So over here, on Days 13, 14, and 15, we talked about text games.
1:22 And the thing we actually built was a Dungeons & Dragons wizard game. Remember that? It was a long time ago, I know,
1:28 but that was one of the first things we built. It was really fun, we learned about classes and so on.
1:32 We also discussed this 15-way Rock Paper Scissors. And we've come back to this 15-way Rock Paper Scissors
1:40 several times so we're going to do that again today for the thing we're going to build together. You don't necessarily have to build that one.
1:47 Actually you probably won't build that one yourself but that's the one we're going to build together. What else do we have?
1:52 Well, we saw that we can consume structured APIs with Uplink, recall this? We actually went to our movie search service and created this Uplink client
2:01 to communicate with that and we're going to again use Uplink to build the client side, the playing the game side, the user side of this app.
2:10 Not the service side but consuming the service side stuff that we build. So Uplink's coming back, that'll be fun.
2:15 On Day 76, Julian told us all about Flask and how simple and easy it is to get started. We're going to take our Flask knowledge
2:23 and use Flask as the web framework for hosting our application that is our game server. It has the various operations that we need to use
2:32 in order to make our client applications run. Finally and really, really importantly, we have databases. In order to scale out our server,
2:44 make it survive reboots and all sorts of stuff, we need to save our data and have data integrity across the various requests and executions
2:54 of our web server. So we're going to use SQLAlchemy. In fact we're going to use already the exact same model that we already added here.
3:01 So over in our demo recall we built our persistent Rock Paper Scissors. So we're going to take our persistent Rock Paper Scissors
3:08 and convert it to a server side version and use the database to keep that information going back and forth and then we're going to write
3:15 a little client to use it, that way everybody plays on the same server, we have all the shared data
3:20 about who's played what, what were the history high scores, things like that. I hope you see that we have all the pieces
3:27 with the exception of building just the API methods which turn out to be pretty simple in Flask if you're not trying to do too much.
3:34 It's going to be an ambitious 3 days but we can do it and it's going to be super rewarding. So let's get started.

Talk Python's Mastodon Michael Kennedy's Mastodon