{"id":465,"date":"2025-05-08T16:40:01","date_gmt":"2025-05-08T15:40:01","guid":{"rendered":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/?p=465"},"modified":"2025-05-08T16:40:01","modified_gmt":"2025-05-08T15:40:01","slug":"bsc3b-week-11-room-generation-bug-fixing-and-working-on-validation","status":"publish","type":"post","link":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/2025\/05\/08\/bsc3b-week-11-room-generation-bug-fixing-and-working-on-validation\/","title":{"rendered":"BSc3b Week 11- Room generation bug fixing and working on validation"},"content":{"rendered":"\n<p><a href=\"https:\/\/blueprintue.com\/blueprint\/na2gv8wj\">https:\/\/blueprintue.com\/blueprint\/na2gv8wj<\/a><\/p>\n\n\n\n<p>Final changes to the rooms parent class all are now ordered the checking if the overlap is the player first then do once into the spawn room which now only takes in the spawn arrow and spawned from.<\/p>\n\n\n\n<p>Finally the most important change in this is disconnecting the back exit check as that I found could cause infinite loops of spawning rooms and doesn&#8217;t need to be connected anyway as rooms always spawn from the back so the back exit would never need to spawn a room.<\/p>\n\n\n\n<p><a href=\"https:\/\/blueprintue.com\/blueprint\/1zjn5b0y\">https:\/\/blueprintue.com\/blueprint\/1zjn5b0y<\/a><\/p>\n\n\n\n<p>This is the room gen controller most of the spawning logic remains mostly the main changes coming to adding validation to room spawning. I didn&#8217;t mention it with last weeks but the all rooms array consists of room1-7 excluding room5 as room5 doesn&#8217;t work as it doesn&#8217;t have a back door and even if I did adjust it to that would increase the chance of a corridor in generation over all the other rooms.<\/p>\n\n\n\n<p>For validation it firstly gets all the overlapping actors of the spawned room then for each overlapping actor checks if it&#8217;s equal to the actor it was spawned from or itself and if it&#8217;s not then setting a invalid room to true. On the end of the loop if invalid room is true then it switches on the rooms Enum to set that rooms index in a Boolean array to true then loops through the array to check add up how many rooms failed. <\/p>\n\n\n\n<p>If the amount of rooms failed is equal to 6 then it currently prints a string to say no possible rooms could be spawned, destroys the spawned room and sets invalid room to false.<\/p>\n\n\n\n<p>If it isn&#8217;t equal to 6 then it destroys the actor prints the amount of failed rooms resets the amount of failed rooms then sets invalid room to false.<\/p>\n\n\n\n<p>Note this does prevent a room that shouldn&#8217;t spawn from spawning most the time but it doesn&#8217;t loop back and try again as that would cause infinite loops as the current implementation doesn&#8217;t properly work with the checking amount of rooms that failed so would end up infinitely trying unless there was a room that could be spawned. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/blueprintue.com\/blueprint\/na2gv8wj Final changes to the rooms parent class all are now ordered the checking if the overlap is the player first then do once into the spawn room which now only takes in the spawn arrow and spawned from. Finally the most important change in this is disconnecting the back exit check as that I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,3],"tags":[],"class_list":["post-465","post","type-post","status-publish","format-standard","hentry","category-bsc3b","category-devlog"],"_links":{"self":[{"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/posts\/465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=465"}],"version-history":[{"count":1,"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/posts\/465\/revisions"}],"predecessor-version":[{"id":468,"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/posts\/465\/revisions\/468"}],"wp:attachment":[{"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/georgebaker.nuacomputerscience.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}