Hello guys.
Welcome to the video.
In this one I want to show you how to make an auto tile rule system.
This system.
Well let me just show you what it does.
So you can select one tile and you can choose the fill tool.
And you can, uh, draw level parts like that.
And corners and sides of the level parts would be chosen automatically by unity.
It works in a very simple way.
You just need to give it a bunch of rules, and then you need to follows these rules and just does the
job for you.
Simple as that.
I'm going to show you how to make it right now I just want to say that this makes it easier to use,
but also it takes time to set up.
And because of that, it is always a question.
Is it better to use this system or just place tiles with your hands like that?
Because maybe you want to have a handcrafted levels and you want to have some, you know, like specific
corners and so on.
So it always depends on the needs of the project, depends on what you want.
Nevertheless, I want you to know how to use it.
And I'm going to show you how does it work and how to make it okay.
There are also some limitations, but we're going to learn about them later on.
Let me erase it.
Let me go to Tile Palette.
I'm going to just keep this one.
You can use it later on.
Once you've got the project, let me just do stone rule.
Here and we're going to make a new one.
And this one you can just copy after you learn how to make it.
Or you can just take it from the project that you'll get in the end of the section.
Nice.
Now how do you make a rule?
You click right button create.
2D.
Tiles rule tile.
I'm going to name it as would rule.
And now, first of all, let's just click the lock it over here.
This one will lock the inspector and no matter what we select, we're still going to have this, uh,
object selected.
Then let's go to graphics.
Terrain.
And let's work with the wooden tiles over here with this one.
First of all, we need to set up default tiles so we understand what we are working with.
And for that I guess it's better to choose the corner.
So I'm going to choose this one.
Then we need to say how many tiles we're going to have in this, uh, rule tile.
For now we just want to have nine of them.
Let's have nine of them now.
Over here.
We need to fill up the tiles on the right with the tiles we have here.
And we're going to work with the wooden tiles.
So let's go here.
And let's take the corner.
Then we need the top part.
Then the right corner from the top.
Then we're going to have the second line of the tiles.
So the left one, the middle one, the right one.
Then we're going to have the bottom line of the tiles.
So the bottom one the middle one the right one.
Before we continue the setup let's go to Asset Tile palette.
Let's take this wooden rule and let's drag it over here.
Then we're going to select it.
And I want to draw a platform just like that.
I know it is a mess right now but no worries we're going to fix it.
Now, how does the rules are working?
Well, you take a look at the first one.
We have a corner, the top left corner and this corner.
Cannot have anything at the top.
Uh.
And this corner and the left adhere and adhere.
This corner can be extended only to the right.
To the bottom right and down here.
And these are not supposed to have anything, right.
That's the rule for this corner.
He can be placed only in these conditions.
If it is like that, we need to go here and say that it can be extended here, here, here.
But it cannot be extended here.
So we put cross and to put a cross you need to click it twice.
So cross cross cross cross cross okay.
And look at this.
You've got a corner over here automatically.
Very nice.
So there are three states for this one.
One is the arrow, which says.
Title can be extended to this side.
Then there is a cross which says titles cannot be extended to that side, and there is an empty square
which is sort of like is not taking any rules, you know, you can have that, can have that like it
does not have any rule for that spot.
Exactly.
So we know how it works, how the rules should be.
So let's just set up the rules.
And I'm going to explain everything I do for the first one.
But for the second one I'll just do it quickly and you'll see the result okay.
Now let's go further.
And let's just say that this style can be extended to the left, down, left, down, down, right and
to the right.
It cannot be extended here, but it may have something here because we're going to have like different
shapes of the platform.
So I'm going to just do this.
And that's it for this corner.
Sorry.
Here, here.
This one cannot be used.
So just like that.
On the left.
One can be extended like that and it cannot have anything from the left.
In the middle, it can be surrounded from any side.
So we're going to do it like so.
For the right one over here can go just to these sides, but cannot have anything here.
So this is how we do it for the bottom left can be extended to this direction but can't have anything
here.
The bottom line over here can go like so.
So we go here, here, here, here, here and here.
We're going to put a cross.
This is the last one.
Very easy one.
It goes up and left and up left.
So up up left and left.
And here we're going to have crosses.
Okay, so now the system is working.
You can select this tile and you can draw anything you want.
Although it is not over yet, you can see the mess it makes when we have corners like this.
By the way, this is a good result, but over here this is also a good result.
I kind of like it.
Give me a second.
I'll try to draw something.
Yeah.
So when we have something like this, you can see it's not working very well.
Right?
Um.
Like this.
It is not working very well.
It needs some corners.
So here, first of all, it depends on what platforms you're going to make in the game.
But we can use these corners and make it work.
But I know this because I spent a good amount of time trying to set up these tiles.
It's not like I magically know this information.
I actually tried for a while to make it work.
So I'm going to show you how to set up everything with these tiles, and I think it can be applied to
these tiles as well.
But for this over here, to be very honest, I'm not sure how to set up these corners.
So if you like you can try and see how it works for you.
But I'm just going to leave it at that.
And if I need this one to be with corners, then I'll just do it manually with my hands.
But other than that, I'll just use square platforms and rectangular platforms.
Yeah.
So let me show you how to stop corners for the wooden tile set.
We're going to go here and we're going to extend it.
Add one and then we need to go to graphics.
Terrain, and we need to find that corner thin.
And this one.
Now.
Wait.
This is the top left.
Right.
Let's go and find top left.
Actually, it's not the top left, and maybe we need to draw it with the hands to see what is the top
left.
What is not.
Wait, why did I delete that?
Let's keep it.
Just want to try to repeat the shape here.
So.
Something like this.
And, uh, something like this goes here, this goes here.
And let's say we want it to be extended up.
So we draw it like.
So.
And the question is, what do we place over here?
What do we place here and here?
We're going to place the corner like so.
And one.
Over here like so.
So this makes it better.
And this what we need to achieve with the rule tile.
Okay.
So this one goes to the top left.
This is the top left.
You see, this is very confusing.
I'm telling you, this is super confusing.
This is not easy to do.
Uh, we're going to drag this one over here.
This is the top left.
And because it is a top left and can be extended to any direction except the top left corner, just
like that.
Yeah, it's working very well.
Now, this is the top right.
This is the top, right?
Let's find it.
Let's add one.
Drag the top right for the top right.
Cannot be extended here but can go like so.
All right again I want to repeat this was achieved through the experiments and good amount of time of
trying.
So if you want to set up others you'll have to do it yourself.
I'm just showing you the system and how it works.
This one will go to the bottom right.
So let's drag it and say that bottom right and can be extended like so.
And one more bottom left is this one.
And cannot be here, but can go to these directions.
Okay.
I hope I'm right.
Yeah.
Now let me show it to you.
So as you can see, it is not perfect.
Even with that, it is not perfect.
So if you want to have some platform that looks good, you need to take this into account how it's made
right?
This one works fine.
But again, if I try to do something like this is not very pretty and this one would be better crafted
manually with the hands, unless you want to do like so.
So there are some limitations, but still a lot of time can be saved with this system.
So maybe it is better to set up the system and sometimes use that.
Sometimes you use that.
There is also a problem.
I know what you're thinking.
You're thinking why would we not just add one of them manually like that and it cannot be done?
This would be sort of a break in the rule.
So you cannot do it like that.
Because for these tiles that were drawn with the rule, this is the alien tile and it interrupts the
system there.
Okay.
Yeah, yeah, maybe it can be done better.
For example, you can extend neighbors and do like a better setup.
But personally I think it would be a bit overkill because level is going to be very simple for this
game, and I don't think I need that super setup to make it work, honestly.
Yeah.
So I'm going to keep the rule.
I'm going to use it later on for some basics layout, maybe like uh, outside parts of the level, but
other than that, I'm not going to really worry about it.
Um, yeah.
Now let's fix the stone one, and let's set up one more real quick.
I'm just going to show you the result over here.
This is how it is here.
You can just pause the video okay.
Now let's go to Assets tile palette.
Let's unclick this one.
Let's go to this one.
Let's lock it.
Let's go back to graphics terrain.
Let's assign this corner over here so we can understand what is it.
And for this one.
Again.
We could set up corners.
Uh, maybe.
Let me try.
Could I try to do that?
Okay, I'm going to try.
I'm going to try because I want you to have it.
Let me take it and draw some platform.
Okay, let me try to do it one more.
This one.
I assume this one is a.
Wait, which is this one?
Let me throw it.
I need to draw it with my hands.
You see, this is super confusing telling you.
So this is the top left.
Okay, let's go and find the top left and do it like so.
Very well.
Now the top right.
This is suitable for the top right.
So let's click plus add.
This is the top, right?
And do it like so.
This would be a bottom left.
I think so.
Let's add one more.
The bottom left.
Okay.
Somewhat.
Okay, I think.
And I kinda like it.
Maybe could be done better.
If you find a better way, let me know.
Why not?
I'm happy to use it.
I'm happy to use, uh, rule of the like the set of the someone who did set up for this.
Okay, but this one works pretty fine, I would say.
So.
I don't really have a reason to be worried about it.
Okay.
I can use it to make levels.
Nice.
The rules for this one are super simple.
They are just the first nine of like you can use this, this and this and this probably.
And use the first nine rules over here to make it work.
The same for this however, you can see they are, I would say pretty naughty.
So you would have to use it just manually by drawing with a brush.
Okay.
Now let me erase this.
Oh let me erase this and let's go to the next video.
I'm going to show you how to make a level just, you know, basic setup that we'll use to test character
enemies and traps.
I'll see you there.