[MUSIC]
>>Okay! We are here on day 2 of
our super casual game jam where we are making a game in two days,
and we just finished implementing authentication using PlayFab.
We're going to first demo the game,
and then we're going to go through
the code to explain how we did it.
Let's take a look.
Here is the login page.
We have a Create Account.
You can play as a guest.
You could switch to a login if you have an account.
Let's create an account,
username, e-mail address, and password.
It doesn't look like much from this end of things,
but we are now logged in,
and we can go ahead and play the game under this account.
This enables us to do a few things.
Like we could show up the username
that we picked on a leaderboard,
we can log into this game from multiple different devices.
If I wanted to have this on my computer
and play here and then go somewhere on my phone,
I could basically just open the app and
start playing the same game that I left off.
Another thing that we can do is use Unity's saving system.
Once we create an account or log in,
we can just keep ourselves
logged in so we don't have to log in every time,
and the save will basically persist wherever we are.
Not much has been done to the game other than that,
but we do have PlayFab working,
so let's go over how we did that and then
we can look at the rest of it.
Here is the PlayFab script that we're using.
PlayFab was installed yesterday into Unity,
and in order to use it in our script,
we have the namespace using
PlayFab and using PlayFab client models.
I've serialized some text fields.
Let me show exactly what those are linking up to.
I have an input on our title screen here.
I'm going to close this overlay.
On the input here,
this is not the placeholder but
the actual text that you start typing
in when you're inputting something in the field.
This is what we want to
get because that's what you're going to type
here and that's what's going to be fed into our script here.
We have our sign up name,
we have our sign up e-mail,
our sign up password,
and then I have one for login e-mail and login password.
Then I also have this here for creating the account and
logging in and these buttons are all linked up to this code,
but the one in login to switch
back to create account didn't work.
Let's do that now,
switch to create account and that should fix that issue we saw.
That's how this is set up.
We have those, we input them in
our inspector over here on our script.
Once we've attached it to this part of the project, sign up name.
As you can see here, it correlates to
those text fields or not the field
but the actual text within the input field,
and then we have just these game objects
which are like panels that show these fields.
I switch between them if you're logging in versus signing up.
Once I click the button,
"Log In" or "Create Account".
The first time I did it created an account, it didn't do anything.
I press the button again and got an error that
account already exists because I created the account,
but nothing showed up to the user
and I was allowed to click it again with all the same stuff.
Instead, we now have once you click a button,
you can't click it again because it should
take you to the next thing as long as everything works out.
Here we have title controls.
Our other script, where we start
the game happening, once we've logged in.
On register, we have via register request,
new register, PlayFab user request.
This is where we put in the e-mail from
the text that we have up here,
sign up e-mail text, password.
We have sign up password.text and the username sign up name.text.
From there, we can use PlayFab client API,
register PlayFab user,
and then we have register user request.
If it's successful, we go over here
in my console we'll say that was
successful and we have
the failed output which we'll just say failed.
Once we want to make this a little bit more user friendly,
we can give the player information on why it failed.
I'm also going to want to make sure that we can click the button
again if our sign up or login fail.
We have to fix that in a minute and implement
some feedback to the player if they didn't
have a proper e-mail address or
if they have too short of a username,
anything like that, we want to give
that information back to the player.
Similarly here we have a login with
e-mail address request and then we can put the login,
e-mail text and the login
password text and then with those we can get the request.
Login with e-mail address and then we
have the login success log in failed.
Here's a success, here's a failed.
What I'm going to probably want to do here is switch this
down here so that our login success.
We don't need to press again.
We're logged in, we're about to start the game.
Let's do that over here.
Because if we don't log in properly,
we don't want to start the game.
Let's fix that up a bit.
Let's do the same thing. Actually, you know what?
If you've started the game,
let's not do this again,
but let's only set it to true if it's successful.
We set it to successful here, so the game is true,
then we start the game that we don't click
this multiple times and then here we do
the same thing for
register and we only start it if it's successful.
There we go.
If we are logged into our account on PlayFab,
we can see here that the two users,
and if I refresh and clear,
we'll see three users because I just made one as I'm demoing here.
Just make sure it doesn't take this long there.
I see three of them here, right here in Canada.
We had the last two we made a new one here.
I think that's pretty much all we need to do to be able to log in.
Then we just have a switching between
the two login versus sign up.
That's it for getting authentication set up with PlayFab,
and we're going to keep working through the game,
and then we can start doing things like leaderboards,
analytics, online saving, all stuff that we can use with this.
We have our credit accounts, we have our login,
we're going to login with our secret login information.
Here we are. Characters already started.
Great. That's wonderful. There she is,
picking up some resources,
scavenging through the city,
and we have our buildings she can go into.
She can sleep to restore her health.
This was not difficult to do.
There's still a very large oversized bed is totally intentional,
not hiding little things that
came up that we didn't have time to fix.
But you know what? It's not bad.
It works, that's what's important.
We got a big bed out of it, extra cozy.
This was tricky getting from one level to the next,
telling her where to walk or clicking,
but I think it turned out really good.
I'm so happy with that.
It's cool to go through these buildings.
If we had more time or if I choose to continue working on it,
I would love to fill in these buildings
so that they have really interesting little area
you can go and explore and find items.
Right now, we just have this pile
of rubble that you can search through.
But I think it'd be really cool if there were like shelves where
the character could open and you can maybe find something.
If there were items that you didn't have to search for,
so you'd be like, good, I don't have to waste time searching.
Which you are going to use up health.
Also, underneath where I am here, we have our inventory system.
These are hotkeys,
when you pick something up,
it goes to our hockey place here.
We have nails, chips, wooden board.
Another thing that would be cool to add in
the future would be to upgrade areas.
Another one would be to have raiders
come in like in the full game.
This is actually using assets I created for my main projects,
Shrine one of the characters
and some of the buildings,
and I don't know if we use the buildings from Shrine.
But we used a few things from a Shrine that I made before,
and so this is a mini prologue game.
Shrine is a normal first person 3D game,
but this 2.5 style,
I think turned out really cool.
But it'd be cool to have raiders like we have in them full game.
It'd be cool to have more items.
It'd be cool to do upgrades and
crafting that we could definitely add in down the road.
It'd be cool to turn this into basically a mobile version
of Shrine or like a simplified
one where we tell a little backstory of a different character
who we see in the main game and now look really cool,
and that will work out really well.
Also, love to do procedural buildings.
This is a static level.
The reason I opted for that was because of the nave mesh.
I knew that the nave mesh would be difficult to do procedurally.
Because we have an unlimited timeline, I didn't do that.
Same with Dana psycho would be tricky.
Not that tricky but a little bit of extra work.
We got watt and planks also we can zoom in and out, just neat.
Some things would be nicer to polish up,
like it's not clear that you can interact with
different things until you click on them.
That's not obvious, but it'd
be nice to make that a little bit more obvious.
Same with when we use an item,
it's not clear that we used it other than the fact
that our health bar goes up.
Stuff like that audio would be nice to add in,
but I think we did a pretty good job.
For the time that we had, I'm pretty happy
with it and I'd love to keep working on it in the future.
As for PlayFab, some features that would
work really well would be a leaderboard.
Either most area uncovered or most days survived,
but it would need to be day and night.
I'd need to be there so we would count days or
even longest times survived something like
most raiders defended against
or you could even have high score for best bass upgrades,
and we could have values for
different parts of the base and how much each upgrade is worth.
We could have numeric system of which is the best base.
I would love to do the saving through PlayFab.
We don't have saving yet,
but saving through PlayFab so that we could play this on
our PC and then log in. Well, not even log in.
Once we log in one time on our phone,
we could just open it on our phone,
carry on from the where we left off in the game.
We could even add dialogue with different characters
that we made in Shrine that
I think would be really need to add in.
The ideas are endless.
We could also get analytics from the game.
That would be nice to see how
people play the game, where they start playing,
what might be indicators of where it starts getting boring.
That would be a great way to start making the game
better and optimizing for a better experience.
We could also add in in-game purchases.
I don't know, maybe some skins
or something like that would be cool.
Or like basically DLCs through
PlayFab if that's even a thing that people would want,
something like skins or visual stuff might be better.
If I was feeling really adventurous,
we could also do multiplayer one day down the road.
That would be pretty neat. But I think for two-day jam,
we got a really cool game done.
Thank you, guys, for joining along everyone in the stream.
That is it for our game jam.
Have a wonderful day, everyone.
Bye, guys.