Building Games with Service Fabric

Building Games with Service Fabric


[MUSIC]>>Welcome everyone to another
episode of cloudcover show. In this episode we have
Mark Fussell and Haishi Bai from the Azure team to talk to us
about building games on Azure. Which is quite exciting. Why don’t you guys
introduce yourselves and tell us a little bit
more about what you do.>>Okay, Mark Fussell, and I’m a program manager that
works Azure Service Fabric.>>I’m Haishi,
I’m a developer at Azure. I do some stuff.>>[LAUGH] Great. And you’ll probably recognize
Haishi from before. He used to be one of
the hosts here for the show. But today we’re
interviewing him. And we also have Etienne and
myself on Chago. We’re both here
from the Exec Corp. And we’re running this
episodes today as hosts and asking a few questions. All right, why don’t you guys
talk us through what you wanna present today and
we’ll get started?>>Okay, great, well this is a recreation of
a talk we did last month at GDC. Where we talked about building
games on Service Fabric. And we’re pretty excited because
we see a number of companies doing this. Just a bit of recap of
what Service Fabric is, we talk about it as being
a micro services platform. We build applications
that consist of small pieces of code
that you deploy. It does everything from
the development side all the way through to the up
side of things. We like to talk about how it
runs on any OS and any cloud. It runs on a laptop. We host as a service in Azure,
and you can run that on premise. And then we have Windows and
Linux versions of it.>>Great.>>And
then when you build your apps, we have various different
ways you can use prem-emuls. We provide out-of-the-box, as part of our runtime,
reliable services. And reliable actors that allow
you to be very productive about building scaled
out applications. But you can also build
web applications, we host SP.Net Core, OWIN, and
other web apps on top of us. And then of course, you can
bring along any piece of code that you’d like whether
it’s a Guest Executable. And last year we also introduced
the fact that you can launch in host containers. So this is Service Fabric as
a distributor’s systems platform for building micro services. And a good thing to do is, we should drive
straight into a demo. On this gaming side of things. And a demo, we’re gonna
show reliable actors and what you can do with this. Because it’s kind of a very
intuitive framework to use. And of course,
what’s the Hello World of games? It’s->>Tic-Tac-Toe.>>Tic-Tac-Toe, yes.>>Tic-Tac-Toe, all right. [LAUGH]
>>So let me switch over to
Visual Studio here. So what I’ve got here is
I’ve got an application I’ve built using the active
programming model. And the first thing I built
was an actor player type. And the actor is very simple. It can join a game, or
it can make a move. And this is defined as one
of the actors inside here.>>So that’s a Service Fabric
actor model?>>Correct, yes, and the actor
model is very interesting. Because you have these discrete
pieces of instances that have their data and
functions combined. And you can make them
reliable and persistent. And that’s what you really
show in the next one, this is Game Actor now. And inside here, I can join
a game, I can make a move, and I can see the state of who
the winner is inside the game. So this is another
actor I’ve defined. So I have this player, and
I have this game actor. When you look at
the implementation of the game actor. This is kind of
interesting because here, you see that it’s
a persistent actor. Which means all the state
this is associated with is made reliable and replicated. And you can see the state here that we make as
part of this game. So this is the game board. Do you have a winner? Here’s a list of players. And this is part of this
particular game actor.>>And then, we simply implement
the methods for this actor. If I scroll down here, you’ll see that I’ve got
the JoinGame method. It takes the player name and
a player ID, and it checks that two players have
joined this particular game. And if it does,
it adds them into that state. So that the game logic is
very simple to implement with this actor. I’ve got the game board here. The state, the winner,
that gets returned. And of course, this is all the logic here of
making an individual move.>>So one thing I want to point
as is in the JoinGame method, scroll up? So you can see here the code,
they’re just testing if the player count is two, and
there’s no log in required. Because there’s turned based
[CROSSTALK] on Azure, so it don’t need to use those
concurrency logs and the critical sessions. It just read the code as if
it’s a single threaded code.>>And in fact, that’s illustrated when
you actually go and look at the client itself. So when you use this from the
client, you see here I create one player,
I create another player actor. I keep the game actor here. Both players call JoinGame. And then after that, we just check that they’re
both joined down here. And then here’s
the interesting thing, the players just make moves. They just play, play, play, so they’re playing
as fast as they can. Meanwhile, the game is checking
and running in this loop here to see who’s the winner of
a particular game and drawing the game board. So, this turn based concurrency
is controlled for you, so that players make
individual turns. And you can write very stable, safe code that doesn’t have
threading issues inside at all.>>Yeah, and so both players,
they are trying to cheat. They are trying to make moves
as quickly as possible without waiting for their turns. But the game actors is
keeping them in line.>>Yeah, right, okay. So this all gets deployed as a, I think I have this running
here as my service. Here it is, is my actor game
service here and my players. And what I can do now is what
we’ve gone and done, of course, is we’ve made this
highly available. We can launch many of them, so
I can launch ten instances. Before I do that, let me just
minimize my desktop, and then go back to this. [LAUGH] And if I launch
ten instances of this, I’m gonna launch ten
concurrent games. And there are all
the tic-tac-toes playing a game. And they’re all playing
here at the same time. And wow, this is just
a multi-instance multiplayer turn-based games you’re playing.>>The first
tic-tac-toe MMO ever.>>[LAUGH] Yes, that’s right.>>Fantastic.>>For an intro to that,
this is pretty cool. Is the code available online?>>Yes, yes, there’s a link
at the end of this session. It’s actually on my private
GitHub account at the moment. But originally it was your code
from your book, wasn’t it? So it’s in a couple of places.>>Yeah.
>>I’ve got a link at the end of this session.>>Like a web link?>>Yes.
>>That’s awesome.>>So let me,
let me kill this now. Let me kill all these sessions. Kill, and let me kill
this session here, and let’s go back to the slides. So that was Reliable Actors. And it’s a great little intro
on how to use Service Fabric and one of its program models. And effectively, we have
a number of different companies who’ve been using Service Fabric
to build games on top of us. A couple I wanna talk about
today, Illyriad Games and Fun Rock. Let’s talk about
Illyriad Games first. So they’re a game company that
we actually featured at the last year at Build and
we showed them as a demo. And they have
a multi-player game. In fact, I have an instance
of that game running here. I have a cluster here that
you can see that’s deployed. And you can see inside this
cluster that they have eight different applications
get deployed. And each one of those
applications does a variety of different things in terms
of managing accounts or managing space or doing AI intelligence of the
actual spaceships themselves. And I can actually go and
launch and go into a new browser view here. And launch and attach to this back-end
game that’s running here. I can log on as a name here. I can log in as Mark. And when I log on, you’ll see
now I’ve launched into this game here inside space, and
I am flying around. And here I can control, and I can do some
shooting inside here. And you see it’s a very
responsive game, lots of beautiful graphics. And I can see that I can
change my speed and angle. And all of this basically
allows you to have a very multiplayer MMO game
with lots of low latency. Because all of the state is
managed from Service Fabric and made highly available. So it’s a great little,
fun game.>>And in the previous sample,
the code was in C#? So I assume it also works in
JavaScript because here it’s, how does it work? Is the JavaScript code using
Service Fabric dynamically or?>>Well, there’s back-end hosted
games that use signal all to connect to the back-end. And then yes, and then they have
a web-based UI that does all the rendering through WebGL and JavaScript to be able to
create the front-end of this. So yes, this all gets pulled
from the back-end and renders inside your browser. So you can run it on any device.>>So from the front-end,
it talks to the back-end that’s running on Service Fabric
via SignalR and?>>Correct, yes, and they
create a web socket gateway and made it very responsive,
like this. And it runs on ASP.net core and through that Kestrel
engine as well. Which is a very high throughput,
low latency hosted web service. Yeah, so Ben Anderson and his crew there did a fantastic
piece of work on this.>>Very cool.>>This is very cool,
this game is. Let me just kill out of this. So that’s Age of Ascent, and
there’s a lot more things you can see online in terms of
videos that we posted and articles there. The other company we worked with
was a company called Fun Rock.>>Right.>>And
they’re a much smaller company, they’re based out of
Stockholm in Sweden. And they launched a game last
year called, Heroes United. And it’s a game that
they launched actually in the Middle East markets. What the type of game is here,
I have a little video from them. Which if I launch is one of
these godlike games where you’re in the desert here. And you build a world, and there
are other players inside it all. And you battle it out with
other players and, effectively, can grab resources
from other people. And as you can see, it’s focused
on the Middle East [LAUGH]. Cuz that says Heroes United. So that was what they did. And they had a number of main
goals that they wanted to do, particularly they wanted
us start small cuz, they’re a small company and
grow over time. Had to create a very scalable
gain with a low latency, rolling out new changes was
very important to them cuz, they wanted a new updates, and
have multiple game worlds. They’re gonna launch it
inside the US and of course, inside the US they wanna have
a different type of world and what it all looks like. So, they’ve discovered that
they started to build on Service Fabric for this back end
solution, and the way they did it was quite similar in the way
that El Real Games did, they had a set of core games
services with the logic. It made some reliable
services that were reusable. And then they had some admin
services in total they had you know 17 different reliable
services and the type of things that they put together to build
this sort of lap that they run. They are called Heroes United. And what they found was Service
Fabric was great because, what they found typically is they had
to spend a lot of time building their own gaming
platform themselves. They had to build all the
concept, and the reliability and scale and fail over and
roll outs, and all that was given to
them by Service Fabric. So as a small company they could
start small and grow over time. But, we’ve also seen Service
Fabric that can be used on larger scale games as well,
so for them, the challenge was thinking
about micro services. Their prototype was sort of
a classic three tier app, where they had a database,
and they had the middle tier, and it was a lot more how
it to evolve over time.>>Is that something you’re
saying now as we’re talking to game companies that they’re
moving to micro services and actor based implementation.>>Well, we’re certainly seeing
that they’re moving towards a micro-services
approach because, it allows them to become much
more agile because they can do changes to their code
more frequently. And also it helps with their
componentization of how they can reuse things. Or they found that there were
common challenges between what they had built and what they had seen in
the rest of the industry. And they wanted to share
some of that code and some of the experiences
with the community. One thing were said are fairly
obsessed with inside service fabric is building gateways, and I’ll get to what you said in
a moment, and these gateways are how you effectively
communicate with your back end. In the case of both these games, they’ve built a signal R front
end gateway that allows you to have a web socket
connection to the back end, and maintain that state, and
have those request-responses. But when we use Service Fabric,
there are many other ways that we use it,
with API management and IOT hub. But what Fabric gone and done
is they’ve taken their front end gateway and
all of the code around that and released it as an open
source free work.>>Yeah great sweet.>>They call that
Game Framework. Yes, so Game Fabric.>>Game Fabric [LAUGH]
>>We thought this was a fun thing to be able to call it. GameFabric this is the GitHub
URL that you can go to and get all this code. And it allows you,
as a gaming company, as a kick start,
effectively to have a well tested performance
SignalR gateway, where you can create a number of back end
services to help you get going. So what it provides,
is a SignalR gateway. Runs on top of Service Fabric,
and helps you not have to write
all of this code yourself. What it looks like is what it
gives you is a gateway component and it gives you the concept of
registering a user on a user and imagining a session, and then some helpful classes
to be logging statistics. And the way you think about
using this is that you write these things that
they call processes. Well, it’s a very
common design pattern. Your request comes in,
you plug in the processes for a particular type of action so,
whether that’s shoot a bullet or move a car or whatever
action that’s happening. So what’s effectively happening
is you’re having connections open to a session and then the
processes are routing those very efficient need to where
the systems running. So what we did was
we took a very, well known game inside
Unity called Tanks.>>Yeah.>>Do you know this game?>>Yeah, I’ve seen it before.>>You’re both on
the same laptop. One of you have this side and
the other has this side. You move a tank on
the same laptop.>>You can kick
the other player.>>Yeah, you can kick the other
player, that’s right. But you’re both on
the same laptop. And we said why don’t we take
this two player game on a single laptop and
make it a network version. So that way your multiple
players can run and use that as a sample that is
also published to this GitHub account so, that you can see how
a Unity game works through this open source gateway in
order to run Tanks. And so effectively we added
Tank, TankGameSession, and TankGameSessionList, as
the additional services that run inside here into our project
that you can download and use. So those blue boxes there
are the additional ones, the code that you write. And then to use it,
it’s actually two clients I can take this service like you
saw with the agent syntax and hosted it inside Azure. On top of service
Fabric to clans can talk through the Azure load
balancer, talk through the SignalR gateway that does
all the correct routing. It took your tank game
session and both of those, it forged the turns and the
actions that you make between the different on players running
on two different machines. And then back to the clients, back out through
the Azure load balancer. So, we try to make this as
responsive as you can, anyway in SignalR an opening up you
know great way of doing that. So let me give you a little
demo of what that looks like. So first you know this project
you know this is Unity, if you and
look at the Unity project. That they have you know all
of the assets inside here. We added a number of
different signal clients in order to
communicate with this. And then we went and
created a cluster. It’s this one, sorry this
one here this cluster. And inside here we deployed
the gateway service. This is the gateway
service running. We deployed these backend,
sort of, helping services that do
some logging and statistics.>>Storage, yep.>>Storage and
things like this, yes. And then, the very specific
one is that we built the additional tank games here. That allow you to manage
the tank sessions between the two players.>>Cool.
>>So, it was fairly just a small
amount of code that I had to adapt in order to achieve this, and this is running on a cluster
actually hosted inside Azure. So what I’m gonna do now, is
I’m gonna just switch over and I’m going to launch two clients. I had to pre-built
it already because, Unity is nicer to run
them as a pre-built app. So I’m gonna launch
this one app here. And then I’m going to
launch another one here. That be, and here they are,
both running. And so what happens is you see Imagine these are both running
on two different machines. This one is on one
machine on the left. You see I see my
tank is green here. And this is the machine on
the right, this is my tank and my green here. And so in this one here,
you see that I’m moving just about see this one here,
I’m moving my little tank here. And of course you see it moving
in the other persons window.>>Yeah, cool.
>>And the latency isn’t too bad. Over wireless, these are actual clusters
hosted actually in Europe. So the is going
through wireless, it’s going all
the way to Europe, it’s coming all the way
back again, and this is me driving
my little tank. If I go to the other control
over here, can I switch? Yeah, I can switch
the window yes. If I go over here, you can see that this is me
driving my other tank over here. And I can shoot shells and if
I can do any form of shooting, let me get a bit closer,
I can shoot this guy here. And maybe I might win a round.>>Are you losing
against yourself?>>[LAUGH] Yeah,
I’m losing against myself. [LAUGH]
>>[CROSSTALK]>>And then it starts another round.>>So
this is available on get hub?>>Correct, yes.>>And how easy is it to
try it and set it up?>>If I want to try that
myself and deploy everything?>>Yes, well you can
go to this GitHub here called Stockholm Tech
Angels Game Fabric. You’ll see that there
are two things here. There is this. This is the framework that we
provide, just a roll framework. If you then look underneath
If you didn’t look underneath the sample folder inside here,
there is this tanks game.>>Yeah.
>>So inside this sample folder here,
>>Right, right.>>We provide both the Unity
game, as well as the game fabric with the tank sessions
added to it [CROSSTALK]>>Okay, cool.>>So you literally just
have to download this.>>We’re gonna post a few
more instructions on this, run it through
the Service Fabric application, load up the Unity
project into Unity. And then, you can then connect
onto your local machine, and run it there, actually.>>Cool.
>>Just with changing a URL to your local machine,
and that way, have this all up and running.>>Ooh.
>>It’s fabulous.>>Yeah, that’s great, too,
with the service fabric. That you can run on
your computer, so you can run the whole thing
locally first, and then.>>Correct.
>>And then apply it to Azure.>>Yes.
>>Nice.>>So one of the beauties, yes, I can have a cluster running
on my local machine. In fact, if you go back and
look at the, if I go back and look at the tic-tac-toe example
that we looked at earlier here, you see this was
running on local.>>All right, yeah.>>Half state.
So I run that locally, but you see the Hillary
add games one here and this tank game here are running
inside remote clusters.>>It’s real easy to try it.>>So
it’s real easy to try, yes. So I encourage you
to try this out. So that’s what I have which
was super exciting stuff. How do I follow that?>>[LAUGH]
>>Well okay yeah I have some great stuff as well. So basically what Mark told
you is about how to use to write new games on
the framework to write games. What I’m going to talk about
three different cases about other things related to games. The first product I’m gonna talk
about is the Xbox Ambassador So when you host at RoboGames, it takes a lot more just
to host the game itself. They need to do a lot
of management work, like managing the users, do
the statistics, fraud detection, all those things. And fortunately,
Sourcefabric is also great for writing those systems. So what the XBOX team did,
is they took Sourcefabric and designed this
Ambassador program. Which is committee
support program basically everybody can
sign up as ambassador and you can help your peer players
by answering their questions. First I’m going to
show you a demo, I’m going to switch
to [CROSSTALK]. Machine. So you can see to the left, I’m logged in as myself,
a proud ambassador. And to the right I have
an in private browser. I’m going to log in
as a different user, this is a test user. [email protected] There you have an e
after Outlook, yeah.>>Just an expression of-.>>I can’t use this keyboard
because there’s a touchpad in the middle.>>[LAUGH]
>>If I can remember my password correctly Hopefully it works,
all right. So that’s all the demo. Logging in. So I’m a player, I have some
problems, I can go to the master program, they can just
start to ask questions. Let’s see I have
a question with Xbox One.>>How do I log in? So here I’m just asking
a question then to the left there’s a community of
ambassadors waiting for questions. And once the question surfaces
it will be showed up on my bank. I can choose to take
the question and start engage with the customer. You can see here I
have the question. I click on this guide. I click it. I’m going to take this question. And so it’s a way to handle
a community and answer issues. [SOUND. I am going to share my name tag, game tag Now we can
start to check, right?>>Let’s see. Just look at your Konect. And, let’s see. But my Konect is still in box.>>Open it. [LAUGH]
>>[LAUGH] Open it. So proud of myself. That’s perfect.>>Sweet.>>So that’s the program, now I’m going to switch back
to the machine to show you the architecture how
it is when it’s down. I’m back. So now, this is still
a relatively new project, they are hosting about 2,000
to 4,000 customers daily, and there are about 14,000 to
30,000 messages per day. And everything is supported
by 5 milliclusters. So these five milliclusters
serving the global community of XBOX Ambassadors. And what’s interesting about
the ease of development using service fabric You even
see some data from here. Basically from the conception to
delivery ,this project is framed up[ with very few developers. And if you look at the last
number throughout the lifetime of the project they found
zero concurrency bots. I mean Microsoft has pretty
amazing developers but director always make [LAUGH]
>>Bugs, but they found zero coccurrency bugs
because this actor model did the turn based currency,
make the programming of this really distributed
system really easy.>>So what does the architecture
look behind the scenes?>>Yeah, we’ll show that That’s the cluster just
to show you this is true. But I am not going
to jump back there. So this organizer
is quite simple and a couple of things that I want
to point out, first is that you can see everything is
microservices based. There’s no centralized
coordinator dispatcher or manager. Which you already introduced
a single point of failure. You can see everything
is scattered by itself. To the left you can have one or
many collectors, different type of collectors, collecting
messages from Twitter, from chat, from whatever
sources you can collect. Then everything is pumped
into this command task. Missions are based on
the Microsoft human box which is highly available
by itself and to the right you can plug in any
type of processors as you wish. And they are linked to different
ambassadors on the fly. So, you have this
one to one sessions. So it’s a really scalable
architecture and you can see We can,
it’s open as well. So we can plug in new collectors
and new processors at any time. And if we need to
scale this out, we can just launch
small processors. Then we can access.
>>This is a very common design pattern where you have lots of
different types of messaging, and then they normalize
them into a message type. And then you can forward those
to wherever you wanna go.>>Yeah, exactly, yeah. and so these three, or maybe more, they’re running
inside the five cluster?>>Yeah. Everything is on
the same cluster.>>Cool. And this is to zoom out a little
bit to see actually such a system just
the chatting experiments. Actually the whole system
is much bigger than this. So in the same matters of
design you are actually leverage other address services. And you can just stitch
them together into a complete solution. You can see here at the core we
have the Ambassador Services working in Service Fabric,
but it’s leveraging all kinds of address services,
like Power BI for nurses. I think there’s a machine
learning pipeline. I forgot to put it on.>>Or BI pipeline?>>That’s the BI pipeline, but
>>It’s also using the Document DB as storage so you can see basically you
have the whole ecosystem of address services that you can
link to the source fabric.>>That’s a very common design
where you have a processing RAM service outbreak and
then you offload analytics into Doc DB for all
of the analytics around the doc.>>Yeah. And so
that was the ambassador program. Now we’re going back
to the gaming stuff. So like I mentioned, Marvel is
talking about writing new games. Now I’m talking about to host
legacy games, where you already have a game title we need
to host on the cloud. You want to make it available. Now, how do you do that?>>Like tic-tac-toe? It’s a little more
complicated than that. So there are a few challenges
and we tried to take those licensed games and
put it on Cloud, right? Most of the games,
they are designed for the local network and
not really designed for the latency you can
experience over the Internet. And they are URL license based,
your box title, you’re installing on Xbox or
whatever console. But you’re already on the cloud. You wanna have this
subscription based usage. You wanna have a meter usage. And you want in-game sales,
all different things. Also, virtual management,
you can’t just buy a new game. You have to roll out your new
game versions on the server so it’s available to
other game players. And the last for that list, the
anti-piracy is a true concern.>>Yeah.
>>Actually, we will talk about that
more in the moment. So to talk about this scenario, I’m going to introduce this
scenario from Tencent. Which is one of the largest online gaming history
on the world. They are actually, they’re
hosting hundreds of titles and intensive data
centers across China. And they have frequent releases
and updates on those titles. You can imagine,
that’s hundreds of titles times tens of data centers ten
times daily updates. You can imagine how many
updates they need to do on a daily basis. So this is a big management
problem for them and at the same time they have to
do this without interrupting tens of millions of
concurrent users. That’s not a typo by the way. It’s literally tens of
millions of concurrent users on their system. And they also have this
great concern about privacy and cheats. A lot of people are trying to
cheat because nowadays we can actually make good money-
>>Make money [LAUGH].>>By playing games, so they
want the full plans to try and stop that. And these titles they’re both
new titles that they are writing and also the legacy
ones that you may.>>Actually most of the titles
they have are from a third party, so they are taking
the existing titles and host it on cloud and that’s one
of the major challenges they have Because they don’t have
access to the source code they can not make
any modifications.>>Right.
>>They have to take the game as it is and try to host it
efficiently on the Cloud. So to illustrate the solution
I’m going to use Minecraft. As a simpler sample. So basically,
with Service Fabric we have this programming model you can
write actors, you can write pr read Apple services
using C# on Service Fabric. But we also have container
administration on Service Fabric, there’s a container
administration as well. You can host Docker containers
on Service Fabric and it provides load balancing,
failover, all this wonderful stuff for
you. So in this particular example
I’m going to show you, I’m deploying a Minecraft Server
on a five-node cluster. And the cluster is configured
behind a load balancer, so the client can
access the server. But what happens if one of
the node fiails, the container, the Minecraft server will be
relocated to a different node and your game client can still
access to that game instance. I think for that it’s
easier to see with a demo. I’m going to switch
back to my machine. Yeah, okay, back to my machine. So I’m going to launch
the Minecraft client here. And this is launching, I’m going
to show you the cluster, so basically, this is a Service
Fabric cluster, you’re gonna see how this Minecraft server
in the middle point. [MUSIC] Too dramatic.>>Yes, yes.>>So, I have this
Minecraft server deployed, you can see you have
instance running on the application host 3,
that’s one of the node. So I’m going back to my client, switch on the multiplayer
using direct connect. You can see here, I’m
connecting to this SF-Linux9. So central Cloud APP header,
which is this cluster.>>Is a Service Fabric
running on Linux now?>>Yes, yes,
I forgot to mention that. So I’m going to
join this server. You can see here.>>Have you created
an interesting world?>>No, I haven’t this time,
>>And it’s the night.>>There’s no light-
>>[LAUGH]>>But I’m not going to fix that. So, I’m going to PuTTY, I’m going to connect to
one of the machines. Which host is that? That’s host 3, so I need to connect
to the right port. I’m doing so many commands.>>Yes.>>Where’s my SSH command? And it will come up, I’m sure. Okay, there. So 89 is the first one,
90 is the second one, so the 91 will be the third one,
92 would be.>>3, Yes. That’s the default port you get.>>So now I’m on the instance,
I can do a sudo docker ps. You can see that actually
this is my Minecraft server, it launched about an hour ago. And I can do a sudo docker run
-i no, the x, you see that? That’s right.>>So you launch that container?>>Yeah, I’m going to I’m. Jeez, I’m will connect
with the container and I launched the client. I’m going to do a time set 8000, I think that would
change it to morning. You can see, yeah.>>[CROSSTALK]
>>I’m sure on this server, I can’t do all this stuff. So now I’m happy,
they play in the game. I’m going to do something bad.>>So.>>Yes?>>Just to understand.>>That’s Service Fabric
with the five nodes, they’re running Linux. You SSH into one of those nodes,
node 3.>>Yeah.
>>And then connected to the computer
that’s running inside of that node?>>Yeah.
>>And then run that command to change the time of
the Minecraft server?>>Yeah.
It’s like Inception there’s multiple layers.>>Minecraft is only
running on one node? This specific node?>>Yes. What I actually wanted to show
you, let me do this first. So my game is running, right. The game client is
still running here. I’m going to go to my host, that’s the single instance,
right. So I’m going to shut
down the single instance, that’s really bad.>>Wiget, did you to type a lot
in order to shut it down, right?>>[LAUGH]
>>Don’t try to do that at home. So now the node is
being deactivated and you can see the instance
is gone at the moment. And in the moment you can see
a new container will be launched in a different host. So this should take
just a few seconds.>>Is it by default
compartment like the or do you have to set up somethings
specifically to have this like.>>No, this will automatic
behavior, basically, I’m specifying my application
needs one instance running.>>Mm-hm.
>>So Service Fabric, we’ll make sure I will always
have one instance running.>>All right, cool.
>>You can see now the server has been migrated to
a different host. I’m still in a game, I’m still happily playing
Minecraft, so the one important thing to note is that
I didn’t change anything, right. This is a public
Minecraft server image I got from Docker Hub. So if I do gdc, okay If I do, when you find an. Minecraft. If we look at
the service manifest, you can see that’s the Docker
image name, right? This is not my private image
that did nothing to the image. I just set up some variables
to the image that just launch it and
manage to pass your server.>>And here you’re looking at
the Service Fabric manifest that describes how to launch
containers inside there. So the great thing about Service
Fabric is you can launch just in executable, or a container, or you can build new code and
launch it that way as well. So what I think is very
interesting is that you can take existing code and
just move to service fabric, but you get all the benefits of
failover, reliability, and management and roll out,
it’s mostly around that. Or you can do what I
was doing earlier, and you can build new code, and then
take advantage of that and then, you can mix and match the two. I think it’s great that
you can existing code and just take that first step.>>So what happens there during
the failover from what you had in node 3 the other
node that it moved over to. Does it only tear it down after
the other one is running, and then does the failover to it or.>>Well, make sure. I mean,
you basically shut down safely. There’s actually a little bit
of short time out that you can configure. Make sure that it
safely shut down and we make sure that that is gone
before we launch a new one. So you can guarantee, one of the
things that Service Fabric does is you can guarantee through
us called leader election. That there is one and only one of anything running
if you were to have that. If you wannna have five running,
and only five running, you can specify that.>>Right.
>>So sometimes, a lot of these system,
you may have two running. This one is still there,
and this one’s launching, and you’re not too
sure when it’s come up. But Service Fabric provides guarantees around
leader-election process.>>Right.
>>That things are not running>>And in this case you actually had a, when you shut that down,
you can actually configure the time it detects when
you launch it as well.>>Yeah, and another feature I’m using,
this is a new feature coming out that you can actually attach
data volumes to your containers. So in this case, my work file
is actually on the data volume based on either files. So although the container itself
is destroyed my word data is still safe on the file. Then when the new container
comes up it can just pickup the same stage.>>So that’s why, after the failover it just
continued to run as normal.>>The same work, okay, yeah.>>Awesome.>>Can we switch
back to the slice.>>I feel all calm
with Minecraft music.>>Yeah.
[LAUGH]>>It’s relaxing.>>Right, we’re back. So basically I showed you
the concept how to take a Lexia application and continue rise it
and host it on Service Fabric. And what Tencent did, they were
trying to do the same concept, but they are pushing
this one step further. So remember, I was talking
about the piracy concerns, other cheating concerns. So in the traditional deployment
they have the game server in the center and then you have
the game client on the client machines, whatever PC consoles. And what it did was to move
everything under the server, and basically, have a new client
player that installed on the actual client machine. And what the client player does
is to stream the keyboard, the mouse event to
the server client and then stream the direct apps
instructions back to the client. So in this way they have
a really thin clients against on the machine, so there’s a really
lower chance of piracy and cheat in this case.>>And in this case the
rendering is still everything.>>Yeah, the rendering is
still done on the client. They are just streaming
the direct apps, the instructions
back to the client.>>It’s more like can I do this? Yes, kind of communication or
can I go up or is it checking the commands
on the server?>>So basically, you can think of the client
player just as a remote console. It’s a remote consoling into
the actual game client, running on a server. So all the keyboard events
are actually handled by the game client on a server,-
>>Got it.>>And all the commands
are streamed back and then rendered on
a client player. And you’re also using
Service Fabric to have this Tenant Manager. So basically here
you can see another pattern of a very large scale
deployment where you have a dedicated control plane
that manages your work loads. And then you have one or many computer planes where you
can actually host the workload.>>Just a quick question, the
game client to client player, is it a one to one instance?>>Yeah,
that’s one to one instance.>>Do they just instantiate
a new instance on Service Fabric for each client player?>>Yeah.
>>Cool. And you can scale out this,
there’s server and the client horizontally. And for that, I will just
show you a quick demo.>>Switch back to your machine.>>Yes. It’s there, right?>>Actually this is a video
of this system in play. Actually there’s
two music playing. But you can see actually they’ve
got fairly good frame rate, it’s 30 frame per second. It’s not great, it’s not
60 frame per second, but you can see from
the experience it’s okay. And they are deploying this on
many data centers in China. So that’s another benefit
of Service Fabric, right. You can run Service Fabric
locally, you can run it on Azure and you can also run it on
any data centers you like. And in their case.>>They’re running it
on their data center.>>Yeah, in their case they
wanted to minimize the latency rates so they have to host in
their local data centers major cities in China provides
low latency to the players.>>In fact, we have a lot of customers
who take Service Fabric and run it in their
data centers today. Because they might have
compliance requirements and things like that more
restrictive and then, well in this case the have
latency requirements. But it allows them
to take that and host it in Azure at a later date
so that migration can happen.>>Let’s go back to the slide, I think I am done with
all my demos as well.>>Yes.
>>[CROSSTALK]>>I think you’re done with the demo. As in.>>Yes I’m done.
>>This was a bit of a wrapper.>>It’s awesome.>>We have this little Service Fabric video
which I say is always great to watch cuz it helps explain
Service Fabric to your mother. [LAUGH] And you can play it on, it tells you what a microservice
is and the environment, so it’s out there,
aka.ms/ServiceFabricVideo.>>We’ll make sure to add
those to the links below the show as well.>>Yes, and then these are some just great
links that we summarize in terms of where to find that game
framework and download that, the Tic-Tac-Toe sample there
we looked at in the beginning. And it’s generally
the SDK in the docks, and we love questions all the time,
and stack overflow, and GitHub
issues are the two places that we love to hear feedback
from on things like this. So that’s a set of resources
about what we’ve seen today and things.>>Awesome.>>And you’re on Twitter,
I know, Hashi.>>Yes.
>>What’s your alias? HaiShiBai2010 I think it is,
yes, [LAUGH]>>I’m not sure that mine is [email protected] Twitter.>>Great.>>I then we have
AzureServiceFabric.>>Yeah,
that’s an important one. [LAUGH]
>>That’s another one we send a lot of tweets about
like this recording.>>Cool.>>All right, thank you guys
very much, this was awesome. I didn’t know that there were so many games running on top
of Azure Service Fabric, so I’ll need to check
out these links. And to everyone at home, thanks
for joining us, thanks again for the questions. And we’ll see you next time.>>Thank you.
>>Thanks.>>Bye.
[MUSIC]

Leave a Reply

Your email address will not be published. Required fields are marked *