DevBlog & Postmortem of Ability System and Something else about the Clock Room and Other Scenes


Roy Yang

  1. Blink/Teleport
    1. Physics.Raycast is used for detecting the standing surface and getting the blink positions.
    2. Blink ability has maximum 2 charges and takes some time to recharge once it’s used by pressing Q. Start a recharging Coroutine and WaitForSecond is used for this mechanism.
  2. Float/Levitation
    1. The float destination that is higher than current position is always recorded when player is on the ground.
    2. When player is grounded, player floats to the the float destination by long pressing E. A coroutine is started by increasing the Y coordinate of the player and turning off the player’s gravity.
    3. At the same time that floating begins, another coroutine of increasing player’s FoV is started by lerping the camera Field of View. Similarly, the FoV decreases when exiting the float mode.
    4. Once player reaches the float destination, a coroutine of letting player float up and down in the air is started by adding a small PingPong value to the float destination Y coordinate. 
    5. The float mode has a maximum time. The float ability also needs some time to cool down once player starts the float mode, where a cool down coroutine is started. When the float time reaches the maximum or the float ability is ready from the cool down, the player will be forced to exit the float mode and get back to the ground first.
  3. Skate
    1. If skate ability is enabled, player’s forward movement will be replaced by having a higher speed. An impulse force is applied when pressing W.
    2. Player also has a bigger inertia, which means player decelerates more slowly. An coroutine of lerping the player’s speed to 0 is started once W key is up.
    3. When pressing S, the deceleration will be accelerated. This is done by manually adding a bigger value of decrement.
  4. Clock Room
    1. Block movements is set by a script that starts a coroutine of changing the y positions in a random direction first (up or down) in a random speed (0-0.5).
    2. Small clocks are placed in fix positions stored in a Vector3 array, and will be placed in sequence after player gets the current one. When getting all the clocks, a text in UI will show.
    3. The blink indicator is a plane with fade mode material. It will show the spot of Physics.Raycast position where the Y value of norm vector is 1. If Physics.Raycast  is out of range, the indicator will diminish by changing the material’s alpha value to 0. 
    4. The UI set includes the icon of Blink disabled, Blink enabled with 1 time, Blink enabled with 2 times, Float disabled, Float enabled, and a Bloat countdown bar. Variables determining which and how to show the UI are passed and stored in the PublicVars script.

Setbacks & Solutions

  1. When using Physics.Raycast for blinking at first, the player didn’t move to the place where the crosshair points, rather a little bit back. Then, I found out that I should use the camera’s forward vector instead of the player’s forward vector that is a little bit lower.
  2. To prevent the player getting stuck in the blink position, the destination is a little bit higher than the exact surface.
  3. To detect if player is on the ground, the IsGrounded variable from the RigidBodyFirstPersonController is needed. To access that value, the AbilitySystem script is set in the same namespace as the Controller. And both the scripts are set as a child of PublicVars script to pass the variables among scripts. 
  4. The ground check will return true even if player is a little bit higher (0.01) than the ground for the best work. However, when floating the player, it will cause some problems at the beginning of float mode when player starts floating but is checked as grounded.  Therefore, another variable (InFloatingMode) apart from Floating is used to not execute the updates of player grounded.
  5. Since gravity is turned off when float mode begins, player’s speed should also be set as 0, or it will result in a bug of sudden rise when player has a initial speed.
  6. The key (E) should always be detected and used as a condition in any coroutine of float mode. Or, it will cause some bugs. For example, when short pressing E, player won’t reach the float destination and falls on the ground, it will results in shaking because the coroutine that slightly increasing player’s position won’t stop, and the increasing value is fighting with the decreasing value caused by the gravity.
  7. If skate ability is enabled, the impulse by pressing W should not be able to be trigger anytime, or it will change the deceleration state and ruin the inertial simulation. Hence, a cool down is set for the W key and will start timing once W key is up.
  8. If skate ability is enabled, the player could move so fast that go through the walls. This can be fixed by changing the Collision Detection from Discret to Continuous Dynamic.
  9. To prevent player get out of the terrain of the balloon collecting scene, six invisible “air walls” are placed.

Future Works

  1. An animation of blink like quickly moving the camera to the blink destination can be added.
  2. When floating, player cannot move, which lacks some mobility and gameplay. This movement ability can be added in the future.
  3. The skate mode is not ideal and the controls are a little stiff. The player movements needs better tuning. 
  4. The UI cannot show the ability recharge/countdown process, which could be improved in the future.

Get MY AUTISTIC SELF | A Walking Simulator Game

Leave a comment

Log in with itch.io to leave a comment.