WEBVTT

00:00:15.185 --> 00:00:16.370
GUEST SPEAKER: You ready?

00:00:16.370 --> 00:00:22.070
The project that I chose to
work on is a 2D puzzle game,

00:00:22.070 --> 00:00:25.460
and it's based on a
puzzle version of Tetris

00:00:25.460 --> 00:00:27.830
that I've created
over many years.

00:00:27.830 --> 00:00:30.840
I programmed in
different formats.

00:00:30.840 --> 00:00:33.800
But I haven't figured out
a good way to deploy it,

00:00:33.800 --> 00:00:37.850
so I thought maybe Unity would
be a good option because it

00:00:37.850 --> 00:00:39.740
claims to be cross platform.

00:00:39.740 --> 00:00:44.540
So, anyway, so I'm a one-person
project, and that's OK.

00:00:44.540 --> 00:00:46.900
It was a fascinating
learning experience,

00:00:46.900 --> 00:00:49.460
and I made decent progress.

00:00:49.460 --> 00:00:52.140
The game that you're
going to see is not very--

00:00:52.140 --> 00:00:54.500
oh, something's wrong with it.

00:00:54.500 --> 00:00:57.230
The Canvas needs to get
away from the playing board.

00:00:57.230 --> 00:00:59.540
Is there a way?

00:00:59.540 --> 00:01:03.390
Anyway, so the game is
very low-end graphics.

00:01:03.390 --> 00:01:06.590
It's very bare bones,
but conceptually, it's

00:01:06.590 --> 00:01:11.900
an implementation of Tetris,
with the variation that only

00:01:11.900 --> 00:01:13.250
certain pieces are used.

00:01:13.250 --> 00:01:15.740
And it has a puzzle objective,
so you could actually

00:01:15.740 --> 00:01:17.990
win the game or solve it.

00:01:17.990 --> 00:01:20.760
The objective is-- the simple
objective is a wipeout--

00:01:20.760 --> 00:01:22.610
where you want to clear
the board exactly,

00:01:22.610 --> 00:01:25.010
so that the last piece
clears all the row.

00:01:25.010 --> 00:01:27.810
Is everyone familiar with Tetris
and the row-clearing mechanism

00:01:27.810 --> 00:01:29.240
[INAUDIBLE], I hope?

00:01:29.240 --> 00:01:32.775
So you'll see it and figure
it out if you're not.

00:01:32.775 --> 00:01:34.140
If I can--

00:01:34.140 --> 00:01:38.300
I knew I wanted to do a
2D game, grid-type puzzle

00:01:38.300 --> 00:01:40.250
because that's what I've
been working on a lot

00:01:40.250 --> 00:01:43.160
is developing various
ideas for logic puzzles

00:01:43.160 --> 00:01:44.720
that use 2D grids.

00:01:44.720 --> 00:01:47.660
And I thought Tetris
might be too ambitious,

00:01:47.660 --> 00:01:49.730
so I was looking
at the tutorials I

00:01:49.730 --> 00:01:50.900
found on Unity sites.

00:01:50.900 --> 00:01:52.900
There were some-- there
was one for Minesweeper,

00:01:52.900 --> 00:01:54.441
so I was originally
going to do that.

00:01:54.441 --> 00:01:57.390
But then when I found
the Tetris tutorial,

00:01:57.390 --> 00:01:59.360
I said, oh, maybe
I can go with this.

00:01:59.360 --> 00:02:03.770
My first step was to implement
the Tetris tutorial--

00:02:03.770 --> 00:02:05.660
implement the code from
the Tetris tutorial,

00:02:05.660 --> 00:02:07.940
which that code was
for a full Tetris

00:02:07.940 --> 00:02:11.550
game with a 10-wide board
and all the pieces that

00:02:11.550 --> 00:02:12.860
are standard Tetris.

00:02:12.860 --> 00:02:14.960
But what I wanted
is just a couple

00:02:14.960 --> 00:02:17.240
of pieces that work
well for the wipe

00:02:17.240 --> 00:02:18.670
out games that I
do-- the puzzles.

00:02:18.670 --> 00:02:20.420
So I just needed a
T-piece and an L-piece,

00:02:20.420 --> 00:02:23.460
so that's all I implemented.

00:02:23.460 --> 00:02:27.020
So I adapted the
Tetris code a lot.

00:02:27.020 --> 00:02:29.750
So let me just jump a bit
and show you a quick demo

00:02:29.750 --> 00:02:32.054
if I could move my mouse.

