Zombies and path finding


I created a spawner for zombies and simple prefab for a zombie, then I started designing some map representation.

I decided that each tile will have in each corner one vertex then after all vertices will be computed, the raycast will be called from each to each to determine if there should be edge between them, the value of the edge is the distance between the vertices. I wanted some nice graphical representation of the graph which could be turned on/off so I started experimenting how to easily draw a circle in unity and I spend little bit more time than I should here but at the end I decided that for each vertex I will create a game object with circle texture. 

The next problem are edges. For each edge am creating a new gameobject with linerenderer component and the edge is rendered via that component, but I come across a problem with raycasting because it seems like its ignoring walls in maze, so I tryed a little bit of tweaking but the behaviour becames only worse. I fixed the issue, the problem was that I was doing the raycasting in the Start method which is before first FixedUpdate call, but before first FixedUpdate call the physics is nt set up completly so I has to do raycasting after the first FixedUpdate call.

The next thing whoch graph to use, I tried using 5 nodes in each tile but it was very computation heavy and there was a lot of corners where the zombies can stuck so I changed it to 1 one in each tile (in the center of tile) I also created a pathfinding component for zombies.

After that I made a healthbar for player and zombies can damage a player too. Also I has created system for waves and improved a UI.

Reward system is the next thing in todo-list, player is able to choose one from three reward after clearing a wave. Reward are: Speed, FireRate, Heal. I had a little bit problem here because windows decided to update my system when I was having dinner so when I came back my computer was restarted after update and I lost some progress so I needed to remake rewarard. Also it erased a big part from this blog too so I needed to rewrite it. Also it for some reasong deleted all my UI elements and there are not back event after reverting to last commit so I need to create them again.

At the end little bit of bugfixing, started with bug when player is moving fast enough and catches its own bullet that bullet got destroyed so I changed it to that bullets ignore player. Next bug was when zombies spawning on top of each other, I really did not fix this issue but I make spawning more random. Zombies now spawn at random position in one of the 4 random corners and with random speed.

FInal node: Game has not that good performance, when there is more zombies, lags start when there are around 10 zombies and thats very bad because this game is fun when there is lots of zombies but I dont know if I will be fixing this isue because of time reasons so I will focus on other things and return to this of some time remains.

New build attached. 

(Also the graph can be shown/hidden by pressing F1)

Files

Build v0.3.zip 22 MB
Jul 19, 2021

Get Zombie Shooter

Leave a comment

Log in with itch.io to leave a comment.