home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 002.lha / zoing.doc < prev    next >
Text File  |  1986-05-05  |  5KB  |  110 lines

  1.  
  2. Zoing! Another fine Canadian product.
  3.  
  4. Alonzo Gariepy
  5. 620 Christie St.
  6. Toronto, Ontario
  7. CANADA  M6G 3E5
  8.  
  9.  
  10. Here's something I have been thinking about for several weeks.
  11. This program simulates a system of rebounding balls.  Zoing!
  12. I hope you enjoy playing with it as much as I did designing
  13. and tuning it.
  14.  
  15. Please include this file in any distribution of the source code!
  16.  
  17. Usage: zoing  [ BALLS [ GRAVITY [ LEVITY ] ] ]
  18.  
  19. where
  20.     1 <=  BALLS  <= 7,  default 7
  21.     0 <= GRAVITY <= 9,  default 0
  22.     0 <= LEVITY  <= 5,  default 0
  23.  
  24. You can run it from the workbench, but you can only get the
  25. defaults.  Some explanation is necessary.
  26.  
  27. General Description
  28. ===================
  29.  
  30.     The bouncing balls are all perfectly elastic.
  31.     This means they don't lose energy when they collide.
  32.  
  33.     When the Zoing! window is active the cursor becomes a ball.
  34.     This ball is infinitely massive and fairly inelastic.  This
  35.     means that other balls cannot impart velocity to the cursor
  36.     and that collisions with it entail a loss of energy.  The
  37.     window comes up inactive so that the balls do not start to
  38.     lose energy through cursor collisions.
  39.  
  40.     The cursor is inelastic as a convenient means of removing
  41.     excess energy from the system.  The balls can be slowed by
  42.     performing a "catching" operation with the cursor, but this
  43.     is difficult especially at high speeds.  You may slide the
  44.     cursor into a ball to create a collison and speed it up.
  45.  
  46.     You may vary the number of balls by giving a number between
  47.     1 and 7 as the first parameter on the command line. Gravity
  48.     may be added to the system in the same way.  I suggest you
  49.     try all the values.  Gravity of one or two is very pleasing
  50.     to watch.  You will find that the energy of the system will
  51.     slowly decline under the influence of gravity.  Stir it up.
  52.  
  53.     Levity is just like gravity except that the system slowly
  54.     gains energy over time. A levity of one is probably all you
  55.     will want.  The gravitational effect will be the sum of the
  56.     gravity and levity.  With gravitation, there is a higher
  57.     density of balls toward the bottom of the screen.  If you
  58.     add some levity and park the cursor in the middle of the
  59.     screen, the energizing of the levity and de-energizing of
  60.     the cursor will reach an equilibrium based on how high the
  61.     cursor is from the bottom of the screen.  This produces a
  62.     very nice effect as balls occasionally roll over the top of
  63.     the cursor or soar way above.  If you are clever you can
  64.     make a ledge with the cursor and the side of the screen to
  65.     trap balls.  You can raise them slowly using the amiga and
  66.     cursor keys.
  67.  
  68. Suggested Values
  69. ================
  70.  
  71.     zoing
  72.     zoing 3
  73.     zoing 7 1 1
  74.     zoing 7 2
  75.     zoing 4 3
  76.     zoing 1
  77.  
  78. About The Program
  79. =================
  80.  
  81.     The best part is that Zoing! uses no floating point variables
  82.     or calculations.  The positions and velocities are represented
  83.     internally using an integer coordinate system.  The collision
  84.     calculations require no trig functions or square roots and are
  85.     only limited by the accuracy of the coordinate representation.
  86.  
  87.     Accurately including gravity would require the extraction of
  88.     square roots.  I chose a simple fudge.  The gravitational field
  89.     is made up of the gravity and levity parameters.  Gravity is
  90.     applied to the velocity before calculating wall collisions and
  91.     levity is applied afterwards.  The name levity comes from the
  92.     observation that this post-application tends to slowly increase
  93.     the energy in the system.  I could explain why, but I won't.
  94.  
  95.     I was going to add sound effects but I couldn't get a recording
  96.     of Schostakowitsch's 5th symphony, that was as good as the live
  97.     performance by the Toronto Symphony last year.  I will remember
  98.     the first movement all my life (and I'm not a flake).  It would
  99.     be nice to add some sound effects.  Collisions with the walls
  100.     should be silent and those with the cursor lower pitched than
  101.     the ones between balls.  The velocity should also modify the
  102.     pitch and volume.  It is truly not worth the work.
  103.  
  104.     The accuracy of the simulation should be proportional to the
  105.     number of simulation steps per frame.  You could probably make
  106.     this greater than 2, but since the number of fraction bits has
  107.     to stay at 6 (with more than that you get overflow on some of
  108.     the calculations), you would increase your minimum gravity and
  109.     lose some nice effects.
  110.