Third Devlog - Enemies


     This week's focus for the game was on the movement and behaviour of the zombies. The movement is a fairly simple AI where, during the day, the zombies move directly towards the player if they are within range of the player, otherwise they stand still and enjoy the sunlight. I implemented this in a very similar way to the player shooting mechanic I described in a previous devlog. I used an overlap circle to see whether the player was in range, and if they were, I sent a raycast from the zombie in question, to the player, and if the view was not obstructed by a tree, then the zombie would move toward the player. With this mechanic, players can sneak up on zombies by hiding behind trees if they so choose. 

      At night, however, the zombies' behaviour changes. Zombies aren't drawn to light by their vision, but by another sixth sense. They can sense that the player's house is giving off light and move towards it whether their view is obstructed or not, from any distance away, at a faster pace than they would move toward the player. They sometimes get stuck on trees, but this makes sense in the world because they are acting mindlessly. 

     The only thing that can stop a zombie from getting to the house at night, apart from killing it with some arrows, is the Shroom Torch. I had some trouble implementing this due to not realising that trigger colliders cannot always trigger other trigger colliders. I found a way to fix it by putting a non-trigger collider on the torch and an additional trigger collider on the zombies to see whether they are close enough to the torch to be sttracted by it. If they are, they will move toward to torch rather than the house every time, even if the house is closer, because the torch is brighter than the house. the only thing that will stop them is removing the torch by picking it up. 

     At this stage, the day and night cycle are signalled to the player with the screen changing colour with a transparent dark blue overlay. I had problems with getting people to test my game, and I believe it may have been due to the 8 minute time-commitment, so I shortened the days and nights to 2m 30s and 1m 15s respectively, while also reducing the size of the explorable forest. It now only takes a total of 4 minutes to play one full game loop. 

     I had some problems with the zombies not reaching the house very quickly at night, so my work-around is to have the zombies move extremely quickly until they get within a certain radius of the house where I slow them down to regular night-time speed (a little faster than day-time). The speed of the zombies works as follows:

          Day time: 

               - small zombies fast, medium zombies medium, large zombies slowest

          Night time, far from house: 

               - all zombies super fast

          Night time, close to house: 

               - each zombie is just a little faster than their day time speed

     I am still waiting on any additional feedback from peers, hopefully someone will make some comments soon. This week, there are no pictures or videos, but next week there will be a lot because I will be talking about my implementation of the artwork. 

Files

ZombieForagerPeerReview04.zip Play in browser
Sep 30, 2022

Leave a comment

Log in with itch.io to leave a comment.