00:02:32.054 --> 00:02:35.120
Oh, it's two screens.

00:02:35.120 --> 00:02:39.110
So before-- oh, yeah, the
game is already going.

00:02:39.110 --> 00:02:42.140
So you can select
which width you want.

00:02:42.140 --> 00:02:43.220
The board can be--

00:02:43.220 --> 00:02:46.040
I'll show you how that moves--

00:02:46.040 --> 00:02:47.870
the board can be
seven-wide, or we'll

00:02:47.870 --> 00:02:50.810
start with five-wide
because that's easier

00:02:50.810 --> 00:02:51.920
to finish the wipeout.

00:02:51.920 --> 00:02:54.530
10-wide is really slow.

00:02:54.530 --> 00:02:57.620
It's possible to play this
wipeout game with wider boards,

00:02:57.620 --> 00:03:01.260
but it just takes so much
longer, and it's tedious.

00:03:01.260 --> 00:03:03.260
So I find that five, six,
and seven are the most

00:03:03.260 --> 00:03:05.900
fun and challenging
levels, and the game

00:03:05.900 --> 00:03:07.000
can be very challenging.

00:03:07.000 --> 00:03:09.390
You need to learn
patterns, as you'll see.

00:03:09.390 --> 00:03:12.010
So then you have the choice
of three piece options,

00:03:12.010 --> 00:03:14.510
as either a T-piece,
which I'll start with,

00:03:14.510 --> 00:03:19.220
or you can do an L-piece, or
the T and L together, which

00:03:19.220 --> 00:03:22.130
under the current limitation,
they're randomly chosen,

00:03:22.130 --> 00:03:23.720
which makes the
game extremely hard

00:03:23.720 --> 00:03:26.850
because it's much
easier to solve

00:03:26.850 --> 00:03:29.540
if you can plan ahead a little.

00:03:29.540 --> 00:03:31.370
Because you get to
the point where--

00:03:31.370 --> 00:03:32.750
well, I'm jumping ahead.

00:03:32.750 --> 00:03:35.840
So let's do the T-piece and
show the game in action.

00:03:35.840 --> 00:03:37.200
So this is what it looks like.

00:03:37.200 --> 00:03:39.500
We start with a piece
down at the bottom.

00:03:39.500 --> 00:03:42.850
It manually drops-- are my
cursor keys going to work here?

00:03:42.850 --> 00:03:46.510
Yeah, so there's
basically four--

00:03:46.510 --> 00:03:48.740
the four arrow keys are
used to control this.

00:03:48.740 --> 00:03:52.860
The pieces fall like in
Tetris, so you can rotate.

00:03:52.860 --> 00:03:55.580
There is only one
rotate, so right up arrow

00:03:55.580 --> 00:03:58.040
is rotate clockwise.

00:03:58.040 --> 00:04:00.620
And you could drop a piece,
and then the rows clear.

00:04:00.620 --> 00:04:02.990
That's the Tetris mechanism.

00:04:02.990 --> 00:04:08.550
So now this takes a little
longer to do a wipeout,

00:04:08.550 --> 00:04:10.230
but I'll show you
the basic idea.

00:04:10.230 --> 00:04:12.770
The trick is that
you learn patterns,

00:04:12.770 --> 00:04:14.670
so you'll start to
see a pattern here.

00:04:14.670 --> 00:04:17.130
So I can clear
that, and now I can

00:04:17.130 --> 00:04:19.120
clear a row by putting this.

00:04:19.120 --> 00:04:23.150
It takes four pieces
to clear a row.

00:04:23.150 --> 00:04:26.610
So eight more pieces
and I'll be down--

00:04:26.610 --> 00:04:27.600
all but the white dots.

00:04:27.600 --> 00:04:31.655
So let's just plow through that,
so you can see what happens.

00:04:32.185 --> 00:04:33.410
[LAUGHTER]

00:04:33.410 --> 00:04:35.270
One more.

00:04:35.270 --> 00:04:39.749
So it's-- you see the pattern,
so part of what I think is fun

00:04:39.749 --> 00:04:41.540
about this game is
learning these patterns.

00:04:41.540 --> 00:04:44.230
It's challenging to figure
out how to learn pattern.

00:04:44.230 --> 00:04:46.270
There sort of like macros.

00:04:46.270 --> 00:04:46.925
Oh.

00:04:46.925 --> 00:04:47.424
[APPLAUSE]

00:04:47.424 --> 00:04:48.750
Look at that.

00:04:48.750 --> 00:04:51.000
Thank you.

