>> Hey friends, did you know that you can build
a highly scalable, geo-replicated,
intelligent application that uses all of the
latest and greatest microservices technologies,
and machine learning, and play with the silly mascots of
your favorite programming languages all at the same time?
Isaac is here to talk about building
everyone's favorite overly complicated game,
Rock-Paper-Scissors-Lizard-Spock,
as a Cloud-native application which you may recall from
my Keynote at Ignite 2019 today on Azure Friday.
[MUSIC]
>> Hey friends, I'm Scott Hanselman,
and it's Azure Friday.
I'm here with Isaac, and we're going to talk
to you about Rock-Paper-Scissors-Lizard-Spock.
It's massively multiplayer microservices.
It's a lot of fun, and it's interesting because it's got
a lot of languages in one application. How are you, sir?
>> I'm doing great. How are you Scott?
>> I'm living the dream, trying to learn more about microservices,
and I know that you have this great sample application that we
used at the Ignite 2019 Keynote.
Why is this different than
every other sample application out there?
>> That's right, Scott. We did do
a demo of this at Ignite in 2019.
One thing that we can call out is that, as we're developers,
sometimes you don't get to right software that does fun things.
So one of the things we want to do is we wanted to showcase
that you could do microservices,
and polyglot programming, and
do all these sorts of real cutting edge,
high-end developer things, and still have a solution.
At the end, it's actually fun to play.
So we built a game based off of
complicated version of a far less complicated game,
so Rock-Paper-Scissors-Lizard-Spock.
Basically what it is it's
a microservice that runs in Azure Kubernetes Service,
and it allows you to basically play against different bots.
>> Each path is a different language of the programming platform.
>> Yes, if you want. So I can share
my screen and actually show you what it looks like.
>> All right.
>> So if you go to rockpaperscissorslizardspock.dev or
if you want a shorthand that's aka.ms/rpsls-game,
this will take you right to the game.
As you can see here, if you log in,
you can actually play with a bot or against a friend.
In this situation, I'm going to click "Play with a Bot".
One of the things, if you remember,
is that I mentioned earlier that all of the different players or
opponents that you choose run in
different microservices as different programming languages.
So you have like this polyglot idea.
So I'm going to just choose ".NET",
and we'll talk about the architecture in a second.
So if you click "Select",
it gives me the opportunity to select a game.
So the rules for Rock-Paper-Scissors-Lizard-Spock,
it's everything is interdependent on each other,
and there's a huge little diagram about it.
I'm going to click "Rock" and click "Start Battle",
and what this actually does is it spins up a.NET service that
actually uses artificial intelligence
to determine a strategy to play.
So as you can see, it shows rock and I chose rock so it was a tie.
So if I click "Play Again" and let's do scissors,
hopefully we'll get a non-tie this time.
So.NET chooses rock, I choose scissors and I lose.
So it's one of those things,
where a strategy is being done.
It's just not picking some random character every time.
It's actually using artificial intelligence
to guess what you're doing.
>> Right. When I did this at Ignite,
I noticed that even though you can't
really get a pattern from two when I'd done
10 or 12 or more I was
finding and I was always doing paper after rock,
and then it figured that out
and then it was coming up with a strategy.
It was noticing patterns that regular people wouldn't notice.
>> That's right. One of
the things that I think is really important is if
we take a look at the code base which is in GitHub,
and the shorthand for that is aka.ms/rpsls without the dash game,
this will take you right to the GitHub Repository.
In here, we have a bunch of fun things.
We have a link your Keynote with you on stage,
some screens of the game,
and most importantly if you scroll down,
it shows you an architecture diagram.
>> Here we go.
>> Yeah. So as I mentioned earlier,
we have a lot of services
that are really sharing Azure Kubernetes Service.
So the website or the web app that you see upfront is
actually written in Server Side Blazor in.NET Core 3.1.
Then all of the opponents that you play against,
they're actually services that are inside of
Azure Kubernetes Service and they
are all written in different programming languages.
>> Interesting. So the web app is the game manager.
We've got state in Cosmos,
and then the different players are Kubernetes microservices,
and then the predictor,
it looks like it's a Python-Azure function.
So this is really using
all the latest Cloud-native
techniques to make sure that it scales,
and it did scale because we had a lot of people playing
this simultaneously at Ignite.
>> Yeah. One of the things that I think is really fun about
Rock-Paper-Scissors-Lizard-Spock is that it's not just fun,
but it also shows you how to build complex scenarios.
In the grand scheme of things like building
a game isn't very complex,
and at least the game that you see.
But when you look at the diagram,
you're seeing there's a lot of inter-working things.
Since this is using Azure Kubernetes Service,
we're using all different technologies.
Obviously, we're using Containers, and Kubernetes, Helm,
and all these other things that
a lot of enterprises and developers need to use.
>> Right. This is trivial because it's a fun game,
but it's not trivial because it
shows you how to go and deploy these things.
This is a real live running sample that you've got going,
and it's more than "Hello, World!".
If people want to actually bring this code down,
build it, they could use, for example,
Docker for Windows, setup Kubernetes on it,
and fire up all these Containers,
and run it all in their local
Kubernetes if they wanted to do that.
>> Yeah. One of the things that's
really cool to call out as well is
that in the theme of everything being open,
we have the code open as well
as the process that builds the code open.
So we're actually building and
deploying this to the live site using GitHub actions.
So as you can see here,
there's different GitHub workflows for
each individual piece and then for the entire thing.
If you take a look at one of these particular actions,
you can actually see all the different things that it does.
So for instance, I'm doing a Docker push,
and then a KOOB-cuttle contexts,
initiating Helm, and then finally installing the Helm Chart.
So you can see
all the different steps that are needed. It's very complex.
It's not just a right-click publish.
We're using full CICD.
So when people are doing merges into master,
things get pushed right out.
>> That's what's so cool about this also is that even
though we did this in November of 2019,
you put work into a demo like this,
you want to make sure it's real.
We don't fake anything,
and you do it legit.
You could have, I don't know,
hard-coded a bunch of stuff and made it pick
always rock and then right-click pushed,
but that's not interesting, that's not helpful,
that doesn't make it more fun for people to learn from.
With this, you're basically running a little company,
that is the Rock-Paper-Scissors-Lizard-Spock company.
We've got a game, we need to keep up 24/7,
and you can see that there were commits
just a couple of weeks ago.
It's being updated regularly.
Would you be interested in pull requests from
the community or can people get involved?
>> Please, that would be excellent.
So as you can see, there's a few issues.
So people are actually active taking a look at things,
but peers are always welcome.
We want everybody to take full advantage of this.
If you're seeing issues when you're trying
to set it up in your own Azure environment,
please let us know as well because
it's only going to make it better.
>> Fantastic. So the URLs
were aka.ms/rpsls, rockpaperscissorslizardspock,
or aka.ms/rockpaperscissorslizardspock-game.
Then of course, the vanity domain, kudos to you-all.
If you go to that first tab,
there was rockpaperscissorslizardspock.dev.
We can actually do massively multiplayer,
so you could sign in and play a friend if you wanted to.
>> Yeah, that's one of the great things too.
So let's just go back,
and that actually leads
into one of the things I want to show as well.
You can actually play with a friend.
So I could actually click "Play a Friend".
This will actually give you a URL.
I can send this over to anybody,
and then they can play with me at the same time.
>> All right. Actually, hang on. Let's try that real quick.
>> Yeah.
>> Send me a URL.
>> Yeah, no problem.
I'm just going to open this up,
and I hand this over to you.
>> Okay.
>> All right, sent.
So when this is actually opening up,
it'll actually detect when you join and
it'll go over and give you an update.
>> Hello, Scott, entering the game. So I've
seen an invite on my side.
>> Look at this.
Now, we're in. So I can pick a game, and I'm going to pick one.
>> I'm picking one, I'm not telling you what it
is. I'm going to destroy you.
>> Man.
>> What is it? Spock.
>> Spock.
>> Spock vaporizes rock.
That's what's so great about Rock-Paper-Scissors-Lizard-Spock
is that it's really complicated.
The combinatorics of it get really,
really crazy after a while.
So spock vaporizes rock with the phaser. Thank you very much.
>> Yeah. Well, congratulations on winning.
One of the other cool things that we're going to be doing
starting on April 24th is we're actually having a contest.
So if you see here on the top right,
there's actually a leaderboard.
What we want folks to do is every week,
we're going to actually be giving away
prizes for people to get to the top of the leaderboard.
When you say prizes.
>> Prizes, you say.
>> Isaac, what could those prizes be?
>> I don't know.
>> What if I told you we have stuffed animals?
>> That's real. That's not a render.
>> No. Well, if this was a render,
why would I have one in my hand?
>> Okay.
>> So my favorite is.NET.
So as you can see, I have some.
I have Node, and I have.NET,
and I have the other three.
So we're going to give people the opportunity
to get these awesome plush animals,
as well as some stickers,
and we're going to have opportunities for all sorts of fun stuff.
Also, what we're going to be doing
is we're going to be introducing
some themed
Rock-Paper-Scissors-Lizard-Spock content on Microsoft Learn
including a Blazor Module so folks are going to be
able to build Blazor as a part of
the Microsoft Learn module
that's themed in Rock-Paper-Scissors-Lizard-Spock.
>> Very, very cool.
Fantastic. Well, thank you so
much for spending time with me today.
I am learning all about
massively multiplayer or Rock-Paper-Scissors-Lizard-Spock
and scale in Azure with microservices today on Azure Friday.
[MUSIC]