Devlog 3 - Enemies and Interactions


Enemy and Interactions Devlog

 

Hi, this is the third devlog for my game “Escape from the Count’s Mansion”, about the implementation of enemies and interactions in the game. For this third checkpoint, I’ve added a spawner that spawns a basic enemy for the first level of the game.  

The sprite I used for the enemy was a Rat sprite sourced from the Rodents sprite pack created by Tuomo Untinen (Reemax) & Jordan Irwin (AntumDeluge), a pretty realistic animated sprite of a rat. Gameplay wise the rat is meant to represent an introductory level of enemies for the first level, with the difficulty in enemies increasing per level. Thematically, the rats are meant to be these oddly aggressive and potentially haunted creatures, found in the basement where the main character is trapped. The sprite included animations for all four directions of movement.  The rat animated sprite is pictured in a GIF below:

  Rat

Rat moving

I also implemented a spawning algorithm to spawn an enemy from one of the barrels randomly chosen through the algorithm. The algorithm also ensures that only one enemy can be spawned in the scene at a time. This might change if I plan to increase the difficulty level. The enemy also only spawns if the character is within a certain range. The rat spawning from the barrels pictured below in a GIF:     Rat spawning

Spawning pictured in two instances to show randomness
The pathfinding method I used to make the rat chase around the player and more importantly, actually find a path to chase the player, I used the NavMesh pathfinding method, inspired by a Youtube video on Unity AI pathfinding on Tilemaps by Rootbin, and the NavMesh components sourced from h8man’s Github called NavMeshPlus. NavMesh pathfinding works by creatin navigation meshes automatically using the scene geometry, allowing the enemy AI to move intelligently around the game world. This allows the enemy to efficiently (well the actual problems with this will be posted below) find a path to the player while avoiding any areas not assigned as “walkable”. The navigation mesh pictured in the Unity Scene view:

Navigation Mesh

Navigation Mesh

The rat chasing the player pictured in a GIF below: 

 

Rat chasing the player
 

Another interaction that I implemented was the enemy stopping in their tracks when the player shines their flashlight directly on the enemy. I did this by having part of the enemy movement script detect as the light collides with the enemy to convert the enemy velocity to zero to have it stop. Pictured below is a gift of the rat stopping as the flashlight is shined on it:

 

Rat stopping when light shined on it
   

I received a ton of feedback from my cohorts and peers, who tested the latest version of my build uploaded on itch.io. The most common feedback received was the issue of the player sprite animation not flipping properly all the time, in practice where it should flip direction when A or D keys are pressed, instead it only works if the W key is pressed in combination with those keys. A potential bug found by one of the testers was the itch.io game window freezing or crashing when alt-tabbing directly from the game, currently unaware if an itch.io settings issue or something else. Another potential issue was the enemy getting stuck on the walls, which may be an effect of the pathfinding algorithm or a common problem found when using tilemap colliders as walls. Testers also professed the preference for the game camera to be zoomed in more, which I plan to implement in the future when implementing the main dark lighting effect on the entire scene. Once again most testers said that they really loved the lights as well as happiness at a lot of the game bugs from previous devlogs being ironed out.

 

The current build is obviously still incomplete and contains many improvements to be made. Starting off with something that was fixed from the previous devlog, which is the animation not properly registering on the build on itch.io. This was fixed by using a character atlas in Unity, the fix courtesy of alumni of the unit who helped me and my peers. Current(atleast known or very visible) issues include things like the enemy getting stuck on walls, as discussed in the feedback, and pictured below in a gif:

Rat stuck in wall
   

Another issue that becomes instantly obvious as you play the game, is the flashlight not actually rotating with the player as pictured in a GIF below:

Light not rotating with player
 

 

The next devlog checkpoint will be about graphics, and I plan to have most of the graphical elements ready, at least for the first level. See you next week where (hopefully) I’ll have most feedback and planned featured implemented and ready for testing.

 

References:

“Rat” Enemy sprite from the Rodents sprite pack by Tuomo Untinen (Reemax) & Jordan Irwin (AntumDeluge): https://opengameart.org/content/rodents-rat-rework

Unity 2D Tilemap Pathfinding Tutorial by Rootbin: https://www.youtube.com/watch?v=FtQhX-lmYEA

NavMeshPlus and components by h8man: https://github.com/h8man/NavMeshPlus

 

 

Get Escape from the Mansion

Leave a comment

Log in with itch.io to leave a comment.