Crash Bandicoot
This is a Unity 3D project which I created to clone the original Crash Bandicoot. The character feel, graphical look and animation style are all meant to closely resemble the original game. I recreated a portion of the level Heavy Machinery as a testing ground to compare the character physics and responsiveness of the platforming with the real game. Overall I'm thrilled with what I've been able to accomplish so far on this project and I'm sure I'll be adding more mechanics, levels and animations in the near future!
Features
Some areas I am most proud of in this project:
Physics
The player movement is achieved by using Unity's physics engine. Forces are added to the rigidbody component of the character to accelerate and decelerate. Forces are also used to allow the player to jump and to control variable jump heights, if the player lets go of the jump button early opposite forces are added to the character to reduce the jump height.
State Machine
I implemented a state machine in Crash to control Crash's animations. This gave me control of where animation could transition to and from. Another area of control the state machine granted was the ability to cycle through animations before reaching an end goal, for example if the player was falling the fall animation would play, then landing and then finally idle. This would be seamless and uninterrupted through the state machine transitions.
Vertex Animation
The character animation along with various enemies and background assets make use of vertex animation. I achieved this by positioning vertices of the models mesh and taking keyframes. I chose this method for the fluid animation style it provided.
Principles, Programming and Problem Solving
Coroutines:
I implemented coroutines on the majority of the animations within Crash. Crash' animations were controlled from a state machine which often required knowledge of when an animation had finished before changing states and transitioning into a new animation. Coroutines prevent blocking and execute asynchronously alongside the main code loop. When Crash jumps the jump animation plays within a coroutine which then yields control back to the main code loop, once the animation has concluded the coroutine ends and the state machine can then transition to the next state either the land or fall state.
Lighting:
In Crash I used Post Processing to add effects to the scene and specific materials. For example Crash has a low level of glow on his fur to make him pop out in the scene. Materials and items like gems, water, sludge and metal have Post Processing effects added to them too. To implement post processing I set up multiple layers and cameras to accommodate the various effects in each scene. I had two cameras per scene, one which would render all the objects with no affects and one to render the objects with post processing. I set the camera depth to place the post processing objects in front of the standard objects and that concluded the setup.
Ground Detection:
To track the player's vertical position I used raycasts which I positioned on the edges of the capsule collider component of the character. By using the capsule collider's bounds I achieved a precise method of detecting the ground. This was particularly useful when the player is near the edges of platforms as it nullifies the possible state where the raycasts miss the floor but the collider is stopping the player from falling.
Coyote Time:
Coyote time enables the user to register jump input for a short time after the character has left the ground, in most cases when the character has run off the end of a platform. I integrated this mechanic as part of the ground detection which in my game allows user input on the jump button 0.2 seconds after the character has left the ground. I did this to prevent frustrating gameplay and create a forgiving platforming experience.
Landing Assistance:
I implemented a few mechanics to enhance the players experience and create smooth flowing gameplay. The first of which reduces the chance of the player getting caught on edges of platforms when jumping. The function pushes the character away from an object if the player is not moving fast enough and will not make the jump. This provides an easy reset for the player to attempt the jump again without having to reposition the character which could take time.
Streamlined Jump:
To further create smooth gameplay I implemented the streamlined jump function. The streamlined jump reduces the size of the characters capsule collider when jumping, this enables the player to jump onto platforms with a reduced chance of getting caught on edges. This function improves the players precision when jumping and platforming, increases the freedom of movement allowing the character to fit into smaller spaces and rewards skilled players who can take advantage of the smaller collider.