UCLA CS174A Final Project
Live demo: http://smashcraft.co/
NOTE: to run it yourself, you have to deploy it using a webserver like SimpleHTTPServer or Apache because of Cross Site Scripting errors for the audio and textures.
- Alexander Ramirez email@example.com
- Steven La firstname.lastname@example.org
- Glen Takahashi email@example.com
- Sarah Wong firstname.lastname@example.org
- WSAD: move
- Q: punch
- E: kick
- V: dodge
- Arrow keys: move
- Enter: punch
- Shift: kick
- .: dodge
- YGHJ: move
- T: punch
- U: kick
- V: dodge
- PL;': move
- O: punch
- [: kick
- ]: dodge
- 2-4: set number of players
- 5-0: start game with stage
- Enter: start game with stage ID 5
We tried to have our code as object-oriented as possible. There is a game object, which contains an array of player objects and an array of platform objects. Both of those objects types contain another object that has information about the 3D model and its transformations.
Each game tick obtains data from the controller object and physics inside the player object and alters the physics of each player accordingly.
- Bump/normal mapping
- Physics simulation
- Collision detection
- Model representation using a stack
Not advanced topics, but fun anyway
The platforms have normal mapping applied to them. A rotating point light shows how the normals change across the texture. Each platform texture has a separate normal map in tangent space that shows what the normals look like. We transform those normals into object space to get the overall normal of a point on a tri.
Physics happens in two dimensions (YZ plane). The main components of this system are acceleration (force) and velocity (momentum). Every action, such as jumping, attacking, and moving, apply a force that will get added to the momentum. Knockback formulas are loosely based on Cathy J. Fitzpatrick's article about Super Smash Bros. Brawl's physics.
Collision detection is done with bounding volumes and points. Attacks are represented by a bounding volume, and if that volume intersects the player volume a hit is registered.
Models are represented in
player-models.js. Each file contains
separate information about its verticies and components. Player models use the
stack extensively, since transformations are applied such that it the arms and
legs are attached to the rest of the body.