{"id":209,"date":"2019-10-15T09:17:50","date_gmt":"2019-10-15T07:17:50","guid":{"rendered":"http:\/\/galactic-overbears.eu\/?p=209"},"modified":"2019-10-17T16:40:50","modified_gmt":"2019-10-17T14:40:50","slug":"sci-fi-map-generator","status":"publish","type":"post","link":"https:\/\/galactic-overbears.eu\/index.php\/2019\/10\/15\/sci-fi-map-generator\/","title":{"rendered":"Sci-Fi Map Generator"},"content":{"rendered":"\n<p>The project goal is to create a corridor base map generator. It will be capable of creating a complex procedural map with still the possibility to edit manually. <\/p>\n\n\n\n<p>The idea came from playing Warframe and creating a 2D platformer map generator. I tried to figure out a way to generate a full procedural map out of rooms and hallway in 3D.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_10.gif\" alt=\"\" class=\"wp-image-210\" width=\"333\" height=\"330\"\/><figcaption>Creating a 2D Dungeon Map<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"821\" height=\"511\" src=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/warframe-map.gif\" alt=\"\" class=\"wp-image-228\"\/><figcaption>On Warframe you can see links between the different rooms\/sections<br><em>(Waframe is a Digital Extremes game)<\/em><\/figcaption><\/figure>\n\n\n\n<p>I started by listing the different room format I wanted. In my project, I set up Rooms and Hallways. The rooms can have multiple doors, but most only have one, they should be larger than hallways. The hallways are strait, corner, T shape, cross shape, long, short or curved.<\/p>\n\n\n\n<p>The process I planed is creating the rooms, hallways, then start coding the link system and spawn system, and adding the randomness with it. Then improve on it, by adding the custom inspector, making it easier to spawn.<\/p>\n\n\n\n<p>Each Room and Hallways are made of squared tiles, this way it is possible to make them modular and maybe procedural too.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"974\" height=\"602\" src=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_09.png\" alt=\"\" class=\"wp-image-212\" srcset=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_09.png 974w, https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_09-300x185.png 300w, https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_09-768x475.png 768w\" sizes=\"(max-width: 974px) 100vw, 974px\" \/><\/figure>\n\n\n\n<p>With those tiles, I started creating those rooms.<\/p>\n\n\n\n<p>The doors are spawned at the link place. For now, they are only 2 squares long but there will be multiple sizes in the future.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"770\" height=\"584\" src=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_11.png\" alt=\"\" class=\"wp-image-211\" srcset=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_11.png 770w, https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_11-300x228.png 300w, https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_11-768x582.png 768w\" sizes=\"(max-width: 770px) 100vw, 770px\" \/><\/figure>\n\n\n\n<p>I composed my project of 3 main scripts, one for the main Room System that serves as a database; one for the rooms, including hallways; and one for the links between rooms.<br> The Room script has the necessary variables and has multiple functions.&nbsp; Those functions listed are:<\/p>\n\n\n\n<ul><li>The initialization, so that the room knows what link it has<\/li><li>The Generate function, this function is used to spawn room at each unlinked link. <\/li><li>The Spawn Room Function, that chooses randomly which room to spawn on the given link<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignleft is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_05.gif\" alt=\"\" class=\"wp-image-215\" width=\"243\" height=\"545\"\/><figcaption>The room needs to be first initialized<\/figcaption><\/figure><\/div>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_06.gif\" alt=\"\" class=\"wp-image-214\" width=\"242\" height=\"535\"\/><figcaption>When initialized you can spawn more rooms<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"274\" height=\"96\" src=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_04.png\" alt=\"\" class=\"wp-image-216\"\/><figcaption> The Link script is there to know if it is linked and to what.<br><\/figcaption><\/figure>\n\n\n\n<p>Links are empty objects with the link script on it and are used as points of connexion. They are located in the room prefab. With the script you can tell if they are linked, to what room and what type of link they are. The type of link makes sure that they are not linked to the wrong link. They use the orientation of their transform to know in what direction to spawn the next room.  <br><\/p>\n\n\n\n<p>The Room System is a scriptable object, meaning that it will be a file outside of the scene. It serves as a database of all the rooms, hallways, doors. It is also the place with the settings for the random room spawning.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"271\" height=\"333\" src=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_03.png\" alt=\"\" class=\"wp-image-217\" srcset=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_03.png 271w, https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_03-244x300.png 244w\" sizes=\"(max-width: 271px) 100vw, 271px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1094\" height=\"647\" src=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_12-2.gif\" alt=\"\" class=\"wp-image-225\"\/><figcaption> <br>Now with this tool, I can create full map  \ud83d\ude00<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"895\" height=\"597\" src=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_01.png\" alt=\"\" class=\"wp-image-220\" srcset=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_01.png 895w, https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_01-300x200.png 300w, https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_01-768x512.png 768w\" sizes=\"(max-width: 895px) 100vw, 895px\" \/><\/figure>\n\n\n\n<p>The room spawning system is set so that you can spawn one specific room from a specific link place, this way you can edit the map more freely.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_07.gif\" alt=\"\" class=\"wp-image-218\" width=\"854\" height=\"552\"\/><figcaption>  But you can also spawn randomly on a specific link, this way you can still have randomness where you want. <\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1098\" height=\"647\" src=\"https:\/\/galactic-overbears.eu\/wp-content\/uploads\/2019\/10\/RoomSystem_15-1.gif\" alt=\"\" class=\"wp-image-232\"\/><\/figure>\n\n\n\n<p>The upcoming goals will be; creating more room, and making them have a procedural aspect, like props in it, and maybe having a room generator to create more of them; Also adding the possibility of deleting only one room on a specific link, and not all the room linked to it (the reset button); Creating a full map procedural generator.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The project goal is to create a corridor base map generator. It will be capable of creating a complex procedural map with still the possibility to edit manually. The idea came from playing Warframe and creating a 2D platformer map generator. I tried to figure out a way to generate a full procedural map out&hellip; <br \/> <a class=\"read-more\" href=\"https:\/\/galactic-overbears.eu\/index.php\/2019\/10\/15\/sci-fi-map-generator\/\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/galactic-overbears.eu\/index.php\/wp-json\/wp\/v2\/posts\/209"}],"collection":[{"href":"https:\/\/galactic-overbears.eu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/galactic-overbears.eu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/galactic-overbears.eu\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/galactic-overbears.eu\/index.php\/wp-json\/wp\/v2\/comments?post=209"}],"version-history":[{"count":23,"href":"https:\/\/galactic-overbears.eu\/index.php\/wp-json\/wp\/v2\/posts\/209\/revisions"}],"predecessor-version":[{"id":251,"href":"https:\/\/galactic-overbears.eu\/index.php\/wp-json\/wp\/v2\/posts\/209\/revisions\/251"}],"wp:attachment":[{"href":"https:\/\/galactic-overbears.eu\/index.php\/wp-json\/wp\/v2\/media?parent=209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/galactic-overbears.eu\/index.php\/wp-json\/wp\/v2\/categories?post=209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/galactic-overbears.eu\/index.php\/wp-json\/wp\/v2\/tags?post=209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}