WEBVTT

00:07.430 --> 00:08.780
Welcome back.

00:08.810 --> 00:16.490
So we've seen that if we create a new slot and we select it and press play, we'll load in to the default

00:16.490 --> 00:17.690
player start.

00:17.690 --> 00:24.650
However, if we press play and select a slot that's already been saved and choose that and try to play

00:24.650 --> 00:28.070
it, we don't go into that default player start.

00:28.070 --> 00:35.000
We just go to wherever because we don't have a player start our game instance doesn't have that player

00:35.000 --> 00:43.310
start tag set and it's the game mode who finds the first player start and we go to that one, not this

00:43.310 --> 00:46.820
one in this level, this is our load screen map, but you get the idea.

00:47.500 --> 00:53.650
Now, the reason for that is because when we press the new slot button, we're creating a new slot and

00:53.650 --> 00:58.000
setting the game instance player start tag based on our aura game mode.

00:58.000 --> 00:59.680
Default player start tag.

00:59.680 --> 01:05.770
But when we already have a slot and we're loading it in, we're not pressing new slot button, we're

01:05.770 --> 01:13.030
pressing select slot button pressed, and if we press the play button, that's when we travel to the

01:13.030 --> 01:13.720
map.

01:14.140 --> 01:21.880
So at least some point before we travel to the map, we need to load in some kind of player start tag

01:21.880 --> 01:23.260
that we save.

01:23.620 --> 01:27.790
And if we never actually save one, well, there won't be one to load in.

01:28.090 --> 01:33.760
So what we should do is we should add a player start tag to our load slot.

01:34.030 --> 01:41.440
And that way when we save our data for the first time, that player start tag will be saved to disk.

01:41.440 --> 01:46.330
So our load slot needs it and our save game object class needs it.

01:46.810 --> 01:54.790
So let's go to load slot first and it's going to now get an F name for the default player start.

01:55.240 --> 01:58.300
This is going to be up here with our public variables.

01:58.540 --> 02:01.540
So we're going to make a F name.

02:02.470 --> 02:05.230
And we'll call this player start tag.

02:05.680 --> 02:07.720
And this will get a uproperty.

02:08.780 --> 02:12.440
And in addition to this, our save game object needs it.

02:12.440 --> 02:16.730
Our load screen save game is going to get an Fname now.

02:17.300 --> 02:23.960
So this will be F name and this will be our player start tag.

02:26.350 --> 02:28.000
Now something about f names.

02:28.000 --> 02:33.610
You should never have spaces in them or you can cause some problems, so keep that in mind.

02:33.610 --> 02:38.530
That's why I like to use f strings whenever I have any kind of descriptive text.

02:38.530 --> 02:42.490
F names can't have spaces in them that can cause issues.

02:43.020 --> 02:47.340
But anyway, we have a player start tag and our load screen save game.

02:47.340 --> 02:55.560
And in our load screen view model, whenever we create a new slot, we should set our load slots player

02:55.560 --> 02:56.580
start tag.

02:56.910 --> 03:01.680
We'll set it equal to the default player start tag on the game mode.

03:02.040 --> 03:07.380
So we'll just go ahead and do that here and load slots of slot.

03:08.640 --> 03:15.510
We'll set its player start tag equal to the Or game mode player start tag the default one.

03:17.340 --> 03:19.080
And then in or a game mode.

03:19.080 --> 03:23.640
When we save our slot data, we can go into save slot data.

03:24.320 --> 03:27.170
And make sure that we also save that player start tag.

03:27.170 --> 03:32.090
So load screen save game player start tag.

03:32.870 --> 03:39.320
We'll save that as well to whatever our player start tag is on the load slot.

03:41.550 --> 03:45.900
Now that we're saving it to disk, we can load it from disk as well.

03:46.230 --> 03:48.450
So back to our load screen.

03:48.450 --> 03:54.630
We can take a look at what happens when we click on select slot button.

03:54.960 --> 03:58.170
Either that or when we click on play.

03:58.170 --> 04:04.110
Really it only matters when we click on play because that's when we're about to travel.

04:04.110 --> 04:10.110
So if we're about to travel to a new map, we need to know the player start specifically, our game

