-------------------- Last Updated 20-Aug-96 -------------------- Swarm95 Readme Notes David Cook -------------------- Dave cook Consulting -------------------- davepc2@oz.net http://www.oz.net/~davepc2 What is it? =========== Swarm95 is a little screen saver for Windows 95 which depicts a wasp being chased by a swarm of bees. It's a very simple little algorithm, but a really interesting effect. History and Revision Notes ========================== This is the latest in a series of Swarmer apps that I derived from an piece of sample code written I found on a DECUS tape many years ago. The author was Jeff Butterworth and it was written for DECWindows, which I ported to as an app to DOS, Windows 3.1, and eventually made a Windows screen saver out of it. I've continued tinkering with it, upgrading it to Win32 and Win95, and playing around with new features. I don't know if Jeff Butterworth is truely the original author or not. I've seen this code implemented on Sun workstations, and have seen implementations for Windows by other people doing the same thing I have. However, I credit Jeff, since his is the earliest version of this code I've found. This version was written entirely in MFC, not using the Windows SDK screen saver APIs. I originally based this on Nigel Thompson's POP3 screen saver in the MSDN and had no shame whatsoever in lifting his code framework. However, I've now converted this to use the MFC saver example in order to get the preview working properly. I've linked this with the static MFC libraries, to avoid having to bundle the DLLs and writing an installation procedure. This results in in a pretty hefty executable, sorry... The Windows 95 preview mode is not quite perfect yet. It sometimes doesn't erase the preview window background and I haven't figured out which message the app gets in order to handle this properly. Usage ===== There are three basic configuration property sheets: General, Wasp, and Bees. General Settings ---------------- The General properties include the update rate for moving things around, the background color (if you don't like the default of black), and a switch to XOR the little critters onto the desktop. The XOR option isn't enabled yet. Wasp Settings ------------- The Wasp properties fall into two general catagories: movement and appearance. The movememnt is controlled by the velocity and acceleration settings. These control the maximum velocity and acceleration, respectively, that the wasp can attain. These should be slightly higher than the bees settings, otherwise the bees will just swarm all over the wasp in a cloud. The border setting controls how close the wasp can get to the edge of the screen before turning around. This keeps the wasp on the desktop. If you set this to -1, the wasp can wrap around to the other side of the screen, which drives the bees nuts! The Color button brings up a common dialog box for setting the wasp color. Tip: If you want to make the wasp invisible, turn the Visible checkbox off, rather than setting the wasp color to black. The Size slider control sets the chubbiness of the wasp. The default is 1 pixel and anything larger will make it move a lot slower. The Trails checkbox lets you leave the previous wasp segments, i.e., don't erase the old wasp segments. The Visible checkbox lets you turn the wasp on or off. With the wasp turned off, all you see are the bees sort of wandering around aimlessly. Bees Settings ------------- Many of the bee settings are the same as the wasp. The differences are: The number of bees can be set in the Number field. The more bees you have going, the slower the animation will get, of course. The Spew checkbox was just an experiment. Rather than having the bees all start at random, the come spewing out of the center of the screen one at a time. The Wait/Sleep checkbox was also an experiment. It causes the bees to periodically stop and rest, and gives another interesting effect. The Wake Time and Sleep Time settings are determined by the number of bees. A typical setting might be Bees = 75, Wake Time = 100, Sleep Time = 50. To Do List ================ - Set up teeny database to allow saving multiple configurations. Add "Reset to Default" button in General settings. - Implement the oft-asked-for color cycling. - Re-implement sound support (for what its worth). - Add Helpfile. - Add own button(s) for preview-window/preview-desktop in config properties. Revision History ================ 12-Jun-96 1) Enabled srand(). Had been commented out for testing. 2) Added color palette support. 20-Aug-95 1) Converted from Nigel's to MFC saver f/t w/ appropriate corrections in the MFC code. 2) Preview mode working now. 3) Fixed bug in WakeSleep and Spew logic which disabled bees under some combinations of these settings. 24-Aug-96 1) Added additional randomization to CWasp so that it changes direction in x or y axis randomly every WASP_DIRCHANGE cycles. This prevents the wasp from tending to drift in the same direction all the time. 2) Fixed bug in CWasp logic wherein it tended to drift toward 0,0. Due to integer truncation error in RandZ(). Fixed it by forcing m_pBug->nAccel to be odd value in the CWasp::Init() function. 3) Added check for nSize in CBug::Render(). Use this to make bugs invisible if size is set to zero. 4) Added check in CDrawWnd::DoInit() to see if number of bees is zero. If so, then don't try to allocate memory. Yet another way to make bees invisible. 5) Added check for NULL argv in MatchOption(). 7-Aug-96 1) Added Sound property page, and Startup/Shutdown sound settings.