﻿1
00:00:04,150 --> 00:00:05,500
‫Hello and welcome.

2
00:00:05,500 --> 00:00:11,080
‫In this lecture, we're going to be looking at these little pins and the different colors they come

3
00:00:11,080 --> 00:00:17,470
‫in and understanding that these are different data types that restrict what we can plug in to what.

4
00:00:17,830 --> 00:00:23,470
‫So let's dive right in and have a look at what I mean by a data type.

5
00:00:23,650 --> 00:00:31,750
‫So a fairly workable definition of data type is that it's how it is representing certain pieces of data

6
00:00:31,750 --> 00:00:34,930
‫in binary on your computer's memory.

7
00:00:35,410 --> 00:00:42,730
‫And but also it can just be a way of restricting what can we do with this piece of data.

8
00:00:42,730 --> 00:00:46,510
‫So it's not necessarily always about different representations.

9
00:00:46,510 --> 00:00:55,090
‫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

10
00:00:55,090 --> 00:00:55,690
‫hole.

11
00:00:55,690 --> 00:01:00,730
‫So we can't get the wrong type of data in to the wrong type of pin.

12
00:01:01,850 --> 00:01:04,370
‫So let's have a look at some examples of data types.

13
00:01:04,370 --> 00:01:07,610
‫There is the integer, which is a classic example.

14
00:01:07,610 --> 00:01:16,760
‫An integer is a whole number, so it has values like 223 -14, but not something like 1.2.

15
00:01:16,760 --> 00:01:23,000
‫That would be a float which is short for floating point number.

16
00:01:23,060 --> 00:01:28,940
‫And these are basically numbers where you have a decimal point and these numbers can be very large or

17
00:01:28,940 --> 00:01:33,650
‫very small, but they crucially are not whole numbers.

18
00:01:33,650 --> 00:01:35,390
‫They can be negative as well.

19
00:01:35,690 --> 00:01:36,860
‫And then there are strings.

20
00:01:36,860 --> 00:01:42,200
‫We've come across strings before, strings being just programmer speak for pieces of text.

21
00:01:42,200 --> 00:01:44,390
‫And it is essentially a data type.

22
00:01:44,390 --> 00:01:49,970
‫It's a way of storing pieces of text in memory so they can be anything you like.

23
00:01:49,970 --> 00:01:50,210
‫Really.

24
00:01:50,210 --> 00:01:51,170
‫Hi, Bob.

25
00:01:51,170 --> 00:01:55,760
‫You know, whatever, all these things, all these pieces of text on my screen are strings, probably

26
00:01:55,760 --> 00:01:57,650
‫somewhere in the computer's memory.

27
00:01:58,040 --> 00:02:03,320
‫And then finally there are balls which are short for booleans, and these have only two possible values,

28
00:02:03,320 --> 00:02:04,760
‫true or false?

29
00:02:05,060 --> 00:02:12,380
‫Now these data types are great, but you can't go about representing a whole game with such simple things,

30
00:02:12,380 --> 00:02:13,040
‫can you?

31
00:02:13,040 --> 00:02:19,280
‫Well, you can if you start grouping them together into things like objects.

32
00:02:19,280 --> 00:02:23,450
‫Once you group them together into an object, they start to become more meaningful.

33
00:02:23,450 --> 00:02:28,130
‫You can have an integer to represent the age, you can have a float to represent experience points,

34
00:02:28,130 --> 00:02:29,390
‫those kinds of things.

35
00:02:29,390 --> 00:02:36,170
‫And one point to note is that as well as objects, we have things in blueprint called structs.

36
00:02:36,170 --> 00:02:38,060
‫And don't get confused here.

37
00:02:38,060 --> 00:02:44,420
‫Too much struct is basically the same as an object, except that it is usually quite small and we don't

38
00:02:44,420 --> 00:02:49,630
‫use references, we just pass them around and copy them around in memory without worrying about them

39
00:02:49,640 --> 00:02:50,780
‫because they're so small.

40
00:02:50,960 --> 00:02:55,670
‫And a data type, as we said, is the shape of our data.

41
00:02:56,120 --> 00:02:58,730
‫So let's have a look at some object struct examples.

42
00:02:58,730 --> 00:03:01,040
‫So imagine we had our adventurer.

43
00:03:01,040 --> 00:03:03,470
‫Our adventurer might look a little bit like this.

44
00:03:03,470 --> 00:03:05,180
‫This is the shape of its data.

45
00:03:05,180 --> 00:03:10,970
‫It has an integer to represent its level and a float to represent its experience points.

46
00:03:10,970 --> 00:03:17,630
‫Now you might have multiple adventurer instances that are of the same adventurer class, so they have

47
00:03:17,630 --> 00:03:22,520
‫to have the same shape of data, but they don't have to have the same contents of data.

