Procedural Generation of 3D Caves for Games on the GPU Mark, Benjamin
Total Page:16
File Type:pdf, Size:1020Kb
Procedural Generation of 3D Caves for Games on the GPU Mark, Benjamin; Berechet, Tudor; Mahlmann, Tobias; Togelius, Julian 2015 Link to publication Citation for published version (APA): Mark, B., Berechet, T., Mahlmann, T., & Togelius, J. (2015). Procedural Generation of 3D Caves for Games on the GPU. Paper presented at Foundations of Digital Games, United States. Total number of authors: 4 General rights Unless other specific re-use rights are stated the following general rights apply: Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights. • Users may download and print one copy of any publication from the public portal for the purpose of private study or research. • You may not further distribute the material or use it for any profit-making activity or commercial gain • You may freely distribute the URL identifying the publication in the public portal Read more about Creative commons licenses: https://creativecommons.org/licenses/ Take down policy If you believe that this document breaches copyright please contact us providing details, and we will remove access to the work immediately and investigate your claim. LUND UNIVERSITY PO Box 117 221 00 Lund +46 46-222 00 00 Procedural Generation of 3D Caves for Games on the GPU Benjamin Mark Tudor Berechet ITU Copenhagen ITU Copenhagen [email protected] [email protected] Tobias Mahlmann Julian Togelius Lund University NY University [email protected] [email protected] ABSTRACT Here, we normally distinguish between offline (while the Procedural Content Generation in Games (PCG) is a thriv- game is being developed) and online (while the game is be- ing field of research and application. Recent presented ex- ing played) content generation. While the offline creation amples range from levels, stories and race tracks to complete often allows more control over \what" procedural content rulesets for games. However, there is not much research to makes it into the game, online creation augments the game date on procedural 3D modeling of caves, and similar en- with a wider variety of game content, adding replayability to closed natural spaces. In this paper, we present a modular the game, and offers the opportunity to make the creation pipeline to procedurally generate underground caves in real- process adaptive to the gameplay. time, to be used as part of larger landscapes in game worlds. A special case of landscapes are underground worlds, i.e. We propose a three step approach, which can be fully im- caverns. While most our actual lives happen overground, it plemented using General-Purpose Computing on Graphics is surprising how many plots in literature, film, and espe- Processing (GPGPU) technology: 1) an L-System to em- cially games take place in underground locations. Under- ulate the expanded cracks and passages which form cave ground cities, cavernous dungeons, or \the cave behind the structures in nature, 2) a noise-perturbed metaball approach waterfall" are common tropes, especially in the role-playing for virtual 3D carving, and 3) a rendering component for game genre. Recent notable examples, which make promi- isosurface extraction of the modeled voxel data, and fur- nent use of caves, are Skyrim and Dragon Age 2. These ther mesh enhancement through shader programming. We games feature a range of caves, crafted by a human a de- demonstrate how the interaction between these components signer, which are being re-used as dungeons or hideouts produce results comparable to real world caves, and show throughout the game world. that the solution is viable for video game environments. For Though there have been notable publications concerning this, we present the findings of a user study we conducted the procedural generation of 3D geometry (including land- among indie-game developers and players, using our results. scapes), and also of maze-like angular environments (\dun- geons") [23], little attention has been given to generating caves as game content. There are important reasons for in- 1. INTRODUCTION cluding runtime generation of life-like caves in games, in par- Nearly every game contains some sort of landscape. Some- ticular introducing variety. Reusing caves or parts of caves times it is an integral and functionally crucial part of game- puts a strain on the suspension of disbelief of the player. play, constraining and affording player action. Other times While the creation of a larger variety of caves by human de- it is mere backdrop, or something in between. Large and signers is clearly possible, this would raise production time costly efforts are therefore made during game production to and cost significantly. Instead, we propose an algorithmic provide believable, functional and enjoyable environments solution to this problem, providing an easy method for game for the player. makers to enrich their game worlds with a large variety of The automatic generation of landscapes is relatively well- believable and interesting caves. studied within procedural content generation (PCG). PCG In this paper, we address the procedural generation of refers to the algorithmic creation of game content with no or caves as part of a game world. In contrast to mimicking little human input; game content here could mean anything actual caves with all their properties and details, we focus that is not part of the game engine itself, textures, levels, on providing \believable" caves in the context of games, i.e. characters and stories, or the rules of the game itself [24]. caves are believable as long as they \work" in a game, which in return is not that afar from actual caves. Our generated caves can stand as a game world on their own or be inte- grated into a larger context. In the following, we will outline Permission to make digital or hard copies of all or part of this work for in more detail the paradigms after which our caves are gen- personal or classroom use is granted without fee provided that copies are erated, and then present our methodology in the following. not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to We will conclude this paper with presenting our findings and republish, to post on servers or to redistribute to lists, requires prior specific discussing the implications of our result. permission and/or a fee. FDG ’15 Pacific Grove, CA USA 1.1 Design choices Copyright 2015 ACM X-XXXXX-XX-X/XX/XX ...$15.00. When approaching a PCG task, there are several prop- erties to consider. From a recently proposed model for as- sessing content generators [26], we would like to discuss a relevant subset of properties for our solution. We choose be- lievability and expressivity over reliability, i.e. we consider a wider range of caves, which don't break the immersion of the game, more desirable than hard constraints of control on the generator. The challenge therefore is to balance the procedures such that the results remain visually coherent and never cease to suspend disbelief in the portrayed envi- ronment. Artificial and \weird" shapes will exist and may be even desired, as long as they do not break the immersion. To maintain believability we will attempt to constrain the generator to a spectrum of shapes identified from a set of natural phenomena, which will be described in more detail in section 2.1. Despite our focus on believability and expressivity, speed and controllability are also important to some degree. While very quick generation of caves is not required per se, online generation would require a high computational efficiency to produce the cave environment faster than the player can explore it. Furthermore, as not all types and shapes of caves are fit for every game environment, it is desirable to be able to tweak various parameters of the generation process to achieve just the style of cave that fits a specific application and style. Figure 1: Common natural cave patterns [2, 20] 2. RELATED WORK As we try to generate \believable" caves, it seems natural to review literature regarding the actual generation (in na- ture) of caves. Furthermore, we would like to set our work into context of previous attempts of 3D terrain generation. 2.1 Natural Caves As mentioned in the introduction, one of our main goals is the creation of believable caves for games. Here, \believable" refers to a resemblance of natural caves, so that the player accepts the game world as \natural" in the context of the Figure 2: Front view slice of the main types of passages game they are playing. It is useful to compare the method we found in caves [7]. propose here with the features that compose a natural cave, and the processes by which natural caves develop. While it is beyond the scope of this paper to representatively survey the stalactites are accumulations of material through water drip- geological literature on caves, we would like to mention on pings that grow over time from cave ceilings or floors. For a two phenomena here: the creation of passageways in cracks, more thorough description, please refer to [10]. and the creation of stalagmites and stalactites. While a general introduction into the creation of Phreatic- 2.2 3D Terrain Generation and Vadose-passages can be found in [3], we would like to mention the work by Boggus and Crawfis [2]. The authors In contrast to 3D cave generation, the generation of 3D presented a method to procedurally create caves that real- landscapes and flora is a well-studied problem.