00:04:51.000 --> 00:04:53.861
So let's just try one--

00:04:53.861 --> 00:04:56.360
I don't know how much time I
have, so I'll just do one more,

00:04:56.360 --> 00:04:58.610
so we can discuss
what went into it.

00:04:58.610 --> 00:05:02.040
There were a number of steps
forward in the learning

00:05:02.040 --> 00:05:02.540
experience.

00:05:02.540 --> 00:05:05.750
First, was implementing
the Tetris game, modified

00:05:05.750 --> 00:05:08.720
to use only the two pieces,
so I started with just the two

00:05:08.720 --> 00:05:10.960
pieces.

00:05:10.960 --> 00:05:15.810
And then, the next
step, I wanted to set up

00:05:15.810 --> 00:05:17.610
controls to let me select.

00:05:17.610 --> 00:05:20.910
So the first thing I did
was the width buttons--

00:05:20.910 --> 00:05:21.760
to modify the width.

00:05:21.760 --> 00:05:23.343
There's just one
thing that's control,

00:05:23.343 --> 00:05:30.120
which is the right border,
as you saw it moves around.

00:05:30.120 --> 00:05:33.730
So learning to move that was
my first learning experience.

00:05:33.730 --> 00:05:35.809
I was happy when I
got that to work.

00:05:35.809 --> 00:05:37.350
And I had to figure
out along the way

00:05:37.350 --> 00:05:39.480
how to make buttons work--
how to connect to them

00:05:39.480 --> 00:05:42.040
and run the scripts for
buttons and things like that.

00:05:42.040 --> 00:05:45.570
It was very challenging, and
I had never programmed in C#

00:05:45.570 --> 00:05:48.350
before, so that was a
challenge in itself.

00:05:48.350 --> 00:05:51.750
But I made progress with that.

00:05:51.750 --> 00:05:54.440
Once I figured out buttons, I
said, I'm running with buttons.

00:05:54.440 --> 00:05:56.950
I'm going to use buttons
for all they're worth.

00:05:56.950 --> 00:05:59.640
So I try to do the Piece
Selection buttons and then

00:05:59.640 --> 00:06:01.410
the Start buttons.

00:06:01.410 --> 00:06:03.540
And the Stop button
doesn't quite work.

00:06:03.540 --> 00:06:06.930
It sort of works, but it
seems to create something

00:06:06.930 --> 00:06:10.530
wrong in the data structure, so
that when I run the next game,

00:06:10.530 --> 00:06:11.550
it crashes.

00:06:11.550 --> 00:06:14.880
So that's not good, so I
avoid the Stop button now.

00:06:14.880 --> 00:06:19.290
So let me show you the six-wide
board with the T-piece also.

00:06:19.290 --> 00:06:21.142
Maybe I should do
the L-piece just

00:06:21.142 --> 00:06:23.100
to show you a different
piece because I may not

00:06:23.100 --> 00:06:25.490
be able to get beyond this.

00:06:25.490 --> 00:06:33.254
So how do I want to do this?

00:06:33.254 --> 00:06:36.680
So, yeah, this will work.

00:06:36.680 --> 00:06:38.170
So one of the
patterns you learn is

00:06:38.170 --> 00:06:40.240
that with two L-pieces
together, you can

00:06:40.240 --> 00:06:42.530
make a two-by-four rectangle.

00:06:42.530 --> 00:06:44.620
So if I put this one
down here, then the other

00:06:44.620 --> 00:06:46.720
completes the
two-by-four rectangle.

00:06:46.720 --> 00:06:52.450
And that rectangle, you can see,
fills in the remaining pieces,

00:06:52.450 --> 00:06:54.962
so that that wipes that one out.

00:06:54.962 --> 00:06:57.760
[APPLAUSE]

00:06:57.760 --> 00:06:59.402
And I won't have
time to finish it,

00:06:59.402 --> 00:07:00.860
but I'll just show
you what happens

00:07:00.860 --> 00:07:02.250
when have the end of pieces.

00:07:02.250 --> 00:07:04.690
Let's do it with, say,
the five-wide board.

00:07:08.890 --> 00:07:13.090
So you see-- so we randomly
get an L- or a T-piece now.

00:07:13.090 --> 00:07:15.700
And notice there's
only one kind of L,

00:07:15.700 --> 00:07:21.040
which is the L L,
not the reflected L.

00:07:21.040 --> 00:07:22.525
So how do I want to do this?