48
00:03:22,520 --> 00:03:27,980
‫You can see here the second adventurer has a level of 100 and for some reason experience points of minus

49
00:03:27,980 --> 00:03:28,280
‫five.

50
00:03:28,280 --> 00:03:34,880
‫But never mind that you could also have a different type by having a different class of object such

51
00:03:34,880 --> 00:03:35,750
‫as the player.

52
00:03:35,750 --> 00:03:37,940
‫And here you can see the shape is different.

53
00:03:37,940 --> 00:03:44,730
‫These two are the adventure and the player are non compatible types and however they do, you know,

54
00:03:44,780 --> 00:03:47,240
‫these players have different values stored in them.

55
00:03:47,240 --> 00:03:51,770
‫They have a player name, they have maybe whether they're using a controller or not as as some of the

56
00:03:51,770 --> 00:03:52,790
‫data in them.

57
00:03:52,790 --> 00:03:55,880
‫Now let's have a look at some structs that we've seen in the past.

58
00:03:55,880 --> 00:04:00,440
‫Again, remembering that structs and objects are more or less interchangeable except for their size.

59
00:04:00,620 --> 00:04:06,950
‫So the first one that we've seen quite a few times is a vector, and a vector is nothing but three floats.

60
00:04:06,950 --> 00:04:11,180
‫That's all it is an X, Y and Z float, which can be used to represent position.

61
00:04:11,180 --> 00:04:16,970
‫It can also be used to represent scale or we've used it when we've been inputting the impulse into our

62
00:04:16,970 --> 00:04:18,380
‫ADD impulse node.

63
00:04:18,860 --> 00:04:21,110
‫Another thing that we saw in passing is a rotator.

64
00:04:21,110 --> 00:04:28,400
‫Now notice this rotator is also just three floats, but that doesn't mean that these two types are compatible.

65
00:04:28,400 --> 00:04:34,910
‫We can give structs different names so that we save ourselves from accidentally using them in situations

66
00:04:34,910 --> 00:04:36,110
‫where we shouldn't.

67
00:04:36,740 --> 00:04:43,490
‫And we can put these together and create an even bigger compound structure, the transform which is

68
00:04:43,490 --> 00:04:49,070
‫the location, rotation and scale of an actor in a scene.

69
00:04:49,070 --> 00:04:54,380
‫So you can see here that this is a struct made up of other structs and you can basically nest these

70
00:04:54,380 --> 00:04:58,370
‫things as much as you like and have structs inside of objects and so on and so forth.

71
00:04:58,370 --> 00:04:59,990
‫They can get pretty complicated.

72
00:05:00,380 --> 00:05:03,890
‫So let's have a look at some objects we've seen in the past already.

73
00:05:03,890 --> 00:05:06,980
‫We've had a look at objects that are actors.

74
00:05:06,980 --> 00:05:08,870
‫We know that actors are a type of object.

75
00:05:09,380 --> 00:05:11,840
‫We've seen actors that are cubes.

76
00:05:11,840 --> 00:05:13,490
‫This is another type of object.

77
00:05:13,490 --> 00:05:19,340
‫We've seen the our projectile is a type of object as well, and it is an actor.

78
00:05:19,340 --> 00:05:24,680
‫And we've seen that we've got components on our actors, which are also types of objects.

79
00:05:24,680 --> 00:05:28,040
‫And the static component is an example of one of those.

80
00:05:28,040 --> 00:05:32,840
‫So we've got all of these and these are just made out of those basic data types down.

81
00:05:32,840 --> 00:05:38,390
‫Deep down, they might be made up of more complicated structures in the interim, but it's all about

82
00:05:38,390 --> 00:05:39,860
‫those basic data types.

83
00:05:40,010 --> 00:05:46,280
‫And so when we go and have a look at a graph like this, we can see instantly by the color that this

84
00:05:46,280 --> 00:05:52,790
‫impulse is a vector, for example, that the location, rotation and scale here are just three floating

85
00:05:52,790 --> 00:05:53,810
‫point numbers.

86
00:05:54,230 --> 00:05:58,640
‫And we can also see that this red velocity change checkbox is a boolean.

87
00:05:58,640 --> 00:06:00,140
‫It's a yes no answer.

88
00:06:00,140 --> 00:06:00,890
‫So we're starting.

89
00:06:01,090 --> 00:06:07,510
‫To understand that these are the data types that are constraining what we can plug into what.

90
00:06:08,320 --> 00:06:14,620
‫So in summary, what we've seen is that a data type is the shape of our data, that objects are just

91
00:06:14,620 --> 00:06:19,720
‫collections of data and functionality, as we've said before, that structs are objects, but usually

92
00:06:19,720 --> 00:06:20,950
‫just a little bit smaller.

93
00:06:20,950 --> 00:06:23,770
‫And that's pretty much what you need to know.

94
00:06:23,800 --> 00:06:25,870
‫I will see you in the next lecture.

