So without further ado, this is what we're going to make today.
We're making a two player
tank shooting game.
It's not a networked multiplayer game,
so don't be confused by that.
We will be releasing a version of the game
tomorrow that has Unet stuff built in to it,
sorry, multiplayer features built in to it.
But this is all about two players on one keyboard.
So we're going to build this game throughout the day
and then at the end of the day we're going to get together
and have a bit of a battle with it.
Okay, so many of you will see that there's
a completed scene loaded,
if that's not what you're seeing, don't worry about it at all.
We're going to start by making a new scene in a moment.
What I would like to you to do or suggest that
you do if you're hoping to see exactly what
we're seeing on the screens is to use the same
layout that we're using.
So what I'm going to get you guys to do is click on
the Layout drop down in the top right
and choose 2 by 3.
Then what I'm going to do is to grab my project panel.
and drag and drop that by grabbing the tab at the top
and drop it below the hierarchy.
You're looking at a layout that's something like this.
So if you're unfamiliar with Unity then you can just
drag these windows around, you can reorder them,
you can dock tabs,
but hopefully everybody's familiar with that having watched
the beginner tutorials that we sent you by email.
And then the only other thing that I'm going to do it
to set my project panel to a list style
view by dragging the slider at the bottom here.
If you drag it all the way to the left you will get a list view.
Okay, so that's our editor setup.
By the way if I'm going too fast just shout
at me, I'll slow down.
We're going to start from scratch,
so if you go to File - New Scene
command-N on mac, control-N on PC
and then the first thing we're going to do
before we start losing work, or doing work,
is to save it somewhere, so you go
File - Save Scene As
and you will find a Scenes folder.
And we're just going to call this Main.
Save it in there.
Then what we're going to do is to
remove the directional light.
So whenever you make a new empty scene in Unity
you get two things, you get a main camera,
and you get a directional light,
so it's kind of setup so that you can just
drag some artwork in there and it's going to look nice.
We've got our lighting setup in our Level prefab.
So we don't need that, so select the directional light
in the hierarchy here,
just delete it, command-backspace on mac
delete on PC.
Then what I want you to do is
look in the Prefabs folder in the project.
What you should see is that you've got a number of
prefabs in there.
One of those is called LevelArt
and if you select it it should look something like this.
So it's a little game board with all of the stuff setup.
So the reason we're giving this to you readymade,
or prefabbed as we call it,
is that we didn't want you guys to have to go through a whole
system of setting up colliders
and all of this different stuff.
We thought we would just get it all ready and then
actually go about making the game.
So I'm going to grab my LevelArt prefab and just
drop it on to the hierarchy.
Then what you'll see is that that's populated
in the scene view and you can see part of
it in the game view as well.
Now what you'll notice at this point is that there's a blue
progress bar starting down at the bottom..
So we want to change some settings for that.
What that's doing is telling us about lighting
and it's starting to create a lighting bake.
So I want you to go to Window - Lighting.
If you drop the LevelArt prefab in
to the scene that will instantiate it as well,
but it won't position it at the origin,
if you've done that don't worry about it,
just put it back at the origin by changing position to (0,0,0).
Yeah, so just to reiterate
the LevelArt should be at (0,0,0)
if you've dragged it in to the hierarchy.
If you randomly dropped it in to the scene view it might
be at a slightly different position, just set those all back
to 0 in the transform component here
Transform - Position - (0,0,0).
Okay, so the lighting panel.
First thing to do is to uncheck Auto
at the bottom of the lighting panel.
So what Auto is there to do is basically to
allow you to be lighting and moving around
geometry that's going to stay still,
okay, so if we were designing this level
and we wanted to kind of incrementally bake whenever
we moved something around it will rebake the shadows, etcetera,
then we'd leave that setup, but we've already done
that for you, so what we're going to do instead is uncheck that
and then we're going to give you some settings to put in.
First thing I'm going to do is remove Baked GI.
So we don't want any baked
lighting for this, we're going to use realtime
lighting so that when we're firing the shells around
they've all got lights on and they're going to light up the scene for us.
So we're going to use that
Precomputed Realtime GI.
But we don't want it at a realtime resolution of 2
we're going to set that to 0.5.
This is kind of, sort of low poly style artwork,
no offence Pete, it's beautiful, well done.
So, we don't need immensely high res
for the lighting there, we can get away with
0.5 instead.
Then one other thing that we need to do is to change
our ambient lighting, so in Unity lighting can come
from all the different lights that you put in there,
so you know, we saw we had a directional light,
and we have a directional light in this scene,
it's attached to this.
So you can see here, directional light.
But you can also get ambient contribution
and ambient is basically just the lighting
supplied either by a skybox or by colour or gradient.
and we're just going to set this to a colour.
What I wanted to introduce you to briefly is that
whenever we switch back to the slides we're going to have a quick
recap of what we've just done, okay?
So we've skipped through a few basic steps
but what we'll also do is when we get in to the more detailed stuff
we'll keep going back to the slides,
and the slides also have references to things.
So you can see here we have Ambient Color, and that's
what we're going to do next, and you can see I'm
asking you guys to set it to 972, 62, 113).
But what does that mean?
So Ambient Source set to color, which looks like this,
So this color box,
has RGB values, if you click here
it will change to different values, but you want
to make sure you're on RGB.
And the references there, 72 for red,
green 62 and 113 for blue.
This system of showing you
these different references is
going to be the same for X, Y and Z.
So they're represented by red, green and blue
as well, so if you see those for color
and also for positions or rotations
don't get confused, that's fine.
Okay, so back to the editor.
We've put in this kind of purple color in ambient
and that's fine.
And then right at the bottom of that panel
we're just going to click Build.
So Build will bake your lighting
and you'll see a short progress bar at the bottom.
If you've just opened Unity for the first time,
like ever, or just installed this version for the first time
then it might take a little bit longer to bake.
It doesn't matter before it's going to do it in the background
and we can carry on with the work that we're doing.
The next thing we're going to do is to setup our camera.
So the position of the camera currently
as you can see is kind of looking at some of the buildings.
It's embedded down here.
So it's this kind of default position that camera's
always are, which is at (0,1,-10) in the world.
So it's kind of away from 0
so that you can look at something if you put it in at 0.
So we're going to start by just repositioning
that so I'm going to set the position in the transform component
to (-43, 42, -25).
And I'm going to rotate this
to (40, 60, 0).
Okay, and then the final thing we're going
to do there is to set it to orthographic projection.
So as I promised we're going to do these recaps.
So in the inspector panel we're setting the position
of the camera to (-43, 42, -25).
Change the rotation to (40, 60, 0).
Finally we're changing the projection to orthographic
and we're going to talk a little bit about what that means.
So what you'll notice is that
when we've changed projection from perspective
to orthographic you now get this
strange looking flattened view.
We're going to talk a lot more about that in the specific
section on cameras later on
but just to briefly explain,
the difference between projection and orthographic is
that there's no change in scale
over distance, and we've got some diagrams
that explain that a bit better.
But what you'll need to know going in
is that size is what changes, effectively the zoom.
As I drag my size value I'm effectively zooming in and out.
We don't want you to do this, but it's just an example.
Then the last thing that we're going to do.
As you notice when I zoom out here,
sorry, wrong way round, when I zoom out I can see my
strange gradient sky box in the background
and because our camera will pan out when our
tanks move far apart we need to have a background color setup.
What I'm going to do is to change
my clear flags on the camera component
from skybox to solid color.
And then I'm going to choose a color for the background.
So this is just going to be a brown to match the
desert and the RGB reference is (80, 60, 50).
If you want to choose your own brown, you're a big fan of
brown, then you know,
pick your favourite brown.
We're just going to put in that RGB reference
and then what we'll see
when we do happen to go over the edges
is that, so it kind of fits the theme.
But like I said, don't change the size value,
that's not important.
So quick recap, we changed our clear flags
from skybox to solid colour so that the
background, so what renders behind all of
the geometry in the scene is changing
to a particular color,
we changed that color to (80, 60, 50).
And finally we're going to save our scene,
I'm going to get you to save all the time,
but it's just a good habit to control-S or command-S if you're on a mac.
Keep updating your scene.
So the next thing that we're going to do is create
our tank and it's control,
so as with the level art we've created
the artwork for you.
This time we're not going to give it to you prefabbed,
we're going to start with the model and build up
all the components that you need.