00:07:27.340 --> 00:07:31.030
So part of the problem here
is that this L will not

00:07:31.030 --> 00:07:34.730
turn around to go in
the other direction.

00:07:34.730 --> 00:07:41.060
Now if I'm fast, I can slip
things in before it falls.

00:07:41.060 --> 00:07:43.210
[LAUGHTER]

00:07:43.210 --> 00:07:47.230
So I implemented the
drop, so that it drops--

00:07:47.230 --> 00:07:49.720
let me just get my piece ready--

00:07:49.720 --> 00:07:51.010
I want it to go there.

00:07:51.010 --> 00:07:53.390
So it will drop, but
not freeze the piece.

00:07:53.390 --> 00:07:58.610
So the code actually waits
until there's a fall.

00:07:58.610 --> 00:08:00.490
You see that every
second the piece

00:08:00.490 --> 00:08:03.940
tries to fall another
step, and the piece

00:08:03.940 --> 00:08:07.000
freezes when it can't
successfully fall

00:08:07.000 --> 00:08:09.690
in response to a fall action.

00:08:09.690 --> 00:08:12.310
So this isn't great.

00:08:12.310 --> 00:08:13.965
PROFESSOR: Anybody
have any questions?

00:08:14.465 --> 00:08:16.590
GUEST SPEAKER: Yeah, you
can start asking questions

00:08:16.590 --> 00:08:17.790
while I muck with this.

00:08:20.590 --> 00:08:21.090
Nope.

00:08:21.090 --> 00:08:22.360
AUDIENCE: Have you
actually completed it

00:08:22.360 --> 00:08:23.560
with the RAM [INAUDIBLE].

00:08:23.560 --> 00:08:25.690
GUEST SPEAKER: Oh,
yeah, absolutely.

00:08:25.690 --> 00:08:29.250
It's just a little more
tedious, like I said.

00:08:29.250 --> 00:08:32.220
It takes-- no, it's
definitely doable.

00:08:32.220 --> 00:08:37.820
It just-- sometimes it takes
multiple tries because--

00:08:37.820 --> 00:08:38.919
here's a trick.

00:08:38.919 --> 00:08:41.309
Because I'm preparing for Ls.

00:08:41.309 --> 00:08:43.659
So I didn't get an L, but
I could put a T in here.

00:08:43.659 --> 00:08:46.740
If I get an L next, good,
then I could put this here.

00:08:46.740 --> 00:08:51.230
Now if I an L, I'll wipe
out all those three rows.

00:08:51.230 --> 00:08:53.178
So I want to do
things like that.

00:08:53.178 --> 00:08:54.402
[LAUGHTER]

00:08:54.402 --> 00:08:56.376
Let's see.

00:08:56.376 --> 00:09:05.200
There-- and this could work.

00:09:05.200 --> 00:09:06.641
I get another L. Nope--

00:09:06.641 --> 00:09:07.140
didn't.

00:09:07.140 --> 00:09:09.670
So how do I want to do this?

00:09:09.670 --> 00:09:11.920
So you don't always
get the piece

00:09:11.920 --> 00:09:15.478
you want, of course,
because it's random.

00:09:15.478 --> 00:09:17.950
Let's see how this works.

00:09:17.950 --> 00:09:21.034
This will get it down
to almost one row.

00:09:21.034 --> 00:09:24.240
[ARGH]

00:09:24.240 --> 00:09:24.930
Boo.

00:09:24.930 --> 00:09:29.260
I didn't want more
L-pieces, but I have

00:09:29.260 --> 00:09:30.550
to decide what to do with it.

00:09:30.550 --> 00:09:33.960
I guess I'll just bite
the bullet and do that.

00:09:33.960 --> 00:09:36.150
So now I'll try again.

00:09:36.150 --> 00:09:37.600
Yes, now if I--

00:09:37.600 --> 00:09:41.480
whichever-- I'd
prefer a T-piece now.

00:09:41.480 --> 00:09:42.975
So I can get it
down to one cell.

00:09:42.975 --> 00:09:47.250
I'm close to a wipeout,
but not what I wanted.

00:09:47.250 --> 00:09:49.230
If I can get a T-piece,
so this is good.

00:09:49.230 --> 00:09:52.110
I like getting-- making
the shape of a T-piece

00:09:52.110 --> 00:09:54.030
at the bottom because
there is a way

00:09:54.030 --> 00:09:57.590
to win if I get
the right pieces.

00:09:57.590 --> 00:10:03.393
So, L-- I need a T and an
L. let's hope for an L next.

