(Devlog 5) Ghost Prefabs and Spawner


Ghosts Prefabs and Spawner

Paranormal Pursuits entire core mechanics are based around the ghosts and the way they are implemented into the game. The characters role is the enter a haunted location and figure out which type of ghost is haunting  the environment. The game  prototype currently only has three different types of ghosts to showcase the point of the game. Once the player has figured out which type of ghost the character is dealing with, the player can then choose which ghost they think is the correct option.


Ghosts

Currently  the game implements three different type of ghosts, a Demon, spirit and Wraith. Each prefab behaves the  exact same way, in which when the ghost is active or  in a hunt  the ghost will target the player and move around the environment to catch and kill the players character.

The player uses the 'Ghost Encyclopedia' to look for the description of each ghost, based on which description the player thinks matches the ghost the best.


Ghost Pathfinding 

Paranormal Pursuit implements the use of the AStarPathfindingProjector to give the ghost the ability to    actually chase the player effectively so it navigates around the environment and not just walk into walls. The AStarPathfindingProject, which is a free downloadable  project you can import into your game, is essentially all the components and scripts used to give each ghost prefab the necessary behavior it needs.

I implemented this feature with the help of Brackeys  '2D PATHFINDING - Enemy AI in Unity' YouTube tutorial. It is a fairly complicated feature to set up properly but Brackeys tutorial    was very helpful and I recommend anyone to watch this video.

Spawner

The spawner is one of the most important functions in the game. Without the spawner there would be no ghosts in the game. The spawner is a complicated script that spawns a prefab randomly from an array of all three ghost prefabs, after the first random spawn, each spawn  spawns the same prefab. So for example if you start the game and the spawner spawns a Demon, the spawner will continue to spawn a demon until you finish the game. The spawner also has a despawn and respawn delay, the despawn delay is responsible for how long the ghost prefab is active before it despawns and the respawn  delay is  responsible for how long until the ghost starts hunting again. The spawner is supposed to give the illusion that ghost gets angry  and starts trying to hunt  the player that is    investigating them.


Future Plans

At this current time I am just creating the prototype of my game not the whole game, the whole game would ideally have upwards of 30 different types of ghosts. This would make it a lot harder for the player to figure out which type of ghost the character is dealing with, this is ideally the aim of the finished game. Another feature I could add which would be a very long term plan and not something I am going to do anytime soon would be a complete change of how you identify ghosts. At the moment you can only identify the ghost based on what it looks like, a better approach for identifying the ghosts would be to have each type of    ghost have a set of behaviors and based on the behaviors the ghost has the player can identify which type of ghost the character is dealing with. For example a spirit might have the behavior of traveling faster then some    other ghosts, based on this behavior the player can then rule out possibilities of other ghosts  and eventually narrow down which type of ghost the character is dealing with. This creates a much harder environment and makes the game a little more complicated and dynamic.


Reference

AStarPathfindingProject -   https://arongranberg.com/astar/

Leave a comment

Log in with itch.io to leave a comment.