Second Devlog - Level Blocking


The level design of my game so far has not changed drastically since I made my first drawings of the level when I came up with the original idea. There are two main areas, the forest and the house, that the player can spend time in. The main gameplay loop lies in the layout. During the day, the player goes into the forest to collect resources and reduce the number of zombies to fight at night. At night, the player will go back to their house and defend it from all the zombies left that are headed directly toward the light it sheds. 

Forest layout

A pixel art version of the original sketches I did

The forest is the most interesting part of the design. It is procedurally generated and will be re-generated each day that the player survives. I made a "Spawner" prefab that spawns a random food, a random item, and a usually a random zombie, as well as a tree, all within the radius of that spawner. I was originally going to procedurally generate the locations of the spawners throughout the forest, but I wasn't happy with them being sometimes close together and sometimes far apart, with clusters and gaps all over the place. I tried making the spawning less random by moving spawners that were too close to other spawners, but it proved too difficult. I realised eventually that I could lay out the spawners in a kind of grid formation and it would actually be the effect I was going for all along. It didn't actually look like a grid in the end, because the locations within the spawner radii were random, and there was the even distribution I was going for the whole time. I am very happy with the outcome and feel as though the layout is perfect for my game. 

Spawning Gif

Results of the procedural generation I implemented

Additionally, I worked on many other things in the first week of term that I did not have space to talk about in the previous Devlog. These include things like Health and Energy bar functionality, picking up items, and a relatively robust shooting system. The implementations are detailed below.

Full energy now restores one health point every three seconds, then, after 20 seconds (subject to change), the energy starts decreasing one point every three seconds. When the energy has been empty for ten seconds, the health starts decreasing by one point every three seconds also. I used a few coroutines to implement this and learned about how to assign coroutines to variables and stop specific coroutines at the correct times. 

The player can now also press left shift (key subject to change) to pick up a Shroom Torch they have placed, however, Shroom Torches are still currently useless. They will attract zombies in future.

Lastly, I started implementing likely the hardest part of the game. I wanted the player to be able to shoot an arrow automatically at the closest zombie in line of sight in a specific radius. I used the following steps to do so:

  1. Get all the enemy colliders in an overlap circle radius
  2. Send a ray to each one to see whether there are any objects blocking line-of-sight
  3. Find out which enemy is closest by iterating through the magnitudes of the distance vectors between the player and each enemy
  4. Shoot an arrow in the direction of that object

I was able to do this successfully, barre an issue with passing variables into a function and an oversight on how direction is calculated – both of which I received help with in a tutorial. I also made the player face the direction they are shooting in, but I decided to scrap that as it will all be different when I start using the animator. In future, I was planning to limit the directions the player can shoot to a ninety-degree cone centred on the direction the player is facing. I can probably do this with a polygon collider attached to the player that rotates around them, but there may be an overlap cone function I have not discovered. However, I have gotten used to the player auto-aiming and the game still seems to be challenging enough, so I think I will keep the auto-aiming feature, changing the direction the player is facing when an arrow is shot. 

Arrow Shooting Mechanics

Display of the arrow shooting mechanics I've implemented so far

I have posted my game in the feedback channel on discord twice, but the only feedback I have recieved is that I need to make sure all my objects are on the correct sorting layers and orders within layers. However, I plan on implementing this when I do the art, which I will implement ready for the next Devlog.

Files

ZombieForagerPeerReview02.zip Play in browser
Sep 21, 2022

Leave a comment

Log in with itch.io to leave a comment.