Scenesaver documentation

$Date: 2004/08/21 $


  1. Locate your system directory, which is where screensaver (*.scr) files go. On most systems this directory is either C:\WINNT\System32 or C:\Windows\System32.
  2. Save Scenesaver.scr in your system directory.
  3. If you don't already have it installed, download qt-mt333.dll and save that as well.
  4. Right-click on your desktop background and choose "Properties" to get the Display Properties dialog. The "Screensavers" tab will now have an entry for "Scenesaver" - choose this and you're done.

Scenesaver is currently only built for Windows. The code is fairly portable, though, should you want to attempt to get it running on other platforms.

How Scenesaver Works

There are three "image buffers" in Scenesaver. The "front" buffer is by default the one you see on your screen. The "back" buffer is the next image in the cycle. And the "diff" buffer is the result of subtracting the pixels between the two buffers.

As the animals in Scenesaver swoop across the screen, they shift the colors in the front pixels towards the values in the corresponding back pixels, steadily driving the diff values towards zero. The end effect is that the front image blends into the back image, until the back image is swapped again, and the process begins anew.

The animals in Scenesaver are periodically rated on their efficiency at shifting colors - as a general rule, those that flock towards areas of high diffs will be more efficient than those that cover the same area over and over. Higher rated animals mutate over time and replace lower rated animals. In the natural world, this process is known as "natural selection." In computer science, it's referred to as a "genetic algorithm." Same difference.

While the screensaver is running, you can use the following hotkeys to explore it further:

The current version of SceneSaver sports snazzy configuration dialogs that eliminate the need for mucking about with text files in the SceneSaver directory, so the remainder of this page is pretty much obsolete - you can get helpful blurbs by using the "What's This?" question mark button at the upper right corner of the dialogs and then clicking on the thing you want to know about. However, I'll leave the text file information on this page for those who like that sort of thing and/or want slightly more technical explanations of the various options and features.


The Scenes.txt file is quite important, since it determines what images Scenesaver will cycle through. The format is one file name per line; the file can be a complete path or just a filename, in which case it's assumed that the image lives in the Scenesaver directory. Any blank lines or invalid filenames will be replaced with solid blocks of random color at runtime. If you don't create a Scenes.txt file, Scenesaver will use nothing but random colors.

If you want to get up and running quickly, grab GenScenes.bat and put it in your Scenesaver directory, along with a bunch of image files in .bmp or .jpg format, and then run GenScenes.bat. This little batch script is something I ended up writing for myself - it just dumps the names of all the .bmp and .jpg files in the directory into a Scenes.txt file. You might want to expand on it, or not.

If you're not sure what image files to use, I recommend just grabbing a bunch of nice desktop wallpapers at a low resolution. I'm a fan of Digital Blasphemy, myself.


Click the Settings button from the Display Properties > Screensaver dialog to edit Scenesaver's configuration file, Scenesaver.cfg.

