Sick Gaming
News - Blog: Procedural map generation in The Riftbreaker - Printable Version

+- Sick Gaming (https://www.sickgaming.net)
+-- Forum: Sick Gaming Community (https://www.sickgaming.net/forum-1.html)
+--- Forum: Lounge (https://www.sickgaming.net/forum-8.html)
+--- Thread: News - Blog: Procedural map generation in The Riftbreaker (/thread-97242.html)



News - Blog: Procedural map generation in The Riftbreaker - xSicKxBot - 09-14-2020

Blog: Procedural map generation in The Riftbreaker

<div style="margin: 5px 5% 10px 5%;"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker.png" width="243" height="77" title="" alt="" /></div><div><p> <!-- Google Tag Manager --> <!-- End Google Tag Manager --> &lt;!– –&gt; <title>Gamasutra: Piotr Bomak’s Blog – Systematic Chaos – Procedural Map Generation in The Riftbreaker</title> <!--[if lt IE 9]&gt; <a href="http://html5shim.googlecode.com/svn/trunk/html5.js">http://html5shim.googlecode.com/svn/trunk/html5.js</a> &lt;![endif]--> <!-- CSS --> <!-- link href="https://twimgs.com/gamasutra/css/minified.css" rel="stylesheet" type="text/css" / --> <!-- Mobile Specific Metas --> <!-- Start Visual Website Optimizer Asynchronous Code --> <!-- End Visual Website Optimizer Asynchronous Code --> <!-- Start HeatMap.me Code --> <!-- End HeatMap.me Code --> <!-- Start: GPT Sync --> <!-- End: GPT --> <!-- Eloqua tracking code --> <!-- End Eloqua tracking code --> <!-- Google Tag Manager (noscript) --> <!-- End Google Tag Manager (noscript) --> <!--Cookie banner code starts here --> <!--Cookie banner code ends here --> <!-- Informa Branding code goes here--> </p>
<div id="iribbon-container" class="content-body-wrapper"> <button id="iribbon-title" title="show/hide" class="inactive">Informa</button> </p>
<div id="iribbon-detail" class="ribbon-hide">
<div id="iribbon-left">
<p>Gamasutra is part of the Informa Tech Division of Informa PLC</p>
</p></div>
<div id="iribbon-right">
<p>This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC’s registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.</p>
</p></div>
</p></div>
</p></div>
<p> <!-- Informa Branding code goes here--> <!-- Beginning Sync AdSlot 19 for Ad unit Gamasutra//consolepc ### size: [[2,2]] --> <!-- End AdSlot 19 --> <!-- Beginning Sync AdSlot 20 for Ad unit Gamasutra//consolepc ### size: [[7,7]] --> <!-- End AdSlot 20 --> </p>
<div class="container">
<div id="container-main" class="content-body-wrapper"> <!-- Google Prestitial Ads start here--> <!-- Google Prestitial Ads end here--> </p>
<div class="container bottom3">
<div class="span-7"> <a href="https://www.gamasutra.com"><img loading="lazy" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker.png" alt="Gamasutra: The Art &amp; Business of Making Games" width="243" height="77" border="0"></a><img alt="spacer" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker.gif" width="27"> </div>
</p></div>
<div class="span-20"> <!--end show phone--> <!--end showphone--> <!--end nav--> </p>
<div class="span-20 last content_bg">
<div class="hide-phone">
<div class="span-4">
<div class="content_box_left">
<div class="leftcol"> <!--member login--> <!--end memberlogin--> <!--begin social icons--> <!--begin social icons--> <!--end social icons--> <!--end social icons--> <!--begin page numbers--> <!--end page numbers--> <!--begin leftnav--> <!--end leftnav--> <!-- Beginning Sync AdSlot 3 for Ad unit Gamasutra//consolepc ### size: [[164,59]] --> <!-- End AdSlot 3 --> <!-- Beginning Sync AdSlot 4 for Ad unit Gamasutra//consolepc ### size: [[164,59]] --> <!-- End AdSlot 4 --> <!-- Beginning Sync AdSlot 5 for Ad unit Gamasutra//consolepc ### size: [[164,409]] --> <!-- End AdSlot 5 --> <!-- Beginning Sync AdSlot 9 for Ad unit Gamasutra//consolepc ### size: [[164,177]] --> <!-- End AdSlot 9 --> <!-- Beginning Sync AdSlot 11 for Ad unit Gamasutra//consolepc ### size: [[164,177]] --> <!-- End AdSlot 11 --> <!-- begin event tickers --> <!-- end event tickers --> <!--begin jobs--> <!--end jobs--> <!--begin blogs--> <!--end blogs--> <!--begin press releases--> <!--end press releases--> <!--begin calendar--> &lt;!– </p>
<div class="header"><img loading="lazy" alt="arrow" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-1.png" width="22px" height="20px" /><a href="http://www.gamasutra.com/calendar/calendar.php">Calendar</a></div>
<div class="leftnav bottom2"> <a href="http://www.gamasutra.com/calendar/calendar.php"><strong>View All</strong></a> &nbsp;&nbsp;&nbsp; <a href="http://www.gamasutra.com/calendar/calendar_submit.php"><strong>Submit Event</strong></a> </p>
<hr>
<ul> </ul>
</div>
<p> –&gt; <!--end calendar--> <!--begin about--> </p>
<div class="bottom2"> <a href="https://www.gamasutra.com/advertise"> <img loading="lazy" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker.jpg" alt="Sponsor" border="0" class="whiteTop" width="177px" height="60px"> </a>
</div>
<p> <!--end about--> <!--begin network--> </p>
<div class="leftnav_network bottom2"> If you enjoy reading this site, you might also want to check out these UBM Tech sites: </p>
<hr>
<hr>
<p> <br class="clear">
</div>
<p> <!--end network--> <!--begin store--> <!--end store--> </div>
<p><!--end leftcol--> </div>
</div></div>
<div class="span-16 last">
<div class="content_box_middle"> <!-- InstanceBeginEditable name="BodyContent" --> </p>
<div class="page_item">
<div><a name="twitter_share" href="http://twitter.com?status=RT @gamasutra: Systematic Chaos - Procedural Map Generation in The Riftbreaker http://www.gamasutra.com/blogs/PiotrBomak/20200910/369772/" target="_blank" rel="noopener noreferrer"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-1.gif" alt="Share on Twitter" border="0" height="20"></a> <span id="edit_post_link"></span>&nbsp;&nbsp; <a href="https://www.gamasutra.com/blogs/rss/"><img loading="lazy" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-2.gif" width="15" height="15" border="0" alt="RSS"></a> </div>
<hr>
<div class="item_body mobile_image_transform"> <strong><i><small> The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.<br />The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company. </small></i></strong> </p>
<hr>
<p>The Riftbreaker is a game that is heavily influenced by various genres. The base-building and base defense aspects of the game bring back memories of both classic and modern real-time strategy games. Looting and crafting systems resemble those known from action-RPG titles. Dynamic weather, time of day, and unique biomes are all valuable parts of games focused on exploration and survival. What connects all those genres is the fact that their gameplay benefits strongly from map variety.&nbsp;</p>
<p>[embedded content]<strong><em>Our latest base-building trailer shows off a variety of biomes and locations within them.</em></strong></p>
<p>The Riftbreaker’s&nbsp;main advantage is that no&nbsp;two play sessions are ever the same. Even though you know what to expect, the exact details of each mission have to be discovered by the player every time they start a new game.&nbsp;The only way to achieve that sort of variety is through procedural map generation. This feature has always been one of the design pillars of The Riftbreaker and one of the most significant tasks for the entire project. The game uses our own engine, The Schmetterling, which also powered our previous projects, Zombie Driver and X-Morph: Defense. However, those games used pre-designed, fixed levels. In this article, we will tell you about the world generation system that we came up with for The Riftbreaker.</p>
<p>The map generation process is carried out before each new Survival Mode playthrough. The premise of this mode is for every session to be a standalone experience, and a procedurally generated world helps a great deal with that. The process is split into a couple of phases – let’s take a look at each of them.</p>
<h2>Biome randomization</h2>
<p>The process begins with the choice of biome by the user. For the player, the choice of biome will affect the types of creatures they are going to encounter, the pool of available dynamic weather events, as well as the availability of resources and the overall look and feel of the play area. For the game itself, however, the biome defines a set of overarching parameters that will affect the world generation process. Every biome preset in The Riftbreaker contains information on the lighting parameters, the skybox, and its properties, as well as a set of materials to be used as the base textures for the terrain. Biomes also define what tiles are available for the game to use when generating the map.</p>
<p><strong id="docs-internal-guid-20f3a11f-7fff-6108-0b15-67436fcf83ed"><img loading="lazy" height="594" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-2.png" width="344"></strong><br /><strong><em>Sample choice of textures for the jungle biome.<br /><a href="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-1.jpg"><img loading="lazy" alt height="360" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-1.jpg" width="640"></a><br />Snippets from the various biomes players will visit during the campaign: jungle, desert, acid and magma.</em></strong></p>
<p>Biomes do not have a ‘fixed’ configuration, meaning that two ‘jungle biome’ maps can look very different from one another. We achieve that thanks to biome randomization. Instead of giving the game a set of properties it has to use, we give it a pre-configured set of options to randomize from. As a result, it is highly unlikely that the game will choose a set of identical materials, skyboxes, and lighting for any given two playthroughs. While still pre-defined by our designers, mixing and matching the biome properties introduces a little bit of variety into the world generation right from the start.</p>
<h2>Tile creation</h2>
<p>After all the biome parameters have been selected, the algorithm begins to perform the first operations on the tiles. Tiles are our basic building blocks for map generation in The Riftbreaker. They are the smallest editable chunks that our level designers prepare manually. Their minimum size is 128×128 meters (or 64×64 in-game grids. Each grid in our game is a 2x2m square). Tiles need to meet some basic criteria before they are ready to be put into the game. However, these requirements are easy to meet and they can be fulfilled in some creative ways so that they don’t limit the designers’ freedom.&nbsp;</p>
<p><a href="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-3.gif"><img loading="lazy" align="left" alt height="360" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-3.gif" width="640"></a></p>
<p>&nbsp;</p>
<p><strong><em>The designer of the tile only has to cover the terrain with a couple of types of masks. The textures will be randomly chosen from the available set.</em></strong></p>
<p>One such requirement&nbsp;is masking the surface with terrain blends. The surface area can be covered by one of three global materials – for simplicity’s sake let’s name them A, B, and C – the ones that were selected in the biome randomization process. Designers do not choose the materials, they simply designate zones that the game will cover using material set A (e.g. sandy textures), material set B (e.g. grassy terrain), and material set C (e.g. rocky bedding). It is also possible to paint an area with a real texture instead. In that case, the randomization process will not affect it.&nbsp;</p>
<p><a href="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-4.gif"><img loading="lazy" alt height="360" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-4.gif" width="640"></a><strong><em>If the designer chooses to use a regular texture instead of a mask, that area will not be affected by the randomization process. It’s useful for adding details beneath props.</em></strong></p>
<p>After that, the creator of the map can start placing spawn points for the game logic elements. They decide where the player can possibly start their journey, the resource placement (and their&nbsp;variety), as well as all the NPCs that will fill the game world.</p>
<h2>Prefab randomization</h2>
<p><a href="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-5.gif"><img loading="lazy" alt height="360" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-5.gif" width="640"></a><strong><em>Here you can see exactly what area has been marked to be replaced by prefabs, as well as which props have been placed automatically.</em></strong></p>
<p>An additional element of randomness that we decided to incorporate into the world generation algorithms for The Riftbreaker are so-called prefabs. In our case, a prefab is a special handcrafted scene, that is filled with various props by a designer. Their purpose is to fill the blank spaces of the map tiles left by designers and marked to be masked by prefabs. In other words – prefabs lie underneath the regular tiles and pop up wherever there is a window left for them to do so, filling the area with props in a randomized way without the need for any additional human input.</p>
<p><a href="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-6.gif"><img loading="lazy" alt height="360" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-6.gif" width="640"></a><strong><em>Painting with prefab mask allows you to get a unique-looking tile in no time.</em></strong></p>
<p>The designer chooses which of the pre-made prefab scenes they would like to be used on their new tile.&nbsp;Every prefab has its own mask, and the designer decides where they would like to use it. Props from the predefined scene will then fill the masked area. When the map is being generated the&nbsp;positioning and orientation of the prefabs are chosen at random. Then, several copies of the prefab scenes&nbsp;are stitched together to lie underneath the entire area of the game world. This way, we can be sure that regardless of the area designated by the creator&nbsp;the prefab mask will be able to fill the area marked by the designer with props. Slight differences in positioning, orientation, and prefab choice can drastically change the feeling of the tile.</p>
<p><a href="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-7.gif"><img loading="lazy" alt height="381" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-7.gif" width="640"></a><strong><em>Several variants of prefab scenes. They are jam-packed with props so that they can do their job regardless of where they get positioned.</em></strong></p>
<p><strong><em><a href="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-8.gif"><img loading="lazy" alt height="383" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-8.gif" width="640"></a>This is the same map. The only thing that changes is the generator seed for the prefab randomization. The effects of that range from very subtle to completely unrecognizable.&nbsp;</em></strong></p>
<h2>Tiled map generation</h2>
<p>Now that the tiles have been randomized it is time to generate the map. The game checks how big the map should be – we support various map sizes, from single-tile ones to behemoths of 12×12 tiles. The current, builds of The Riftbreaker generate 5×5 maps for Survival Mode and varied sizes for Campaign mode. The size of the map affects both gameplay choices and engine performance. Exploration missions in the campaign require larger playable areas while base&nbsp;defense objectives can fit into smaller worlds for more streamlined gameplay.</p>
<p>The designer should also&nbsp;assign information to each edge of the a&nbsp;for matching purposes. Tiles will only be connected to each other if their sides match, preventing connection errors. The tile randomization process chooses which tiles are going to be used for map generation, which of the spawn points are going to be used, and how tiles are going to be rotated (we support rotations of 0, 90, 180, and 270 degrees). Tiles may repeat during the map generation process and they may vary in properties between instances.&nbsp;</p>
<p>The game world is generated by solving a version of the ‘Wang tile problem’. You can read about this concept <a href="https://en.wikipedia.org/wiki/Wang_tile">here</a>. In the original problem, the colored sides of the tiles have to match each other without performing any rotations. Our case is simplified a little since we allow for rotations, however, neighboring tiles still have to match each other when it comes to sides. It takes quite a bit of gymnastics to make it all work, but the resulting number of combinations is very high.&nbsp;</p>
<p><a href="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-9.gif"><img loading="lazy" alt height="360" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-9.gif" width="640"></a><strong><em>It is possible to add more surface area for your work. The game will still treat is as one tile, keep the entire creation in one piece and fit it with other tiles during map generation. It allows the designers to create multi-tile structures, like mountain ranges or canyons.</em></strong></p>
<p>It is worth mentioning that not all tiles need to be 128×128 meter squares. We support combinations of several ‘base’ tiles as well to support unique structures spanning over several tiles, such as massive rock formations, large lakes, or rivers. If a special tile structure like this is chosen to be part of the generated world it is put on the map in its entirety to preserve the continuity of the props prepared by the designers. The surrounding area is then filled with randomized tiles as usual.</p>
<h2>Resource and Player Spawn Point Randomization</h2>
<p>Finally, after the algorithm has generated the map through all the steps described above, we can move on to the distribution of resources. Each mission in The Riftbreaker defines what kind of resources should be made available to the player. However, it only specifies the amounts of resources to be available during the mission, not their localization. That is randomized again. The game chooses possible spawn points for resource deposits and distributes them according to a relevant ruleset.&nbsp;</p>
<p><strong id="docs-internal-guid-faaf0d31-7fff-259c-4215-49334287ee09"><img loading="lazy" height="787" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-3.png" width="446"></strong></p>
<p><strong><em>An example of the ruleset for resource distribution. All game modes and maps require their own rulesets to vary and balance the gameplay experience.</em></strong></p>
<p>Once a resource spawn point is chosen by the algorithm, the process is rather straightforward. The resource type is chosen, followed by the ‘density’ of the deposit – the amount of resources that will be available for the player to use. That value is a simple roll between the minimum and maximum values defined in the mission logic file. Then, the game tries to determine the center of the resource deposit. The field will be the richest towards the center, which will be represented by a different physical model for easy visual identification.</p>
<p><strong id="docs-internal-guid-7d5a7f7a-7fff-9442-68d1-48739f4faa37"><img loading="lazy" height="603" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-4.png" width="602"><em>Resources can spawn in the area marked with red. The game will determine the center of the resource deposit, its yield, and then adjust the mesh accordingly.</em></strong></p>
<p>Once all the resources have been distributed, the game checks all the player spawn points and chooses the one which is the closest to the minimum basic resources necessary for the player. Once such a place is determined, the player can finally start the game.&nbsp;</p>
<p>We are happy with the map generation system that we developed for The Riftbreaker. It allows us to introduce a lot of variety to the game world in relatively short time. Adding even a couple of new tiles to the biome pool makes for an interesting experience for both new and returning players. Add randomized prefabs giving the map tiles a slightly different look and feel every time, and you have a solid foundation to build the game on.&nbsp;</p>
<p>The current state of the system is very functional, but it can still be improved with plenty of useful features to make the game world more realistic. We are working on dynamic NPC placement that will adapt&nbsp;according to the biome, the chosen difficulty level, time of day, as well as the player’s progress in the game. With such a system in place The Riftbreaker will become a game that encourages dynamic decision making and adjusting to the conditions, rather than learning the exact procedure&nbsp;needed to complete each mission.&nbsp;</p>
<p>That is all we have for you today. If you have any questions, feel free to post them in the comment section or catch us directly on our Discord server: <a href="http://www.discord.gg/exorstudios">www.discord.gg/exorstudios</a>.&nbsp;</p>
<p>See you next time!<br />EXOR Studios</p>
</p></div>
<hr>
<div class="hide-phone">
<h3>Related Jobs</h3>
<div class="stories_item">
<div class="thumb"><a href="https://jobs.gamasutra.com/job/camera-designer-agoura-hills-california-34540"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-5.png" alt="Visual Concepts" width="120"></a></div>
<div class="title"> <strong> Visual Concepts — Agoura Hills, California, United States <br />[09.11.20] </strong> <br /><a href="https://jobs.gamasutra.com/job/camera-designer-agoura-hills-california-34540">Camera Designer</a> </div>
</p></div>
<div class="stories_item">
<div class="thumb"><a href="https://jobs.gamasutra.com/job/senior-gameplay-designer-world-systems-espoo-34520"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-10.gif" alt="Remedy Entertainment" width="120"></a></div>
</p></div>
<div class="stories_item">
<div class="thumb"><a href="https://jobs.gamasutra.com/job/senior-gameplay-designer-combat-espoo-34519"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-10.gif" alt="Remedy Entertainment" width="120"></a></div>
</p></div>
<div class="stories_item">
<div class="thumb"><a href="https://jobs.gamasutra.com/job/senior-cinematic-scripter-espoo-34551"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-10.gif" alt="Remedy Entertainment" width="120"></a></div>
</p></div>
</p></div>
<hr></div>
<p> <!-- InstanceEndEditable --> </div>
<p><!--end contentbox-->
</div>
<p><!--end span-16--> </div>
<p> <br class="clear"> </div>
<p><!--end span-21--> <!--begin right sidebar--> <!--end right sidebar--> &lt;!– </div>
<p> Extra Div –&gt; <!-- Beginning Sync AdSlot 21 for Ad unit Gamasutra//consolepc ### size: [[8,2]] --> <!-- End AdSlot 21 --> <!-- Beginning Sync AdSlot 22 for Ad unit Gamasutra//consolepc ### size: [[8,4]] --> <!-- End AdSlot 22 --> <!-- Beginning Sync AdSlot 23 for Ad unit Gamasutra//consolepc ### size: [[4,4]] --> <!-- End AdSlot 23 --> <br class="clear"></p></div>
<p><!--end content-body-wrapper--> </div>
<p><!--end container--><br />
<!--begin footer--> <!--end footer--> <!-- SiteCatalyst code version: H.21.
Copyright 1996-2010 Adobe, Inc. All Rights Reserved
More info available at http://www.omniture.com --> <a href="http://www.omniture.com" title="Web Analytics"><img loading="lazy" src="https://www.sickgaming.net/blog/wp-content/uploads/2020/09/blog-procedural-map-generation-in-the-riftbreaker-11.gif" height="1" width="1" border="0" alt></a><!--/DO NOT REMOVE/--><br />
<!-- End SiteCatalyst code version: H.21. --> <!-- Begin ADSNATIVE Code --> <!-- End ADSNATIVE Code --> <!--Begin Ad script for pixel --> <!--END Ad script for pixel --></p>
</div>


https://www.sickgaming.net/blog/2020/09/11/blog-procedural-map-generation-in-the-riftbreaker/