Mastering Unity 2017 Game Development with C#(Second Edition)
上QQ阅读APP看书,第一时间看更新

Level building - Modular construction sets

Now the fun begins, though it's logistically challenging: the process of level building. Our aim is to build a fun and interesting level, but this must be balanced against many factors, including level size, ease of navigation, variety, and more. Creating a level is challenging because misplaced or poorly designed elements stand out for their failings. They break the player's experience. Decisions about architecture and where to include straight sections, turns, jumps, ledges, props, and doors collectively influence the atmosphere and mood of a level. Here, we'll focus on the modular building method, piecing together an expansive level from reusable pieces, exploring reasons and justifications for our choices along the way. However, let's first see the modular set in its entirety, that is, the complete collection of architectural meshes from which the level must be constructed:

Modular set for level construction

Each mesh is a modular piece (or module). This means each piece is designed to fit seamlessly at the edges with any other piece, in terms of both mesh topology and texture. This allows all the pieces to be combined and recombined in potentially an infinite number of ways to create any kind of level arrangement. The available modules are as follows:

  • section_Straight: This is a straight-run mesh for a corridor with open ends. It can be repeated and tiled many times, one after the other at the end vertices, to create a straight corridor of any length:
Straight section
  • section_End: This is a straight section piece with a capped end, representing a wall, preventing the player from passing through. This is useful for creating dead-ends. In our case, the piece is a straightforward dead-end, but your own dead-ends need not be so utilitarian. Dead-ends in a modular set come in many forms: broken pipes, fallen debris, toxic gas clouds, wooden boards, plasma barriers, and others:
Dead end section
  • section_T: This piece is formed by the intersection of two straight sections; specifically, by the end of one straight section intersecting with the middle of another. This section presents the player with three possible choices or ways to move:
T-section
  • section_Corner: The corner section is, essentially, an L-formation. It's the intersection of two straight sections meeting at the ends, and it allows the player to change direction by 90 degrees:
Corner section
  • section_Cross: The cross section is the intersection of two straights in the middle, allowing potentially four directions of travel. Like all the other sections, the cross tiles meet seamlessly with all the other modular meshes:
Cross section
  • section_Curve: The curve section is largely an aesthetic module. So far, it achieves exactly the same purpose as the corner section, and thus is functionally unnecessary, but it looks and feels different. The curve creates a different mood and feeling. With a sharper 90-degree turn, there is an additional suspense and dread, as the player loses sight of what lurks around the corner, if anything. In contrast, the curve invites travel, it shapes itself in the direction of travel, and continually allows the same horizon of view for the length of the curve section:
Curved section