# Number of animals in the world?
The number of animals in Scenesaver is a constant, so this setting gives you absolute control over the population. A large population tends to yield more interesting visual effects and more controlled evolution, but it also lowers the framerate, so tune as appropriate.
# Initialize with engineered animals instead of random?
If this option is set to true when Scenesaver is first started, after the SceneGenes.txt file has been wiped, with the savegenes options set to F, or at the same time as an increase in the population setting, the newly generated creatures will be initialized with preprogrammed neural nets rather than randomly wired ones. These "engineered" creatures will still be subject to the laws of evolution, and are by no means "perfect", but they will have a considerable leg up on complete random creatures, so give them a try if you want the screensaver to start off with vaguely "intelligent" behavior instead of a chaotic primordial soup.
# Save genotypes on exit?
If this is set to true, Scenesaver will save its genetic progress each time it stops, so that evolution doesn't need to start from scratch each time. I recommend having this option set to true.
# Number of timesteps per fitness cycle?
A "timestep" is the same as a frame of animation, which will vary from system to system. A "fitness cycle" is a period during which the fitness of the creatures is evaluated. At the end of each one, the most fit creature (basically, the one that consumes the most image) is cloned with mutations and the clone replaces the least fit creature. Setting this value lower will result in rapider mutation and hence potentially faster evolution, but setting it higher makes the fitness evaluations more accurate, since a given creature might require a certain amount of time to "prove itself" adequately against its peers. A balance must be struck.
# Number of mutations per fitness cycle?
Each time a copy is made, this number of genetic mutations are applied to the clone. Too few and evolution will be too slow. Too many and the mutations may be too extreme to allow incremental change.
# Number of timesteps before automatic image swap?
After this number of frames, the "back image" will automatically rotate, regardless of how much of the front image the creatures have been able to consume thus far. Setting this to a very high number will force the creatures to consume the required percent of the image set in pctchange before they get a new image to work with.
# Percent of image changes before automatic image swap?
pctchange=[integer 1-100]
Each time a new back image is loaded, Scenesaver will calculate the amount of work it will take to completely transform the front image into the back image. It will then track how much of that work has been done thus far. Once the percentage of work done meets the pctchange percentage, the back image will rotate. Setting this value to 100 will force the creatures to labor until the front buffer completely matches the back buffer, or until t_nwimage frames have elapsed.
# Randomized image order instead of sequential?
If this is set to T, every image after the first one in Scenes.txt will be chosen randomly from among those listed. If F, the images will be run in the order listed.
# Smudge blend factor, as a percentage?
pctsmudge=[integer 0-100]
If this is set to something greater than 0, the animals will smudge the image as they travel. The percentage indicates how much color they copy from one pixel to another as they smudge the image. I find that a value of 10 looks pretty good. Values that are too high will make the image quickly unrecognizable. Smudge calculations are fairly intense, so once you change this value from its default of 0, your framerates are likely to drop.
# Smudge distance factor, as a percentage?
dstsmudge=[integer 0-200]
This controls how far pixels get pushed during smudge calculations, as a percentage of the smudging animal's velocity. The default is 50, which means that as an animal moves from point A to point B, it smudges pixels from point A to point C (halfway between A and B), using the alpha value given in pctsmudge to determine how much of the A pixels overwrite the C pixels. Setting dstsmudge to values around or higher than 100 gives the appearance of the color being pushed out ahead of the animals, which is an interesting effect but distorts the image very quickly. For smudging to happen at all, pctsmudge must be greater than zero.
# Amount of color each animal can change per step?
This controls how quickly an animal can transform the pixels under it from the front buffer to the back buffer, as a function of RGB values per timestep. Note that this figure is per-animal, not per-pixel, so if two animals of different sizes have the same digestion value (which they will, since digestion is a global setting across all animals in the simulation), the smaller animal will transform more color per pixel, cutting a sharp trail, whereas the larger animal will transform less color per pixel but across a broader area, leaving more of a smudge.
# Maximum radius, in pixels, of each animal?
Pretty straightforward. The average animal will be about half of this size, so set expectations accordingly, but there will be genetic variations. If you modify this value, you might want to modify the digestion value as well, or the visual effect is likely to be very different (see above remarks regarding sharp trails vs. smudges)
# Vision range, in pixels, for each animal?
This controls an animal's perception of the pixels immediately around it. If you're suffering from low framerates, try lowering this number, since processing nearby pixels accounts for a large portion of a creature's CPU usage. Even with this number lowered, creatures can still perceive the presence of the "brightest" food sources on the screen as well as each other, so they won't be flying blind.
# Default camera setting?  W for world, C for chase
This sets the default camera setting, which you can modify at runtime with the C key. I recommend the world view.
# Draw creatures in world view?
With this option set to F, the creatures will be invisible, and only their trails will show their motion. This can be modified at runtime with the X key.
# Auto-scale images if they don't match the first?
# N for no scaling, S for stretch to fit,
# L for letterbox, M for static pan 'n scan.
The number of pixels on the screen is set by the first image in Scenes.txt, and this setting determines how subsequent images will be handled if their sizes do not match. A setting of N will simply load the pixels one-for-one and discard those that don't fit. A setting of S will stretch the new image to occupy the entire screen, ignoring its original aspect ratio. Settings of L and M will preserve the aspect ratio - the L setting fits the entire image into the screen, whereas the M setting fits the entire screen into the image.


Scenesaver's source is available in the Perforce Public Depot.

Back to the main Scenesaver page