{"id":883,"date":"2025-02-28T16:21:24","date_gmt":"2025-02-28T16:21:24","guid":{"rendered":"https:\/\/sites.wsagames.com\/et4g23\/?p=883"},"modified":"2025-05-09T15:06:57","modified_gmt":"2025-05-09T15:06:57","slug":"prg-week-2","status":"publish","type":"post","link":"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/","title":{"rendered":"PRG &#8211; Pt 2"},"content":{"rendered":"\n<p class=\"has-text-align-center has-background\" style=\"background-color:#dfdfdf\">After fixing a few bugs to finish of week 1, there were still issues with the procedural room generation. Most importantly, the fact rooms were able to block off other rooms. However, in order to fix this, I needed to figure out why the bug was occurring in the first place.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Understanding the Issue<\/h2>\n\n\n\n<p>Upon further analysis, I realised that every time a room was blocked by another, the room that was instantiated <strong>first<\/strong> (1) is <strong>always <\/strong>the room that blocks the room that was instantiated <strong>after <\/strong>it (2) &#8211; therefore the room that was instantiated after (2) is always the room that is being blocked.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"575\" src=\"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-24-1024x575.png\" alt=\"\" class=\"wp-image-888\" srcset=\"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-24-1024x575.png 1024w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-24-300x168.png 300w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-24-768x431.png 768w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-24-850x477.png 850w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-24.png 1459w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This is because, between the two rooms (1 &amp; 2), the room that was instantiated last (2) was unaware of the room that was instantiated first (1) and therefore wouldn&#8217;t know that it (2) shouldn&#8217;t instantiate a room with a door leading towards that room (1).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Bug Fixing<\/h2>\n\n\n\n<p>In order to fix this, I created a new gameobject called a &#8216;RespawnPoint&#8217; (Blue) that acted very similarly to the &#8216;SpawnPoint&#8217; (Red) gameobject. But it would act as a way for diagonal rooms to communicate with each other, even if they weren&#8217;t horizontally or vertically next to each other. The way that they functioned was:<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<ul class=\"wp-block-list\">\n<li>They were located on each wall of the room prefab that <strong>didn&#8217;t <\/strong>have a doorway<\/li>\n\n\n\n<li>They had a &#8216;closingDirection&#8217; that dictated where the newly instantiated room <strong>shouldn&#8217;t <\/strong>have a doorway<\/li>\n\n\n\n<li>If they collided with another RespawnPoint they would both destroy eachother (And instantiate an &#8216;Annihilator&#8217; gameobject that would destroy other RespawnPoints)<\/li>\n<\/ul>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"459\" src=\"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-25-1024x459.png\" alt=\"\" class=\"wp-image-889\" srcset=\"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-25-1024x459.png 1024w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-25-300x135.png 300w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-25-768x345.png 768w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-25-850x381.png 850w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-25.png 1170w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div><\/div>\n<\/div>\n\n\n\n<p>But the most important part of their functionality was that whenever they would collide with a SpawnPoint gameobject, the SpawnPoint gameobject would be destroyed, but the RespawnPoint object would access its openingDirection int. Combined with its own closingDirection int and the SpawnPoint&#8217;s openingDirection int; the RespawnPoint could then choose more specific rooms to instantiate that would have the correct closing direction and opening directions. However, more specific arrays would need to be added into the RoomTemplates script in order for this to work.<br>The script for the RespawnPoint gameobjects:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"405\" src=\"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-31-1024x405.png\" alt=\"\" class=\"wp-image-895\" srcset=\"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-31-1024x405.png 1024w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-31-300x119.png 300w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-31-768x304.png 768w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-31-850x336.png 850w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-31.png 1382w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"651\" height=\"826\" src=\"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-35.png\" alt=\"\" class=\"wp-image-903\" style=\"width:840px;height:auto\" srcset=\"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-35.png 651w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-35-236x300.png 236w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-35-300x381.png 300w\" sizes=\"(max-width: 651px) 100vw, 651px\" \/><\/figure>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"351\" height=\"574\" src=\"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-33.png\" alt=\"\" class=\"wp-image-897\" style=\"width:416px;height:auto\" srcset=\"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-33.png 351w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-33-183x300.png 183w, https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-33-300x491.png 300w\" sizes=\"(max-width: 351px) 100vw, 351px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p>This was the addition to the &#8216;RoomTemplates&#8217; script, these new arrays would allow for more specificity for RespawnPoint gameobjects to spawn rooms with specific closingDirections <strong>and<\/strong> openingDirections. The naming convention I created was &#8216;yes_no_rooms&#8217;.<\/p>\n\n\n\n<p>The &#8216;yes_&#8217; meant that the room required an opening in that direction. For example, a &#8216;yesTno_Room&#8217; would require a room that had an opening upwards (To the <strong>Top<\/strong> of it &#8211; hence T)<\/p>\n\n\n\n<p>The &#8216;no_&#8217; meant that the room required a closing in that direction. So, a &#8216;yes_noBRoom&#8217; would require a room that had a closing downwards (Towards the <strong>Bottom <\/strong>of the room &#8211; hence B)<\/p>\n\n\n\n<p>Therefore, the &#8216;yesTnoBRooms&#8217; array would contain any room that had an opening upwards but a closing downwards, etc.<\/p>\n<\/div>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>After fixing a few bugs to finish of week 1, there were still issues with the procedural room generation. Most importantly, the fact rooms were able to block off other rooms. However, in order to fix this, I needed to figure out why the bug was occurring in the first place. Understanding the Issue Upon&#8230;<\/p>\n","protected":false},"author":28,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-883","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PRG - Pt 2 - E-Jay Tripoli (Year 2 Archive)<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PRG - Pt 2 - E-Jay Tripoli (Year 2 Archive)\" \/>\n<meta property=\"og:description\" content=\"After fixing a few bugs to finish of week 1, there were still issues with the procedural room generation. Most importantly, the fact rooms were able to block off other rooms. However, in order to fix this, I needed to figure out why the bug was occurring in the first place. Understanding the Issue Upon...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/\" \/>\n<meta property=\"og:site_name\" content=\"E-Jay Tripoli (Year 2 Archive)\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-28T16:21:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-09T15:06:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-24-1024x575.png\" \/>\n<meta name=\"author\" content=\"et4g23\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"et4g23\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/\",\"url\":\"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/\",\"name\":\"PRG - Pt 2 - E-Jay Tripoli (Year 2 Archive)\",\"isPartOf\":{\"@id\":\"https:\/\/sites.wsagames.com\/et4g23\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-24-1024x575.png\",\"datePublished\":\"2025-02-28T16:21:24+00:00\",\"dateModified\":\"2025-05-09T15:06:57+00:00\",\"author\":{\"@id\":\"https:\/\/sites.wsagames.com\/et4g23\/#\/schema\/person\/56387a1dc0de878bb33ce4c478f22963\"},\"breadcrumb\":{\"@id\":\"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/#primaryimage\",\"url\":\"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-24.png\",\"contentUrl\":\"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-24.png\",\"width\":1459,\"height\":819},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/sites.wsagames.com\/et4g23\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PRG &#8211; Pt 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/sites.wsagames.com\/et4g23\/#website\",\"url\":\"https:\/\/sites.wsagames.com\/et4g23\/\",\"name\":\"E-Jay Tripoli (Year 2 Archive)\",\"description\":\"A documentation of my work for Year 2 - Studying Games Design and Art at the University of Southampton\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/sites.wsagames.com\/et4g23\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/sites.wsagames.com\/et4g23\/#\/schema\/person\/56387a1dc0de878bb33ce4c478f22963\",\"name\":\"et4g23\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/sites.wsagames.com\/et4g23\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/477d521b3b86e4ef27181bf784cd1a145a38c7d6a0154a478d3c858d26298bec?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/477d521b3b86e4ef27181bf784cd1a145a38c7d6a0154a478d3c858d26298bec?s=96&d=mm&r=g\",\"caption\":\"et4g23\"},\"url\":\"https:\/\/sites.wsagames.com\/et4g23\/author\/et4g23\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PRG - Pt 2 - E-Jay Tripoli (Year 2 Archive)","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/","og_locale":"en_US","og_type":"article","og_title":"PRG - Pt 2 - E-Jay Tripoli (Year 2 Archive)","og_description":"After fixing a few bugs to finish of week 1, there were still issues with the procedural room generation. Most importantly, the fact rooms were able to block off other rooms. However, in order to fix this, I needed to figure out why the bug was occurring in the first place. Understanding the Issue Upon...","og_url":"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/","og_site_name":"E-Jay Tripoli (Year 2 Archive)","article_published_time":"2025-02-28T16:21:24+00:00","article_modified_time":"2025-05-09T15:06:57+00:00","og_image":[{"url":"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-24-1024x575.png","type":"","width":"","height":""}],"author":"et4g23","twitter_card":"summary_large_image","twitter_misc":{"Written by":"et4g23","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/","url":"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/","name":"PRG - Pt 2 - E-Jay Tripoli (Year 2 Archive)","isPartOf":{"@id":"https:\/\/sites.wsagames.com\/et4g23\/#website"},"primaryImageOfPage":{"@id":"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/#primaryimage"},"image":{"@id":"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/#primaryimage"},"thumbnailUrl":"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-24-1024x575.png","datePublished":"2025-02-28T16:21:24+00:00","dateModified":"2025-05-09T15:06:57+00:00","author":{"@id":"https:\/\/sites.wsagames.com\/et4g23\/#\/schema\/person\/56387a1dc0de878bb33ce4c478f22963"},"breadcrumb":{"@id":"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/#primaryimage","url":"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-24.png","contentUrl":"https:\/\/sites.wsagames.com\/et4g23\/wp-content\/uploads\/sites\/27\/2025\/02\/image-24.png","width":1459,"height":819},{"@type":"BreadcrumbList","@id":"https:\/\/sites.wsagames.com\/et4g23\/2025\/02\/28\/prg-week-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sites.wsagames.com\/et4g23\/"},{"@type":"ListItem","position":2,"name":"PRG &#8211; Pt 2"}]},{"@type":"WebSite","@id":"https:\/\/sites.wsagames.com\/et4g23\/#website","url":"https:\/\/sites.wsagames.com\/et4g23\/","name":"E-Jay Tripoli (Year 2 Archive)","description":"A documentation of my work for Year 2 - Studying Games Design and Art at the University of Southampton","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sites.wsagames.com\/et4g23\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/sites.wsagames.com\/et4g23\/#\/schema\/person\/56387a1dc0de878bb33ce4c478f22963","name":"et4g23","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sites.wsagames.com\/et4g23\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/477d521b3b86e4ef27181bf784cd1a145a38c7d6a0154a478d3c858d26298bec?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/477d521b3b86e4ef27181bf784cd1a145a38c7d6a0154a478d3c858d26298bec?s=96&d=mm&r=g","caption":"et4g23"},"url":"https:\/\/sites.wsagames.com\/et4g23\/author\/et4g23\/"}]}},"_links":{"self":[{"href":"https:\/\/sites.wsagames.com\/et4g23\/wp-json\/wp\/v2\/posts\/883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sites.wsagames.com\/et4g23\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sites.wsagames.com\/et4g23\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sites.wsagames.com\/et4g23\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.wsagames.com\/et4g23\/wp-json\/wp\/v2\/comments?post=883"}],"version-history":[{"count":4,"href":"https:\/\/sites.wsagames.com\/et4g23\/wp-json\/wp\/v2\/posts\/883\/revisions"}],"predecessor-version":[{"id":1137,"href":"https:\/\/sites.wsagames.com\/et4g23\/wp-json\/wp\/v2\/posts\/883\/revisions\/1137"}],"wp:attachment":[{"href":"https:\/\/sites.wsagames.com\/et4g23\/wp-json\/wp\/v2\/media?parent=883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sites.wsagames.com\/et4g23\/wp-json\/wp\/v2\/categories?post=883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sites.wsagames.com\/et4g23\/wp-json\/wp\/v2\/tags?post=883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}