SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

Shadowplay - 08222005

This is the third release of shadowplay. There are 4 modes to run the program in. The default is basically just a test mode to check the video. The second is a falling sand demo. It is basically a demonstration of how to interact with the shadow, it's also a good demo for friends. Play around with the R and N constants at the top of the source file to change the number and size of the particles. The third is a two player game called Cover (I'm so imaginative). Basically you just try to cover the dots that are your color and get the bar to go your way. It's a fun game the usually turns into a brawl while you try to keep the other person from covering their circles. The fourth isn't finished yet, but a good portion of the physics is done and I'm quite proud of it. It's going to be a two player maze game where you try to push a squishy polygon through a maze before the opponent does. Right now the polygons and the mazes are defined in a file in the data directory. The polygons will bounce off the walls but not eachother. You can play around with the level set that has just one level in it right now with 3 polygons. The player objects are basically masses at the vertexes with springs connecting them all together. On occasion the simulation will blowup for unknown reasons (I'm pretty sure it's integration and rounding errors).

To select which of the modes you want to use run it with the '-h' switch to see what all the options are.

The keyboard can have some control over the input and output. '+'/'-': Changes the threshold for what is considered a shadow. 'i': Inverts the shadow buffer.
'n': Normalizes the video to help remove the background from the video. 'v': Flips the background between the actual video and the shadow buffers. 'f': Outputs the fps on the console.
'c': For the default run mode this will display a spinning cube with the video displayed on all the faces. 'r': (Squish Maze only) Resets the level and adds a bit of randomization to the vertex velocities. 'l': (Squish Maze only) Resets the level.

I've found that to get a good shadow I use a dark background and light subject (me). I normalize the image and then decrease the threshold until I get noise and back off a little bit. If you are trying to actually use shadows as the input you might have to play around with it a little bit more to get a good solid shadow.

You might want to play around with the compile optimizations to make it as fast as possible. The one that is commented out is what I use. It seems to be pretty good. I'm no wizz with optimizations though.

To create a new toy make a new subclass of GameController and overwrite the Draw method. Then just modify main.cpp and Makefile to compile the new class in and allow you to select it from the commandline.

Known problems:
- The first time I start the program up after a reboot the video is messed up. To work around this run a different TV program like tvtime. - I've only ever run this on my machine which is a Athlon XP 1700+ running LFS with an AverMedia AverTV Studio tuner card (with a really old camera plugged into it for input). You might have to play around with compile options. The video input is basically a butchered version of the capture.c demonstration code for V4L.


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.