home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 015.lha / FScapePlus.doc < prev    next >
Encoding:
Text File  |  1986-11-10  |  15.0 KB  |  308 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.                                 FScapePlus
  7.  
  8.                           Version 1.0  Nov. 1986
  9.  
  10.                              By  Mike Steed
  11.  
  12.                              CIS: 72207,463
  13.                              PLink:  MSTEED
  14.  
  15.         This program is in the public domain. Feel free to copy and
  16.         distribute it as you see fit. Please retain the credits and
  17.         genealogy information. If you improve this program, or have
  18.         any comments or questions, please contact me via CompuServe
  19.         or PeopleLink.
  20.  
  21.  
  22.  
  23.  
  24.  
  25. Introduction   [][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
  26.  
  27.  FScapePlus is a program to create fractal landscapes. It does this by
  28.  creating a a plane of triangles, the vertices of which are offset in the
  29.  vertical dimension by random amounts. If the number of triangles is suff-
  30.  icient, the plane takes on an appearance much like a landscape. This
  31.  effect is heightened by coloring the triangles by altitude, and by the
  32.  optional addition of a sea level. FScapePlus has several enhancements
  33.  over its predecessors. It has been optimized to be much faster. When
  34.  storing an fscape file to disk, only the seed and drawing parameters need
  35.  to be saved, instead of the entire fractal array. And most importantly,
  36.  an easy to use mouse operated control panel has been added, allowing easy
  37.  adjustment of the various drawing parameters to encourage experimentation.
  38.  
  39. Genealogy   [][][][][][][][][][][][][][][][][][][]][][][][][][][][][][][]
  40.  
  41.  FScapePlus has an interesting history. It is based on the ABasiC program
  42.  Fscape by David Milligan and Ted Ingalls, which was adapted for the Amiga
  43.  from a Macintosh Basic program by Michiel van de Panne that appeared in the
  44.  July, 1985 issue of Creative Computing, which was in turn based on an
  45.  article in the September, 1984 issue of Scientific American. FScapePlus
  46.  also incorporates several changes in the drawing routines suggested by
  47.  Danny Cory in the November, 1985 issue of Creative Computing which increase
  48.  its speed. I have made further speed enhancements, such that the program
  49.  now runs three times as fast as the original. The control panel is also
  50.  mine. It, and the text input and requester routines, are part of a library
  51.  of pre-written routines I use when creating programs.
  52.  
  53. Requirements [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
  54.  
  55.  FScapePlus requires AmigaBasic. The program needs 80K in addition to the
  56.  130K or so that Basic requires, therefore a 512K or larger Amiga is also
  57.  required. FScapePlus has been designed to use 80 column text only.
  58.  
  59. The Menus  [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
  60.  
  61. The Project Menu  =======================================================
  62.  
  63.  The Project menu is the main control menu for FScapePlus. It is used to
  64.  create and draw new fscapes, or to redraw existing ones. A cycle mode
  65.  is provided to show off the program.
  66.  
  67.   New:  Generates and draws a new fscape. If automatic seeding is enabled
  68.          a new random seed will be generated, otherwise the current seed
  69.          will be re-used.
  70.  
  71.   Redraw:  Redraws the current fscape, if one exists. When experimenting
  72.          with scaling factors, positions, or sea level, Redraw is faster
  73.          than New. Redraw will not display a change in level or terrain.
  74.  
  75.   Cycle:  Continuously creates and draws random fscapes. The auto-seed
  76.          switch does not affect Cycle.
  77.  
  78.   Stop:  Stops a New or Redraw in progress. Drawing must be stopped before
  79.          other menu items will be enabled.
  80.  
  81.   Quit:  Quits FScapePlus. You may exit to BASIC, or return to the Work-
  82.          bench.
  83.  
  84. The File Menu  ==========================================================
  85.  
  86.  The File menu is where one comes to create and use disk files containing
  87.  the information necessary to recreate any fscape. The File menu is enabled
  88.  only when using the control panel, since AmigaDOS requesters only appear
  89.  on this screen.
  90.  
  91.   Load:  Prompts for a filename, then loads that file and displays the new
  92.          control settings. The suffix ".fscape" will be added to the file-
  93.          name; do not enter it yourself.
  94.  
  95.   Save:  Prompts for a filename, then saves the current control settings to
  96.          that file. Auto Seeding is always set to off. The suffix ".fscape"
  97.          is appended to the filename.
  98.  
  99. The Window Menu  ========================================================
  100.  
  101.  FScapePlus has two windows: the display window is where the fscapes appear,
  102.  and the control panel is where one may adjust the various parameters that
  103.  affect how the fscape is drawn.
  104.  
  105.   Display:  Selects the display window, and enables the drawing menu
  106.          commands.
  107.  
  108.   Control:  Displays the control panel, and enables the File menu.
  109.  
  110. The Color Menu  =========================================================
  111.  
  112.  FScapePlus can't actually dump an fscape to a printer, since that requires
  113.  access to the printer.device, but it can make life easier for a screen
  114.  print program like ScreenDump or Scrimper.
  115.  
  116.   Normal:  Sets the display colors to their normal values.
  117.  
  118.   Color Print:  Sets the background color to white, so that printing on a
  119.       color printer won't wear out the black ribbon.
  120.  
  121.   B&W Print:  Sets the background color to white, and all the other colors
  122.          to black, suitable for printing on a black and white printer.
  123.  
  124. The Control Panel   [][][][[][][][][][][][][][][][][][][][][][][][][][][]
  125.  
  126.  The control panel greatly increases the "play value" of FScapePlus. It
  127.  provides an easy, Intuition-like way to adjust numerous parameters that
  128.  go into the drawing of an fscape. All of the control panel settings are
  129.  saved when an fscape is saved to disk.
  130.  
  131. Terrain:  This slider varies the roughness of the fractal terrain. When
  132.          set to Flatlands, very little variation in altitude will be ob-
  133.          served. When set to Rugged, the peaks and valleys will be off
  134.          the screen unless the Z Scale is reduced to compensate.
  135.  
  136. Horizontal Position:  Moves the fscape horizontally on the screen. Most
  137.          useful when the size of the fscape has been reduced.
  138.  
  139. Vertical Position:  Moves the fscape vertically on the screen. Most useful
  140.          when the size of the fscape has been reduced.
  141.  
  142. X, Y, and Z Scale Factor:  These sliders control the size of the three
  143.          dimensions of the fscape. X and Y control the horizontal dimensions
  144.          in a manner that is difficult to generalize, and Z controls the
  145.          vertical dimension. They may be adjusted together or seperately
  146.          to size and/or distort the image.
  147.  
  148. Level:  This selector controls the resolution, or number of triangles in
  149.          the fscape. Level one has four, level 4 has 256, and level 7 has
  150.          16384. Each increase in level takes four times as long to draw.
  151.          The default level of 5 results in a reasonably detailed fscape,
  152.          without taking forever to draw. A level 7 fscape is very detailed,
  153.          but takes nearly a half hour to draw. The overall terrain of the
  154.          fscape remains the same regardless of level.
  155.  
  156. Seed Number:  This number is the seed to the random number generator that
  157.          is used to create the fscape. A given seed will always create the
  158.          same fscape. Clicking on the Seed box will allow you to enter
  159.          a seed number of your choice.
  160.  
  161. Manual Reseed:  Click this button to generate a new random seed number.
  162.  
  163. Auto Seeding:  If this switch is set to On, a new random seed will be gen-
  164.          erated whenever New is selected from the Project menu. Entering
  165.          a seed manually will disable Auto Seeding, to prevent the new seed
  166.          from being changed before it can be used. The Cycle option on the
  167.          Project menu always generates random seeds, regardless of the
  168.          setting of this switch.
  169.  
  170. Auto Screen Clear:  When this switch is On, the screen will be cleared
  171.          before a new fscape is drawn. If you have scaled down the fscapes
  172.          and would like to draw several on the screen at once, just click
  173.          this switch to Off.
  174.  
  175. Sea Level:  When this switch is On, the portion of the fscape below altitude
  176.          zero (the blue lines) will be clipped off. The resulting flat
  177.          plane adds a sea or lake surface to the fscape. The sea level may
  178.          be switched on or off without regenerating the fscape (just use
  179.          Redraw).
  180.  
  181. Restore Defaults:  Clicking this button restores the default parameters for
  182.          all controls except the seed number, which will remain unchanged.
  183.  
  184. Hints  [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
  185.  
  186.  -->  When entering text, FScapePlus uses a routine similar to an Intuition
  187.          string gadget. The <-, ->, DEL, and BACKSPACE keys work as you
  188.          would expect. CTRL-X deletes the text, and CTRL-Q restores the
  189.          initial text (AmigaBasic can't read the Amiga keys). Pressing
  190.          RETURN accepts the entire line, regardless of the position of
  191.          the cursor.
  192.  
  193.  -->  FScapePlus uses an eight color screen, since a 16 color screen only
  194.          lets the processor run during the blanking intervals, slowing the
  195.          program dramatically. Even an eight color screen slows the pro-
  196.          cessor somewhat, so when drawing high level fscapes you might
  197.          want to bring the Workbench screen (the control panel) to the
  198.          front. Note that there is one line of the screen title bar peeking
  199.          above the window's title bar. This allows access to the screen's
  200.          front-back gadget. You may also use left-Amiga N and M to switch
  201.          screens.
  202.  
  203.  -->  Since changing levels doesn't affect the terrain of the fscape, only
  204.          the level of detail, you can try various seeds at level four or
  205.          five, then increase the level when you get an fscape you like.
  206.  
  207.  -->  Cycle may be used to try various seeds. When an fscape you like comes
  208.          up, just Stop the cycling. You may now play with the various param-
  209.          eters, or save the fscape to disk. When cycling, the fscape on the
  210.          screen is valid until the next one begins to appear.
  211.  
  212.  -->  The Terrain and Z Scale parameters interact to affect the appearance
  213.          of the fscape. A rugged terrain and a small Z scale factor will
  214.          appear much the same as a flat terrain and a large Z scale factor.
  215.          The difference will be in the coloring. The former will have lots
  216.          of white peaks and deep blue valleys, while the latter will be
  217.          mostly green and light blue.
  218.  
  219.  -->  If you would like to have an fscape that fills the entire screen, with
  220.          no visible edges, just create a level six or seven fscape, then in-
  221.          crease the scale factors until the edges are off the screen.
  222.  
  223.  -->  AmigaBasic is always slower the first time it runs a given section of
  224.          program. Things like the requesters will run faster once they have
  225.          been used the first time.
  226.  
  227.  -->  If you would like to use the custom fscape icon with fscape files you
  228.          have created, instead of the standard Basic project icon, just go 
  229.          into the CLI and copy TestFile.fscape.info to YourFile.fscape.info.
  230.          From the Workbench, drag the two icons apart and put the new one
  231.          where you want it. Click on the new icon, then select Snapshot
  232.          from the Workbench menu.
  233.  
  234. Technical Details  [][][][][][][][][][][][][][][][][][][][][][][][][][][]
  235.  
  236.  FScapePlus is actually two programs which were developed separately and
  237.  then integrated to create the final product. The first is the FScape pro-
  238.  gram itself. It is a fairly direct copy of the MacBasic one in the Creative
  239.  Computing article, converted to an easier-to-read AmigaBasic style. The
  240.  color routine from the ABasiC version was added, and I made changes to the
  241.  routines wherever possible to increase the speed. Going from a 16 color to
  242.  an eight color screen was the biggest speed increaser. The menu routines
  243.  are part of this portion of the program, and were one of the trickier parts
  244.  of the program to write. This is because Basic is slow to update the menus,
  245.  and attempting to use the menus while thay are being updated is Guru-
  246.  baiting of the worst kind. The HELP key isn't very helpful, but I didn't
  247.  have room to do any more.
  248.  
  249.  The second program is the control panel and requesters. These were designed
  250.  in a modular fashion, to allow them to be easily converted to use in
  251.  other programs. Extensive use is made of subprograms, to draw the various
  252.  controls and to handle the requesters.
  253.  
  254.  The locations and titles of the controls are initialized via DATA state-
  255.  ments, allowing them to be easily changed to design different panel
  256.  layouts. Parameters regarding the status and location of the controls are
  257.  kept in arrays, where they may be easily accessed. The number of controls
  258.  may be changed simply by adding or deleting a few DATA and DIM statements
  259.  and adjusting some FOR..NEXT loops. CtrlLoop is responsible for reading the
  260.  mouse, determining which control is selected, and performing the approp-
  261.  riate action. It then calls one of the subprograms to draw the new control
  262.  setting. SetControls and GetControls handle the transfer of important var-
  263.  iables between the two "halves" of FScapePlus.
  264.  
  265.  Three general-purpose subprograms are used. GetString is used to input text
  266.  in a manner approximating that of an Intuition string gadget. StringReq
  267.  implements a pop-up requester that displays a prompt and gathers a line
  268.  of text. It contains a version of GetString. YesNoReq implements a boolean,
  269.  or Yes/No requester. It duplicates much of the code found in StringReq.
  270.  
  271.  Rather than trapping errors, I tried to design the program so that errors
  272.  could not be generated. This is not possible in the area of disk access,
  273.  so ErrorHandler was included to trap the more likely ones.
  274.  
  275. Suggestions for FScapePlusPlus  [][][][][][][][][][][][][][][]][][][][][]
  276.  
  277.  I've had a lot of fun creating FScapePlus, and learned a lot about Amiga-
  278.  Basic as well. There is always room for improvement, however. If you start
  279.  adding things to the program, note that it is extremely close to the maximum
  280.  size that AmigaBasic will load without executing CLEAR first. To get more
  281.  room either delete some comments, or have a "loader" program execute the
  282.  CLEAR and then run the main program.
  283.  
  284.  Here are some things that got left out of FScapePlus 1.0:
  285.  
  286.    The variable rh, defined in FInit, controls the rotation of the fscape.
  287.    The variable vt, also defined in FInit, controls the amount of tilt-down
  288.    applied to the fscape. Making these two values variable would allow the
  289.    fscape to be viewed from any point in space (edge on, straight down,
  290.    etc.)
  291.  
  292.    Controls for letting the user adjust the colors could be added.
  293.  
  294.    The ability to create a script file of pre-saved fscapes to be shown
  295.    sequentially would allow slide shows to be created.
  296.  
  297.    A lot of code is duplicated in the requester routines. By creating sub-
  298.    programs containing the common code the amount of duplicated code, and
  299.    thus the size of the program, could be reduced.
  300.  
  301.    The really enterprising programmer might even make the edges of all of
  302.    the triangles black and color in the interiors, to create a more solid
  303.    looking landscape.
  304.  
  305.  If you make any of these improvements, or any others, I'd like to see them.
  306.  Contact me at the network numbers given earlier.
  307.  
  308.