04:10.110 --> 04:12.180
instance should know the player start.

04:12.180 --> 04:20.520
So as soon as the play button has been pressed, I'm going to get our you ora game instance called or

04:20.520 --> 04:21.660
a game instance.

04:21.660 --> 04:27.630
I'm going to cast to that and I'm going to call get game instance from our game mode.

04:27.630 --> 04:33.210
So I'm going to actually put this right here just underneath our Ora game mode.

04:33.210 --> 04:37.770
So I can call Ora game mode get game instance.

04:38.290 --> 04:41.860
Now that I have the game instance, I'm going to take our A game instance.

04:44.270 --> 04:52.940
And set its player start tag, because our selected slot has its player start tag set by this point.

04:53.270 --> 04:57.320
So now play button pressed is getting that player start tag.

04:57.740 --> 05:03.770
But when we load data, we have to make sure that that player start tag is set on our slots.

05:03.770 --> 05:09.860
So down here in load data where we're loading everything into our slots, our status, player name,

05:09.860 --> 05:15.710
even the map name we need to load in our player start tag as well.

05:15.740 --> 05:22.250
So I'm going to take our load slot dot value here and set the player start tag.

05:24.170 --> 05:26.960
And we're going to get that from our save object.

05:27.650 --> 05:30.110
So save object player start tag.

05:30.110 --> 05:34.790
Now that we're loading from disk our player start tag whenever we load it.

05:34.790 --> 05:40.970
Then when we press play then we know that our slot that we're getting our player start tag from should

05:40.970 --> 05:42.200
have a valid slot.

05:42.380 --> 05:49.070
So with that change, we can go ahead and close out of the editor and restart.

05:52.380 --> 05:58.680
All right, we're back in the editor, and I'm going to go back to our load menu and press play.

05:58.680 --> 06:03.510
And I need to delete these again because they don't have player start tags saved.

06:03.510 --> 06:05.370
So I'm going to create a new slot.

06:05.370 --> 06:07.350
I'm just going to use S for the name.

06:07.680 --> 06:11.550
And if we select the slot and press play we'll go to the correct player start.

06:11.550 --> 06:12.660
And that's great.

06:12.660 --> 06:18.060
But if we go back to the load menu, press play and select that slot and press play again.

06:18.060 --> 06:23.310
Once again we go to the correct player start because we're actually loading it in from disk.

06:23.610 --> 06:27.420
And now we have the concept of our player start tag saved.

06:27.420 --> 06:33.660
And we can use this to our advantage if we want to save our progress as we're going through different

06:33.660 --> 06:40.230
dungeons, when we reach a checkpoint, for example, we can save that checkpoint for our player start

06:40.230 --> 06:42.120
and this can be really useful.

06:42.180 --> 06:49.830
Now this is the design I'm choosing for this project to have checkpoints and load in at player starts,

06:49.830 --> 06:54.870
but you really could load in your location from disk if you wanted to save your location.

06:54.870 --> 06:57.060
It doesn't have to be at a player start.

06:57.060 --> 07:01.410
That's just the implementation I'm choosing to implement for this project.

07:01.410 --> 07:04.110
I like to use player starts as checkpoints.

07:04.440 --> 07:09.750
Now this is great, but checkpoints should look like checkpoints in the game.

07:09.750 --> 07:14.070
If you reach something that looks like a checkpoint, that's going to tell you, hey, I'm saving my

07:14.070 --> 07:15.240
progress there.

07:15.240 --> 07:21.000
And if we look in our assets and go to dungeon, there's a folder called checkpoint and we have a static

07:21.000 --> 07:25.410
mesh called checkpoint, and this looks like a pretty good checkpoint.

07:25.410 --> 07:29.070
We're going to use this as our checkpoint player start.

07:29.070 --> 07:31.890
And that'll allow us to save progress.

07:31.890 --> 07:35.970
Every time we reach one of these, we know that we've reached a checkpoint.

07:35.970 --> 07:42.240
Maybe we can inform the player that it's reached a checkpoint, and then we can save that player, start

07:42.240 --> 07:46.230
tag and load in at that next time we load in.

07:46.230 --> 07:48.420
So we're going to do that next.

07:48.780 --> 07:49.650
I'll see you soon.
