EECS110 Course Project Option 1, Spring 2018

 

vPool Project

Description: http://www.cs.hmc.edu/~cs5grad/cs5/pool.png

 

Overview

For this project, you will be writing a fully interactive 3D "pool-like" game using vPython. We say "pool-like" because the game need not satisfy the official rules of pool and the game may be substantially less complicated than a full pool game. Moreover, you are welcome to make the table more "interesting" than a normal pool table and you can make the physics arbitrarily wacky.

 

Starting with vPython

Documentation on vPython is available at the vPython website.

On your own PC

If you're on your own PC, starting with vPython is not too hard. Download it from the downloads page of vpython.org and install it on your computer.

Start IDLE by doubleclicking the "IDLE for Python" shortcut on the desktop.
Open an example program -- for example, bounce2.py ( available at C:\Python35\Lib\site-packages\visual\examples ).
Press F5 to run (or use the Run menu).
Every time you run, your files are automatically saved (if you have changed them).
Choose Visual on the Help menu for documentation.

You can also start IDLE from the "Python 3.5: IDLE (Python GUI)" entry on the Programs portion of the Windows Start menu, then open an example program in C:\Python35\Lib\site-packages\visual\examples.

 

On your own Mac

It is possible to install vPython on a Mac, but the setup is involved and time-consuming. We encourage you to use vPython on the Wilkinson Lab machines instead.

If you still choose to install vPython on your Mac, note the following:

Once you're in vPython, if you have a one or two button mouse (as the Macs have), go to the X11 icon at the upper left of the window. From there, click on "Preferences". From there select "Input". Finally, select "Emulate 3-button mouse". Now, you can zoom in your 3D graphics window by holding the OPTION button and clicking the mouse button (left button on a 2-button mouse) while moving the mouse. You can rotate the scene by holding the APPLE button down with the mouse click while moving the mouse.

To stop a vPython program, click on the red button in the upper left of the graphics window. Then, save the file, as pr1_final.py or pr1_milestone.py to the Desktop. This is somewhat tricky! When you choose "Save As...," the default directory will be some place deep within a nested set of folders far from the Desktop. Use the pull-down menu to ascend all the way up to the directory named / (forward slash). Then, double-click on home and after a few seconds, double-click on your login name. Underneath that will be a folder named Desktop. That's where you want to save your file.

When you open the file from scratch, you need to start vPython in the way explained above (using the vPython icon). Double-clicking on the desktop .py file will NOT bring up vPython, but the standard Python we've been using throughout this term.

 

On the Wilkinson Lab machines

Install vPython on the Lab machine you are using by following the steps above. Start IDLE by doubleclicking the "IDLE for Python" shortcut on the desktop.
Open an example program -- for example, bounce2.py ( available at C:\Python35\Lib\site-packages\visual\examples ).
Press F5 to run (or use the Run menu).
Every time you run, your files are automatically saved (if you have changed them).
Choose Visual on the Help menu for documentation.

You can also start IDLE from the "Python 3.5: IDLE (Python GUI)" entry on the Programs portion of the Windows Start menu, then open an example program in C:\Python35\Lib\site-packages\visual\examples.

 

Requirements

Here are the requirements (and a few "non-requirements") for your game:

Feel free to add additional features as you wish.

Here are a few tips that may be helpful to you:

mySphere = sphere(pos=(0, 0, 0), ...)

movement = vector(0.1, 0.1 , 0)

while True:

    mySphere.pos = mySphere.pos + movement  # addition here is overloaded to add movement to pos!

 

Using a vector to keep track of the direction of movement of a ball allows for easy animation. Moreover, if the ball collides with another object then you need only update the vector appropriately.

 

What to Submit for the Milestone and Final Project

The milestone is due on Sunday, 06/03 at 11:59 PM. For this milestone, you should submit the following:

The final project is due on Sunday, 06/10 at 11:59 PM. For the final project, you should submit the following:

 

Submission: submit your solutions at Canvas