Git Product home page Git Product logo

cs174apoolgame's Introduction

CS174APoolGame

Pool game final project for CS174A Alt text Paul Rodriguez Dennis Shen Wei Zou

CS174A project

our advance topic consists of collisions of balls with walls and other balls.

our project is a billiards game, where the objective for each player is to get the black ball number 8 into one of the pockets to win the game.

the player can use the mouse to rotate around the pool table and use the left and right arrow keys to control the direction of where to hit the ball.

by pressing and holding the SPACEBAR, the user can charge up the power for hitting the ball and releasing it will cause the ball to move at that specific speed.

the balls can bounce off the sides of the table and also off other balls, and if they get into one of be pockets/baskets then the balls disappear since they wont be needed until another game.

the positions of the balls are update per frame where a timer is used for efficient velocity update since performance seems to decrease when more objects are drawn and it increases when less objects are draw.

collision detection between balls are iterated multiple times to prevent balls from jumping very far.

every time a player puts a ball in a pocket, then they are assigned either striped or colored, the two types of balls avaiable and if they put another ball of the same type into the pocket then they can shoot again, or if they miss then it skips to the other player's turn.

CONTROL KEYS: Press: q to quit. r to restart game. w,s to move camera up and down. a,d to move camera left and right. left and right directional arrows to control angle of ball to hit. up and down directional arrows to move camera forward and back press. Hold: spacebar to power up hitting of the ball.

ADVANCED TOPIC: our advance topic consists of collision with walls and also with other balls. the collisions are implemented in the files "Sphere.h" and "Sphere.cpp" and they are checked in the idle function of the program every time a ball is moving. collision between balls are done before any movement of balls and every pair is checked about 50 times. ball-to-ball collision is done by basically checking that the distance between two spheres are less than the sum of their radius. if they do collide then we must move them back so that they are just touching since they might overlap, then we compute the new velocities using conservation of momentum and conservation of energy by finding the tangential and normal components of old velocities so that we can use them to find the new velocities by solving the equations.

FEATURES: the features include everything covered in the first half of the quarter: shading, lightning, texture mapping, rotation, animation.

Alt text Alt text Alt text Alt text

cs174apoolgame's People

Contributors

cpomz avatar dtshen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.