Join Dan Violet Sagmiller for an in-depth discussion in this video Techniques for seamless tiles, part of Unity 5 2D: Generate Procedural Terrain.
- So now we're gonna start working with graphics, trying to make the graphics look better for the game and much more rich interaction. Well, you could work with tiles. Tiles are a very common way to do this. For instance, this is an example of water and grass. When you're connecting the two sets of tiles, you get to control every way that the transition occurs. How the waves land, are there rocks in between it. How is that gonna show? It's straightforward. What you see is exactly what you're gonna get on your screen. So what does it take to actually build these? Well, this is actually nine separate images.
You have the water, but then you have how does it border and connect to other tiles. So for instance, we're controlling multiple corners. We have to create custom graphics for every corner and every aspect of how they connect. So, to make water and grass connect, we actually have to have nine tiles for the water to connect to grass, and another nine tiles, or at least eight more tiles, to connect the grass back to the water. So, every time that you add images such as another dirt section, now you need more graphics.
So now I have to create eight more of these images to connect the grass to the dirt. So what happens if you have several different types of textures meet on one tile? Such as grass, dirt, and dark grass. Well, in most tile systems you can't do that. How about water, sand, stone, road, et cetera? There's a lot of these things. If you do that, so the system supports it, you have to create custom images for every single potential connection where you have multiple types of terrain on the same tile. Or at least edges on the same tile.
And you have to produce combinations for all of that. From your code, when you're selecting textures, you're gonna have to understand four different tiles at once. What's the tile above me? What's the tile to the left? What's the tile to different angles? And you're gonna have to manage those all in your code, you're gonna have to manage those all in your file system. Below here, you can see all the combinations for just grass and dirt to get those two to work together. It's a lot. So what kind of shortcuts can you take to make it a little faster? Well, a lot of terrain systems and tile sets will choose a default terrain, such as grass or dirt.
And then, every other terrain will connect by that type. It borders up to grass or dirt, which means that you can't have your water connect directly to the sand. You can't have your water connect directly to the dirt, if grass is your default. You're gonna have to have it go from water to dirt to sand, just because that's the way your graphics are laid out. Now, a lot of games do that and it's very easy to get by with, and people still tend to enjoy the experience. So we've taken a look at tile sets, and while they do look awesome, they do take a lot of work.
As we progress through this course, we're going to take a look at a different way to work with the graphics that is fast and easy to create, and also generates very realistic and rich terrains.
- Tiling images
- Controlling randomization and noise
- Moving and redrawing maps
- Creating smooth tile connections
- Animating terrain
- Adding a building layer
- Adding cities
- Making buildings
- Generating multi-part structures
- Saving and loading terrain