Author: Yashwant Patel
Problem:
Island Defenders is a tower defense game and like many tower defense game it can get dry if there is nothing unique about the game. Our approach to fix this issue was to not only let the player build towers, but also let the player have a controlled unit that they can move around and shoot enemies with. This would hopefully increase player engagement and make the game less dry. A major part of giving the player control of a unit is movement and our movement system was very barebones. The player could move and jump, but there was a problem with the movement that would cause the player to twitch. Also, the player didn't have any air control, so they wouldn't be able to maneuver in the air. While the twitching doesn't directly affect the gameplay or the player, it is jarring and annoying to look at. The lack of air control made the floaty jump feel awkward.
As you can see the player twitches when moving and trying to move left or right. This also makes the reload UI jitter which is annoying. Secondly the player doesn't have any control of the character in the air which is also frustrating if they want to makes adjustments in the air.
Solution:
The solution for both of these problems was very advanced... In order to turn off the twitching a bool on the character movement had to be turned off which orients the rotation of the player to the movement. The second solution for air control was to make the air control variable 1 instead of 0, so the player had full control while in the air.
Pretty simple fixes that address the problems at hand.
The twitching is gone when trying to move left or right while moving forward and now the player has full air control, so they can make all the adjustments that they'd like. These were pretty simple fixes, but the movement still feels dry. Only having WASD movement with jumping doesn't feel too engaging. Modern games these days have things like wall running, sliding, mantling, etc. We don't even have the basics like sprinting or crouching. So with the help of tutorials I was able to implement four new movement mechanics. The neat thing about sprinting was that it solves another design problem that we had encountered. When the player purchases movement upgrade it gets difficult to aim, so letting the player have agency on when to move fast or at normal speed is a nice thing to have. Sprinting and crouching weren't too bad to implemented. For sprinting you just increase the movement speed of the character while the keybind is pressed and when they release you set it back to normal.
For crouching a timeline is used to lerp between the standing capsule height and crouching capsule height, so the collider shrinks and grows as the player crouches and uncrouches (currently no animations). Since these two basic mechanics were added the next thing to do was to add a slide, since it's a combination of the sprint and crouch. This was a little more involved. In order to implement sliding a very basic state machine was added to ensure no weird behavior is caused like sprinting while crouching. For sliding it is initiated when the player pressed crouch and they are sprinting.
Once this happens the movement state is changed to sliding and all the initial variables needed for sliding are changed. The ground friction is set to 0, braking deacceleration is lowered and player's movement plane is constrained (so they can't move left or right while sliding).

Afterwards there is a steady force that is added to the player depending on the angle of the floor along the vector that is parallel to the ground and facing the same direction as the player's forward vector. During the sprint if the player exceeds a certain speed it is clamped and if their velocity becomes less than the sprinting speed then they stop sliding. While sliding was cool there were no ramps on the map, so they were added to help the player traverse the map faster in style.... but wouldn't it be cool if the player could slide down one ramp then slide up another ramp (like surfing)? Well in order to achieve this another mechanic was added. In order to have the player ski across the map an impulse is added to the player every few frames depending on the angle of the floor beneath the player. What makes this different than sliding is that the braking deacceleration is lower (takes longer to stop), player's forward vector isn't taken into account (player slides depending on angle of terrain), and releasing the skiing keybind gradually increases the braking deacceleration along with ground friction, so player doesn't come to a halt immediately. This allows the player to ski down ramps and then up another ramp as long as they release the ski key at the right time, because if they keep it held down while going up another ramp, they will slide back down the ramp they are going up.
With these new options it makes traversing the map more fun (skiing is my favorite). It is currently very easy to get between one end to the other end of the map, so the numbers need to be tweaked. Another addition was the double jump. Having a floaty jump with these mechanics didn't feel right, so it was instead swapped out with a double jump. It now requires both jumps to get from the valley to the top of the hills.
Comments
Post a Comment