‫Hello and welcome.
‫In this lecture, we're going to be looking at these little pins and the different colors they come
‫in and understanding that these are different data types that restrict what we can plug in to what.
‫So let's dive right in and have a look at what I mean by a data type.
‫So a fairly workable definition of data type is that it's how it is representing certain pieces of data
‫in binary on your computer's memory.
‫And but also it can just be a way of restricting what can we do with this piece of data.
‫So it's not necessarily always about different representations.
‫And you can think of it as the shape of the data in the sense that a square peg can't fit in a round
‫hole.
‫So we can't get the wrong type of data in to the wrong type of pin.
‫So let's have a look at some examples of data types.
‫There is the integer, which is a classic example.
‫An integer is a whole number, so it has values like 223 -14, but not something like 1.2.
‫That would be a float which is short for floating point number.
‫And these are basically numbers where you have a decimal point and these numbers can be very large or
‫very small, but they crucially are not whole numbers.
‫They can be negative as well.
‫And then there are strings.
‫We've come across strings before, strings being just programmer speak for pieces of text.
‫And it is essentially a data type.
‫It's a way of storing pieces of text in memory so they can be anything you like.
‫Really.
‫Hi, Bob.
‫You know, whatever, all these things, all these pieces of text on my screen are strings, probably
‫somewhere in the computer's memory.
‫And then finally there are balls which are short for booleans, and these have only two possible values,
‫true or false?
‫Now these data types are great, but you can't go about representing a whole game with such simple things,
‫can you?
‫Well, you can if you start grouping them together into things like objects.
‫Once you group them together into an object, they start to become more meaningful.
‫You can have an integer to represent the age, you can have a float to represent experience points,
‫those kinds of things.
‫And one point to note is that as well as objects, we have things in blueprint called structs.
‫And don't get confused here.
‫Too much struct is basically the same as an object, except that it is usually quite small and we don't
‫use references, we just pass them around and copy them around in memory without worrying about them
‫because they're so small.
‫And a data type, as we said, is the shape of our data.
‫So let's have a look at some object struct examples.
‫So imagine we had our adventurer.
‫Our adventurer might look a little bit like this.
‫This is the shape of its data.
‫It has an integer to represent its level and a float to represent its experience points.
‫Now you might have multiple adventurer instances that are of the same adventurer class, so they have
‫to have the same shape of data, but they don't have to have the same contents of data.
‫You can see here the second adventurer has a level of 100 and for some reason experience points of minus
‫five.
‫But never mind that you could also have a different type by having a different class of object such
‫as the player.
‫And here you can see the shape is different.
‫These two are the adventure and the player are non compatible types and however they do, you know,
‫these players have different values stored in them.
‫They have a player name, they have maybe whether they're using a controller or not as as some of the
‫data in them.
‫Now let's have a look at some structs that we've seen in the past.
‫Again, remembering that structs and objects are more or less interchangeable except for their size.
‫So the first one that we've seen quite a few times is a vector, and a vector is nothing but three floats.
‫That's all it is an X, Y and Z float, which can be used to represent position.
‫It can also be used to represent scale or we've used it when we've been inputting the impulse into our
‫ADD impulse node.
‫Another thing that we saw in passing is a rotator.
‫Now notice this rotator is also just three floats, but that doesn't mean that these two types are compatible.
‫We can give structs different names so that we save ourselves from accidentally using them in situations
‫where we shouldn't.
‫And we can put these together and create an even bigger compound structure, the transform which is
‫the location, rotation and scale of an actor in a scene.
‫So you can see here that this is a struct made up of other structs and you can basically nest these
‫things as much as you like and have structs inside of objects and so on and so forth.
‫They can get pretty complicated.
‫So let's have a look at some objects we've seen in the past already.
‫We've had a look at objects that are actors.
‫We know that actors are a type of object.
‫We've seen actors that are cubes.
‫This is another type of object.
‫We've seen the our projectile is a type of object as well, and it is an actor.
‫And we've seen that we've got components on our actors, which are also types of objects.
‫And the static component is an example of one of those.
‫So we've got all of these and these are just made out of those basic data types down.
‫Deep down, they might be made up of more complicated structures in the interim, but it's all about
‫those basic data types.
‫And so when we go and have a look at a graph like this, we can see instantly by the color that this
‫impulse is a vector, for example, that the location, rotation and scale here are just three floating
‫point numbers.
‫And we can also see that this red velocity change checkbox is a boolean.
‫It's a yes no answer.
‫So we're starting.
‫To understand that these are the data types that are constraining what we can plug into what.
‫So in summary, what we've seen is that a data type is the shape of our data, that objects are just
‫collections of data and functionality, as we've said before, that structs are objects, but usually
‫just a little bit smaller.
‫And that's pretty much what you need to know.
‫I will see you in the next lecture.