00:10:03.393 --> 00:10:03.976
AUDIENCE: Yay.

00:10:04.476 --> 00:10:06.341
GUEST SPEAKER: Yay.

00:10:06.341 --> 00:10:08.706
[APPLAUSE]

00:10:11.071 --> 00:10:14.130
So I think this is a fun game.

00:10:14.130 --> 00:10:16.331
What was this-- there
was a second thing.

00:10:16.331 --> 00:10:18.220
The scripting was
a big challenge,

00:10:18.220 --> 00:10:23.830
and learning to get the
buttons to work properly.

00:10:23.830 --> 00:10:26.400
Oh, the text-- that's
what I did last night.

00:10:26.400 --> 00:10:27.850
I figured out how
to enable text.

00:10:27.850 --> 00:10:29.350
Someone gave me a
hint that I wanted

00:10:29.350 --> 00:10:31.660
to set enable true or something.

00:10:31.660 --> 00:10:33.910
But it was very
hard in one script

00:10:33.910 --> 00:10:35.260
that detected the wipeout.

00:10:35.260 --> 00:10:37.819
So I wrote the code last
night to detect the wipeout

00:10:37.819 --> 00:10:39.360
by checking for all
the rows cleared.

00:10:39.360 --> 00:10:44.240
There's a grid that's hidden
behind this little matrix that

00:10:44.240 --> 00:10:46.720
holds blocks.

00:10:46.720 --> 00:10:51.460
And the script operates on
that, and so I had the script

00:10:51.460 --> 00:10:54.144
that checks for the wipeout.

00:10:54.144 --> 00:10:55.560
And if it finds
there's a wipeout,

00:10:55.560 --> 00:10:57.850
then it needs to
call another script.

00:10:57.850 --> 00:11:02.770
Well, it basically needs to
go tell the text to enable,

00:11:02.770 --> 00:11:03.730
so that you can see it.

00:11:03.730 --> 00:11:07.110
So I created the text and
disabled it at the start,

00:11:07.110 --> 00:11:10.110
but then I needed to be
able to programmatically,

00:11:10.110 --> 00:11:12.130
or in the script,
turn it off and on,

00:11:12.130 --> 00:11:16.120
which these things sound
simple, but they are not trivial

00:11:16.120 --> 00:11:17.620
when you're first
encountering them.

00:11:17.620 --> 00:11:21.910
So I struggled-- doing
googling-- looking for things

00:11:21.910 --> 00:11:25.640
like how to find an object.

00:11:25.640 --> 00:11:29.530
And so there's find
object by type,

00:11:29.530 --> 00:11:32.230
and then there is the
game object defined,

00:11:32.230 --> 00:11:35.480
which let's you find by
name, which was very useful.

00:11:35.480 --> 00:11:38.540
So once I figured that
out I could look up my--

00:11:38.540 --> 00:11:41.050
I think it was a text object.

00:11:41.050 --> 00:11:44.204
I had a text object
that I created,

00:11:44.204 --> 00:11:45.370
but that wasn't good enough.

00:11:45.370 --> 00:11:47.810
I needed to get the
text component itself.

00:11:47.810 --> 00:11:49.870
So I had to call get
component and figure out

00:11:49.870 --> 00:11:53.470
what kind of specifications
to put after that to tell it

00:11:53.470 --> 00:11:55.030
what kind of component to find.

00:11:55.030 --> 00:11:56.140
The syntax was tricky.

00:11:56.140 --> 00:12:00.610
One website said you needed a
dot before the angle bracket

00:12:00.610 --> 00:12:02.110
text and another one.

00:12:02.110 --> 00:12:04.180
But what worked was not
having the dot there,

00:12:04.180 --> 00:12:07.760
so there's misinformation out
there, or else Unity changed.

00:12:07.760 --> 00:12:10.090
I don't know, but,
finally, I got it.

00:12:10.090 --> 00:12:11.810
And I thought there
was a method called

00:12:11.810 --> 00:12:16.300
enable that I could say enable
or disable, but turns out,

00:12:16.300 --> 00:12:17.120
it's a variable.

00:12:17.120 --> 00:12:19.570
It's a, I guess, a
component variable,

00:12:19.570 --> 00:12:22.360
or something, that you
can set to true or false.

00:12:22.360 --> 00:12:23.860
Finally, I figured
it out, and I was

00:12:23.860 --> 00:12:28.930
able to get the
congratulatory text to appear

00:12:28.930 --> 00:12:30.780
[APPLAUSE]