DevBlog & Postmortem of Ability System and Something else about the Clock Room and Other Scenes
Roy Yang
- Blink/Teleport
- Physics.Raycast is used for detecting the standing surface and getting the blink positions.
- 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.
- Float/Levitation
- The float destination that is higher than current position is always recorded when player is on the ground.
- 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.
- 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.
- 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.
- 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.
- Skate
- 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.
- 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.
- When pressing S, the deceleration will be accelerated. This is done by manually adding a bigger value of decrement.
- Clock Room
- 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).
- 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.
- 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.
- 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
- 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.
- To prevent the player getting stuck in the blink position, the destination is a little bit higher than the exact surface.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- To prevent player get out of the terrain of the balloon collecting scene, six invisible “air walls” are placed.
Future Works
- An animation of blink like quickly moving the camera to the blink destination can be added.
- When floating, player cannot move, which lacks some mobility and gameplay. This movement ability can be added in the future.
- The skate mode is not ideal and the controls are a little stiff. The player movements needs better tuning.
- The UI cannot show the ability recharge/countdown process, which could be improved in the future.
Get MY AUTISTIC SELF | A Walking Simulator Game
MY AUTISTIC SELF | A Walking Simulator Game
This is a game focusing on the autism.
Status | Prototype |
Authors | royyang, binnalee, chooseimage |
Genre | Role Playing |
Tags | 3D, autism, Unity, Walking simulator |
More posts
- Game Development and TestingDec 10, 2021
- Dev-log-ClockRoomOct 28, 2021
- My Autistic Self Devlog | Balloon Room and LandscapeOct 22, 2021
Leave a comment
Log in with itch.io to leave a comment.