Base for Prophunt
- zm02stor
- Sep 19, 2022
- 3 min read
Updated: Sep 29, 2022
[16 /09]
Attempted to make more realistic randomised movement for the cat - specifically the wander AI. This is done by projecting a circle in front of the AI agent and following a random point on the circumference.
The target is found using the Random.InsideUnitSphere multiplied by the radius to get the desired size of the circle. All the steps were working correctly - checked by using debug.log to see current values of the target.
A problem occurred with the projected sphere, since it is in 3d space the target returned a vector with a y coordinate, this meant that the cat could randomly ascend or descend in the level which isn’t very realistic. There is a circle, but this would return the x and y coordinates when we need only the x and z. I still opted for the sphere and once calculations were completed, the target keeps the x and z values but sets the current y value to 0 by assigning a new Vector3. This will prevent the cat from moving up or downwards.
At the same time a basic flee and seek AI functions were implemented. The flee system works using the reverse displacement, by subtracting its original position from the player so that the desired destination will always be away from the player. It ended up not working as expected, since the cat would now run away from the player and rotate in the opposite direction meaning it will be impossible to catch the cats. This can be fixed using a check to see if player is in sensing range (not yet implemented as of now).
Flee and Seek movements are extremely jittery, it looked as though the cat is almost hopping or teleporting to the next location.
The wander AI is currently faulty, the wander target stays the same even if the value is reassigned each update, the result is the cat moving in a completely straight line (since the target doesn't change).

[Top: ideal wander, Bottom: Current wander]
At this point I decided to leave the AI behaviours for later (enemy also shares the same behaviours as the cat, but has a higher sensing range and patrol route) and implement part of the prop hunt mechanic.
The single player scene was duplicated and renamed to prophunt. All unnecessary elements and aspects unique to the single player game were removed:
Cat
Spawner
Goal
Cats collected UI
Enemy
Throwing bait mechanic
Pickup cat
The remaining mechanics in the scene were the player, player movement script and the minimap. These are shared across all game modes. I adjusted the player movement script to add jump (it hasn't been limited to one key press so the player can spam the space bar and fly upwards)
A new folder was added to keep scripts specific to prophunt separate since none of these mechanics will be available in other game modes.
A list holds all the props the player can transform into as well as a reference to both cameras. The perspective is changed from first person view (FP) to third person perspective (TP) when the player changes into a prop so they can see themselves and use the level to hide appropriately from other players.
I quickly modelled a barrel, a table and a chair in blender. [img of all 3]
The itemCycle script cycles through a list of props and sets the prop to be active when F is pressed. Once the player changes into the first prop in the list, the perspective changes from FP to TP view. The next key presses change the item to the next one in the list until the last index is reached. This is when the perspective changes back into FP view and the current prop is reset so the cycle can start again.

By the end of the day I was able to have a working camera switch between both perspectives and props for the player to change into.
[18/09]
A basic timer has been added to the scene, the time can be adjusted in the inspector. As of now nothing happens when the timer reaches 0. I was going to add roles for each player but this should be added once PHOTON 2 has been implemented to the scene. This is because it will get a list of the current players in the scene, and there is only one player.
Video showcasing current mechanics:
[Link to video if above doesn't load: https://youtu.be/omFcKuByXH0
Level design:

Goals for next prophunt implementation:
> Add a smooth transition between the camera changes, right now it is quite sudden
> Potential rotation for the prop
At the time of writing I realised that the wander target had not been initialised in the step which could be the problem with non- randomised movement.


Comments