Showing posts with label opengl. Show all posts
Showing posts with label opengl. Show all posts


PongCyl3D: A 3D Pong game in a cylinder from mistercrunch on Vimeo.

I programmed this 3D version of the classic Pong game that plays in a cylinder and wanted to open the source code for it under the GPL license. It is written in Java using the Processing.org framework/IDE.

Note that:
* it is possible to put effect on the ball based on the movement of the paddle while hitting the ball
* a circle moves along the Z axis to help with depth perception
* a menu is accessible to tune some parameters

    It was made as an experiment, and purely for fun. The gameplay is currently limited since your NPC opponent will never miss the ball (his paddle XY coordinates are tied to the ball's). I shelved the project, but wanted to have the paddle controlled using hand gestures while using simple computer vision.

    I was envisioning a projection screen in the middle of a room with a player on either side. Each side has a projector, a webcam that reads player motion and, you guessed it: a player. The ball accelerates and the amount of effect on it increases as the exchange lasts, until someone misses. First to get 11 points win.

    This was meant to be a prototype so the code might not be perfect and commented.

    Code on github:
    https://github.com/mistercrunch/PongCyl-3D


    Inspired by a book titled  Harmonograph: A Visual Guide to the Mathematics of Music , I decided to program an interactive 3d harmonograph using Processing.org.

    Here's what it looks like:




    But just what is a Harmonograph? (from Wikipedia):

    "A harmonograph is a mechanical apparatus that employs pendulums to create a geometric image. The drawings created typically are Lissajous curves, or related drawings of greater complexity.(...) A simple, so-called 'lateral' harmonograph uses two pendulums to control the movement of a pen relative to a drawing surface. One pendulum moves the pen back and forth along one axis and the other pendulum moves the drawing surface back and forth along a perpendicular axis. By varying the frequency of the pendulums relative to one another (and phase) different patterns are created. Even a simple harmonograph as described can create ellipses, spirals, figure eights and other Lissajous figures."




    I decided to share the source code under the GPL license. The project is still work in progress, so the code is shared as is. It should be easy enough for anyone interested in interacting with this software to download the source code and run it in the Processing IDE on any platform.

    Using this software, many variables can be interacted with to change the harmony of the graph. The interface is simple and very straight forward. The menu and variable names should be self explanatory. Here's the basics on how to interact with this program:

    Mouse: Changes the point of view around the drawing
    Numbers(1to9) quick: Recalls a pattern (variable values set)
    Numbers(1to9) held: Saves/overwrite a variable preset for that number
    Space bar: Shows/hide the 3d menu, menu is best viewed when the camera is centered, bring the mouse to the middle of the screen
    Up/Down: Change from a variable to the next/previous
    Left/Right: Increment/Decrement the variable

    Source on GitHub:
    https://github.com/mistercrunch/Harmonograph-3D