1 XSTAR Xstar versiopn 1.1.0 This program "solves" the n-body problem, and displays the results on the screen. It starts by putting a bunch of stars on the screen, and then it lets the inter-body gravitational forces move the stars around. The result is a lot of neat wandering paths, as the stars interact and collide. XStar can be used to animate the root window, as a screen saver or just to display stuff in a regular window. Usage: $ Xstar [options] 2 Options -h display this message -r use root window -g geometry window geometry -d host:display X server to connect to -t timeout screen saved after 'timeout' seconds -D delay delay between updates (milliseconds) -b stars number of stars -c star_clr star color -C bg_color background color -R Rotate the star colors (Rainbow) -M multiple colors, one per star -a float accuracy of possition calculations. Larger values increase accuracy. Must be greater than zero. -m float mass of star system. Larger values cause the stars to fall to the center. Must be greater than zero. -v enable display of debug output 2 Run_time_actions Press d in the window to add a gravity well. Press e in the window to erase trails. Press + in the window to add a star to the system. Press - in the window to delete a star from the system. Press n in the window to get a new set of stars. Press m in the window to toggle multi-color mode. Press r in the window to toggle rainbow mode. Press p in the window to pause the updating. Press p again to start. Press q in the window to quit. 2 Changes_to_XStar Version 1.0.0 3/12/95 * initial release to alt.sources Version 1.1.0 3/22/95 * second release to alt.sources * the runtime 'd' command could cause a divide by zero * fixed up an error msg when allocating colors * portability patches for HPUX and AIXV3 * GPL license is included in the shar file * switched to the rand48() family of random number generators * a 'multi-color' mode as added so that each star could have it's own color. Can be enabled with the -m option. (From Jeffrey Mogul ) * run time commands 'm' and 'r' to toggle between multi-colored and rainbow modes. (From Jeffrey Mogul ) * Jeff Mogul also created a man page for XStar. * Don't start collapsars at exactly the COLLAPSAR mass to avoid FP rounding problems. * I found, to my shock and horror, that the code I inherited from xgrav implemented some sort of Aristotelean physics where heavier objects fell faster than lighter objects. Converting to Newtonian physics made things slightly slower, but I think more interesting. * XGrav calculated the new locations of the stars by using the formula: x(t) = x0 + v t This assumes that the acceleration is constant (it isn't). Instead, I now use: x(t) = x0 + v t + 1/2 a t^2 + 1/(2*3) (Dt a) t^3 This assumes that the second derivative of the acceleration is constant (it isn't). At least it is _closer_ to being correct. Even dropping the term with the first derivative of the acceleration makes the movement _much_ less accurate. * changing to Newtonian physics makes the experimental bounce code work much better, but it still doesn't work very well. * added the -a and -m options to let people tweak the FV and FM values without having to recompile the system. 2 Known_Bugs_and_Missing_Features - There are several constants many that really depend on how fast your computer is and how good your compiler and X server are. These may need to be tweaked to get them right for your system. Unfortunately, they are not documented well, if documented at all. Some could be calculated at runtime, others should be selectable by command line options. - The initial configuration of the stars works well for a limited range of the initial number of stars, and works ok for a larger range. I just guessed at many of the formulas that I used, but exact relations could be derived. It would just be a lot of work to do and it is easier to tweak constants when you move away from the default of 15 stars. - I would like to add an option so that stars bounce off each other like billiard balls instead of smushing together. I think this would be a neat effect, but the but my first attempts have not been to successful. There is some experimental code in XStar that can be enabled, but I it has lots of problems. It has also been suggested (michael@dsndata.com) that it would be neat if collisions could cause the stars to break apart into several peices. Maybe we could do something like if they collision is very soft, the particles stick together, but if they collide with a fair amount of force, they bounce. If they collide with a lot of force, then they break apart. This could let a single "system" evolve for quite a while. - It would be nice if XStar detected heavy loads on the system and slowed down the updates during those times. Unfortunately, it looks like about the most portable way of determining the loadavg would be to run uptime and parse the output. This is kind of expensive to do. So, XStar works ok as a background process in the root window, but sometimes you have to hit 'p' to let other things get done sooner. - I wasn't able to get the save-under feature to work in the root window, nor did the screen saver work correctly for me. I think this is a problem with my (old) X Server, rather than a bug in the code. - The colors of the rainbow don't seem to be too even. The red, green and blue seem to dominate over the yellow, purple and cyan. - I think it would be neat to plug in the values for the solar system and see what happens. By using the value for G and any arbitrary number of pixel distances, we can obtain conversion factors for the mass and distances. Time is defined such that each iteration takes one unit of time - It might be nice to use the mouse to create stars or temporary collapsars. 2 Author Wayne Schlitt, wayne@backbone.UUCP (wayne@cse.unl.edu) 2 VMS_PORT Patrick Moreau, pmoreau@cena.dgac.fr