Here is the link to my final project:
Here is the code documentation:
As you may have noticed, the final project version is vastly different from my midterm project, albeit some minor similarities. I wanted to retain the obstacle-dodging experience, as well as the overall setup of having the player confined to a specific z-dimension, while facing incoming objects.
Because I've worked with three.js before, it wasn't too difficult to transfer the basic idea of my midterm project to the three.js environment. However, because I wanted to solve the issue of the ambiguous z-space perception, I needed to add shadows and lighting to the scene to give the perception of depth. Once I did however, I realized that it was almost impossible to tell that the ball was moving at all, but rather, it just seemed like the obstacles were the only ones moving towards the player. To remedy this, I had to make some adjustments to the texture, as well as figure out a way to 'roll' the ball forward.
The obstacle logic followed the exact same logic as the obstacles in my midterm. I would create the obstacle object, and then push new objects into an array. Then, the object's z-position would continuously be updated so that it would move towards the player.
One specific area of my final that changed dramatically was the implementation of raycasting. I was very dead set on applying raycasting to my project in order to create a more precise collision detection for the player. However, I realized that unlike my midterm, my final project confined the player to movement only along the x-axis. Instead of using raycasting, it would be much easier to apply the same logic I used in my midterm (detecting if obstacle has moved past the player or not), but split the window into three 'lanes'. If I could detect which lane the player was in, and if the player made contact (obstacles moved pass the player's z-position) within that lane, then a collision would have occurred.
In-Game Screenshots:
It was a really amazing experience to be able to create a game like this. I didn't think I would be able to pull off the styling and the logic within the timeframe, but the end result ended up so much better than I expected. In the future, I hope to create some custom shaders for the meshes, since I am just using simple LambertMaterial. I will definitely keep experimenting with three.js as well!
Video: