Dungeon Generator: Part 4
What is modularity?
Epic games define modularity as: “modular design is concerned with making lots of high-quality chunks of levels and reusing those chunks intelligently” (Unreal Engine, 2012).
The word modular comes from the module, which is defined in the oxford English dictionary as “each of a set of standardized parts or independent units that can be used to construct a more complex structure, such as an item of furniture or a building” (Lexico, 2019).
In relation to games, modularity is about the creation of assets that can be used repeatedly, by themselves or in combination with other modular assets (Klevestav, n.d.; Burgess & Purkeypile, 2013). Modular assets are 3D pieces that fit together to create easy to assemble 3D game environments. Similarly, to how Lego pieces click together to make larger more complex structures, these assets are usually built to a grid system, and fit together to create more complex environments (Johnstone, 2011; Mader, 2005; Roy, 2013).
Modular assets are becoming increasingly popular both within video game design and VFX production (Roy, 2013) . With advancements in game engine lighting, modelling and texture tools, the practice has become widely adopted as it saves both production time and cost (Burgess & Purkeypile, 2013; Kremers, 2009, pp. 74-75; Mader, 2005; Marcus, 2018; Short & Adams, 2017, pp. 29-41). By taking advantage of the benefits afforded by modular assets, game studios have been able to create larger and more complex environments for a given budget. Examples can be found in these popular game series: Grand Theft Auto, Mass Effect, Skyrim and Halo (Polycount.wiki, 2019).
Modularity and the Designer
As demonstrated in Figure 4.1 and 4.2, modular design for game environments is applied in a variety of forms (Johnstone, 2011) (Burgess & Purkeypile, 2013). Although different modular approaches clearly exist, these approaches are not well defined. Clarity is required in distinguishing the variety of approaches for modularity in design. There are three primary approaches:
• Planar method - The designer uses single-sided uniform modules which are snapped together in a ‘jigsaw’ style, example of this can be seen in Skyrim and Fallout 4 (Polycount.wiki, 2019).
• Box method - The designer incorporates larger intersecting assets with each individual asset featuring a higher level of detail (Polycount.wiki, 2019).
• Hybrid – Building the component planar modules and Assembling Larger assets (Boxes) within the game engine using prefabs or blueprints (Unreal Engine, 2012; Unity Technologies, 2020).
For the dungeon generator project, prototypes of some simple assets will be created using each technique and employed in manual construction of a sample environment. These will be assessed to determine the best fit.
In the 3D modelling module for Level 5 semester 2, I created a set of dungeon tiles that could be used to build an environment (Figure 4.3), these employed the Box method and used a single piece of geometry that represented a segment of the dungeon, this simple set consists of the following:
• End Cap
• Cross roads
• T Junction
Dungeon tiles previously created using the box method were split into their component sections with simple, single-sided geometry.
The advantages of using this technique, were that the designer was able to construct a series of simple models with simple UV maps and associated texture sets. Creating a new variant with a different texture set was easy to achieve. Once these assets were imported into unity, they required assignment of a collision mesh. The corresponding collision shapes were also simple, aiding performance.
The disadvantage to using this planar approach was that placement of the individual elements within the scene under construction was time consuming. For example, to re-create a simple end cap from the Box method required the designer to place 16 objects - a floor, three walls and 8 pillar faces. Using procedural generation, an additional ruleset would therefore need to be created to instruct the game engine how to build each larger component from its constituent elements.
Reusing the box method dungeon set previously created (Figure 4.3), these models were used to manually construct a simple dungeon environment.
The advantage of this technique was that the designer could quickly snap the geometry together within the game engine to create environments quickly. For the dungeon generator this meant a comparatively simpler ruleset would be required. The box method whilst more complex upfront, was found to be very efficient in terms of rendering, due to the object having fewer textures (less draw calls).
The disadvantage of this technique was that the Box models were not very flexible, any variations required new models to be created. Another disadvantage was the relatively complex geometry, which, once imported into the game engine required complex collision. These are computationally expensive and would impact on performance. The final disadvantage was that the UV unwrapping and textures were complex in comparison to the planar models. Each model had its own unique UV map and texture set. It would take additional work to create new texture variations, as the designer must ensure that a consistent Texel density has been applied for all components of the set. This would ensure that the textures looked seamless when the set was snapped together.
The hybrid approach created smaller solid objects that made up the components of each of the dungeon segments, for example a corner segment formed of 1 floor, 4 pillars and 2 walls (Figure 4.4). These were then combined within the game engine using a templating technique in this case Unity Prefab.
The advantages of this technique, as with the Planar technique, is that the UV maps and associated texture sets were still relatively simple, therefore the designer could create new variations quickly. Another advantage of creating smaller solid objects, the corresponding collision meshes were also simple 3D primitives which helped with performance. These 3D assets could be re-used as standalone components within the wider scene to add additional variation.
Unity’s Prefab system allowed the designer to create, configure, and store a GameObject complete with all its components, property values, and child GameObjects as a reusable Asset. This Prefab Asset acted as a template from which it is possible to create new Prefab instances in the Scene.
Conclusion and Results
Following experimentation with each of these techniques, it was concluded that the hybrid model is the best fit. Having the relatively simple individual elements affords the following advantages for the designer or programmer:
• Smaller elements are easier to model, variations can be made to help break up the feeling of repetition within the scene.
• The simpler models have simpler UV maps and are easier to texture.
• Texture variations are easier to create for applying a new look.
• Texel density can more easily be kept consistent between components.
• New textures can be added to Prefab variants and allow the designer to quickly create new dungeons with unique looks.
For example: let's imagine we a designer wishes to change the look of the floor tiles this will require the following:
- Texture maps: Diffuse, Normal, Specular, Rougness for each model.
- Models: Corner, Straight, T-Junction, Crossroads, Deadend.
- 20 new textures required.
- Texture maps: Diffuse, Normal, Specular, Rougness for each model
- Models: Floor
- 4 new textures required.
It has been shown that the hybrid method using inheritance through modular construction allows for much faster development of variations. In the same development time, 5 new floor textures for hybrid instead of 1 for box could be created
Burgess, J. & Purkeypile, N. (2013). Skyrim’s Modular Approach to Level Design. Available at: http://blog.joelburgess.com/2013/04/skyrims-modular-level-design-gdc-2013.html (Accessed: 03 October 2019).
Johnstone, K. (2011). Modular Environment Design. Raleigh, North Carolina, Epic Games.
Klevestav, P. (n.d). Working With Modular Sets. Available at: http://www.philipk.net/tutorials/modular_sets/modular_sets.html (Accessed: 29 October 2019).
Kremers, R. (2009). Level Design : Concept, Theory, and Practice. Boca Raton: A K Peters.
Lexico (2019). Meaning of module in English. Available at: https://www.lexico.com/definition/module (Accessed: 06 November 2019).
Mader, P. (2005). Creating Modular Game Art For Fast Level Design. Available at: https://www.gamasutra.com/view/feature/130885/creating_modular_game_art_for_fast_.php (Accessed: 15 January 2020).
Marcus, M. (2018). Modular Concepts for Game and Virtual Reality Assets. Available at: https://software.intel.com/en-us/articles/modular-concepts-for-game-and-virtual-reality-assets (Accessed: 05 December 2019).
Polycount.wiki (2019). Modular environments. Available at: http://wiki.polycount.com/wiki/Modular_environments (Accessed: 03 October 2019).
Roy, K. (2013). Copy and Paste Your Universe: Creating and Implementing Modular 3D Environments. Available at: https://www.autodesk.com/autodesk-university/class/Copy-and-Paste-Your-Universe-Creating-and-Implementing-Modular-3D-Environments-2013#video (Accessed: 05 December 2019).
Short, T. X. & Adams, T. (2017). Procedural Generation in Game Design. Boca Raton, Florida: CRC Press LLC.
Unity Technologies (2020). Prefabs. Available at: https://docs.unity3d.com/Manual/Prefabs.html (Accessed: 21 April 2020).
Unreal Engine (2012). Using Workflow Techniques and Modularity. Available at: https://docs.unrealengine.com/udk/Two/WorkflowAndModularity.html (Accessed: 03 October 2019).