Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Room - Bug Fixes and Spawning Optimization - Zak Levine

There were a few issues with the room setup during the first build testing. First, players could lock themselves out of a room, getting stuck forever. Another problem arose with an extra collision box on the player that caused the doors to trigger before the player was in the correct position. The player could also use the doors to ride onto the top of the wall and either ride the walls to the end or jump into the void. 

I thought about a few ways to solve my issue when I made a collision box that is always active until the door is fully open. I decided to use this method because it also solved my previous issue. Since I do not use animation but instead lerp the door down and back up over time, there was an issue where if the player jumped into the Room before the door fully opened, the door would never close. I fixed this bug by changing the closed door to overwrite the open door, but it made the sounds and animations look unappealing since the door would teleport fully closed and then begin closing. Another change was that I added another box collision to the dungeon. This box collision was 1/4 a tile smaller than the regular Room and replaced the original box collision to obtain when the player enters the Room. The second box collision ensured the player had to enter the Room entirely and could not escape through the door. At this stage, I realized the doors would look better and be easier to manage if they were all open. It also became apparent that as the enemies became bigger and filled with more AI, they would hit performance more, spawned in the level simultaneously.

I decided to change the spawning system to fix both of my queries. Firstly, I made a new actor called spawner. I gave the spawner the variable of a pawn class. During the dungeon generation, I switched the spawn enemies to fill this variable instead, and I spawned the spawner at the correct transform. I also added a SpawnEnemy function to this actor that generates the enemy at its location and then destroys the spawner. When the player enters the Room, all spawners actively spawn their enemies since the Room stores the spawners in a list. At this stage, I ran into an issue where the doors were counted as enemies and stored in the enemy list. I never found the exact reason for this, but to fix the problem, I had to clear the enemy list and re-call Overlap Enemies to get all the enemies currently in the Room. After changing the spawn system, I could start all doors in an open position without worrying about the enemies. I did this using the constructor that would make the door start open with a bool that I defaulted to true. The new spawning system also helps with performance and improves the overall experience.



Support this post

Did you like this post? Tell us

Leave a comment

Log in with your itch.io account to leave a comment.