home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
- FScapePlus
-
- Version 1.0 Nov. 1986
-
- By Mike Steed
-
- CIS: 72207,463
- PLink: MSTEED
-
- This program is in the public domain. Feel free to copy and
- distribute it as you see fit. Please retain the credits and
- genealogy information. If you improve this program, or have
- any comments or questions, please contact me via CompuServe
- or PeopleLink.
-
-
-
-
-
- Introduction [][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
-
- FScapePlus is a program to create fractal landscapes. It does this by
- creating a a plane of triangles, the vertices of which are offset in the
- vertical dimension by random amounts. If the number of triangles is suff-
- icient, the plane takes on an appearance much like a landscape. This
- effect is heightened by coloring the triangles by altitude, and by the
- optional addition of a sea level. FScapePlus has several enhancements
- over its predecessors. It has been optimized to be much faster. When
- storing an fscape file to disk, only the seed and drawing parameters need
- to be saved, instead of the entire fractal array. And most importantly,
- an easy to use mouse operated control panel has been added, allowing easy
- adjustment of the various drawing parameters to encourage experimentation.
-
- Genealogy [][][][][][][][][][][][][][][][][][][]][][][][][][][][][][][]
-
- FScapePlus has an interesting history. It is based on the ABasiC program
- Fscape by David Milligan and Ted Ingalls, which was adapted for the Amiga
- from a Macintosh Basic program by Michiel van de Panne that appeared in the
- July, 1985 issue of Creative Computing, which was in turn based on an
- article in the September, 1984 issue of Scientific American. FScapePlus
- also incorporates several changes in the drawing routines suggested by
- Danny Cory in the November, 1985 issue of Creative Computing which increase
- its speed. I have made further speed enhancements, such that the program
- now runs three times as fast as the original. The control panel is also
- mine. It, and the text input and requester routines, are part of a library
- of pre-written routines I use when creating programs.
-
- Requirements [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
-
- FScapePlus requires AmigaBasic. The program needs 80K in addition to the
- 130K or so that Basic requires, therefore a 512K or larger Amiga is also
- required. FScapePlus has been designed to use 80 column text only.
-
- The Menus [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
-
- The Project Menu =======================================================
-
- The Project menu is the main control menu for FScapePlus. It is used to
- create and draw new fscapes, or to redraw existing ones. A cycle mode
- is provided to show off the program.
-
- New: Generates and draws a new fscape. If automatic seeding is enabled
- a new random seed will be generated, otherwise the current seed
- will be re-used.
-
- Redraw: Redraws the current fscape, if one exists. When experimenting
- with scaling factors, positions, or sea level, Redraw is faster
- than New. Redraw will not display a change in level or terrain.
-
- Cycle: Continuously creates and draws random fscapes. The auto-seed
- switch does not affect Cycle.
-
- Stop: Stops a New or Redraw in progress. Drawing must be stopped before
- other menu items will be enabled.
-
- Quit: Quits FScapePlus. You may exit to BASIC, or return to the Work-
- bench.
-
- The File Menu ==========================================================
-
- The File menu is where one comes to create and use disk files containing
- the information necessary to recreate any fscape. The File menu is enabled
- only when using the control panel, since AmigaDOS requesters only appear
- on this screen.
-
- Load: Prompts for a filename, then loads that file and displays the new
- control settings. The suffix ".fscape" will be added to the file-
- name; do not enter it yourself.
-
- Save: Prompts for a filename, then saves the current control settings to
- that file. Auto Seeding is always set to off. The suffix ".fscape"
- is appended to the filename.
-
- The Window Menu ========================================================
-
- FScapePlus has two windows: the display window is where the fscapes appear,
- and the control panel is where one may adjust the various parameters that
- affect how the fscape is drawn.
-
- Display: Selects the display window, and enables the drawing menu
- commands.
-
- Control: Displays the control panel, and enables the File menu.
-
- The Color Menu =========================================================
-
- FScapePlus can't actually dump an fscape to a printer, since that requires
- access to the printer.device, but it can make life easier for a screen
- print program like ScreenDump or Scrimper.
-
- Normal: Sets the display colors to their normal values.
-
- Color Print: Sets the background color to white, so that printing on a
- color printer won't wear out the black ribbon.
-
- B&W Print: Sets the background color to white, and all the other colors
- to black, suitable for printing on a black and white printer.
-
- The Control Panel [][][][[][][][][][][][][][][][][][][][][][][][][][][]
-
- The control panel greatly increases the "play value" of FScapePlus. It
- provides an easy, Intuition-like way to adjust numerous parameters that
- go into the drawing of an fscape. All of the control panel settings are
- saved when an fscape is saved to disk.
-
- Terrain: This slider varies the roughness of the fractal terrain. When
- set to Flatlands, very little variation in altitude will be ob-
- served. When set to Rugged, the peaks and valleys will be off
- the screen unless the Z Scale is reduced to compensate.
-
- Horizontal Position: Moves the fscape horizontally on the screen. Most
- useful when the size of the fscape has been reduced.
-
- Vertical Position: Moves the fscape vertically on the screen. Most useful
- when the size of the fscape has been reduced.
-
- X, Y, and Z Scale Factor: These sliders control the size of the three
- dimensions of the fscape. X and Y control the horizontal dimensions
- in a manner that is difficult to generalize, and Z controls the
- vertical dimension. They may be adjusted together or seperately
- to size and/or distort the image.
-
- Level: This selector controls the resolution, or number of triangles in
- the fscape. Level one has four, level 4 has 256, and level 7 has
- 16384. Each increase in level takes four times as long to draw.
- The default level of 5 results in a reasonably detailed fscape,
- without taking forever to draw. A level 7 fscape is very detailed,
- but takes nearly a half hour to draw. The overall terrain of the
- fscape remains the same regardless of level.
-
- Seed Number: This number is the seed to the random number generator that
- is used to create the fscape. A given seed will always create the
- same fscape. Clicking on the Seed box will allow you to enter
- a seed number of your choice.
-
- Manual Reseed: Click this button to generate a new random seed number.
-
- Auto Seeding: If this switch is set to On, a new random seed will be gen-
- erated whenever New is selected from the Project menu. Entering
- a seed manually will disable Auto Seeding, to prevent the new seed
- from being changed before it can be used. The Cycle option on the
- Project menu always generates random seeds, regardless of the
- setting of this switch.
-
- Auto Screen Clear: When this switch is On, the screen will be cleared
- before a new fscape is drawn. If you have scaled down the fscapes
- and would like to draw several on the screen at once, just click
- this switch to Off.
-
- Sea Level: When this switch is On, the portion of the fscape below altitude
- zero (the blue lines) will be clipped off. The resulting flat
- plane adds a sea or lake surface to the fscape. The sea level may
- be switched on or off without regenerating the fscape (just use
- Redraw).
-
- Restore Defaults: Clicking this button restores the default parameters for
- all controls except the seed number, which will remain unchanged.
-
- Hints [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
-
- --> When entering text, FScapePlus uses a routine similar to an Intuition
- string gadget. The <-, ->, DEL, and BACKSPACE keys work as you
- would expect. CTRL-X deletes the text, and CTRL-Q restores the
- initial text (AmigaBasic can't read the Amiga keys). Pressing
- RETURN accepts the entire line, regardless of the position of
- the cursor.
-
- --> FScapePlus uses an eight color screen, since a 16 color screen only
- lets the processor run during the blanking intervals, slowing the
- program dramatically. Even an eight color screen slows the pro-
- cessor somewhat, so when drawing high level fscapes you might
- want to bring the Workbench screen (the control panel) to the
- front. Note that there is one line of the screen title bar peeking
- above the window's title bar. This allows access to the screen's
- front-back gadget. You may also use left-Amiga N and M to switch
- screens.
-
- --> Since changing levels doesn't affect the terrain of the fscape, only
- the level of detail, you can try various seeds at level four or
- five, then increase the level when you get an fscape you like.
-
- --> Cycle may be used to try various seeds. When an fscape you like comes
- up, just Stop the cycling. You may now play with the various param-
- eters, or save the fscape to disk. When cycling, the fscape on the
- screen is valid until the next one begins to appear.
-
- --> The Terrain and Z Scale parameters interact to affect the appearance
- of the fscape. A rugged terrain and a small Z scale factor will
- appear much the same as a flat terrain and a large Z scale factor.
- The difference will be in the coloring. The former will have lots
- of white peaks and deep blue valleys, while the latter will be
- mostly green and light blue.
-
- --> If you would like to have an fscape that fills the entire screen, with
- no visible edges, just create a level six or seven fscape, then in-
- crease the scale factors until the edges are off the screen.
-
- --> AmigaBasic is always slower the first time it runs a given section of
- program. Things like the requesters will run faster once they have
- been used the first time.
-
- --> If you would like to use the custom fscape icon with fscape files you
- have created, instead of the standard Basic project icon, just go
- into the CLI and copy TestFile.fscape.info to YourFile.fscape.info.
- From the Workbench, drag the two icons apart and put the new one
- where you want it. Click on the new icon, then select Snapshot
- from the Workbench menu.
-
- Technical Details [][][][][][][][][][][][][][][][][][][][][][][][][][][]
-
- FScapePlus is actually two programs which were developed separately and
- then integrated to create the final product. The first is the FScape pro-
- gram itself. It is a fairly direct copy of the MacBasic one in the Creative
- Computing article, converted to an easier-to-read AmigaBasic style. The
- color routine from the ABasiC version was added, and I made changes to the
- routines wherever possible to increase the speed. Going from a 16 color to
- an eight color screen was the biggest speed increaser. The menu routines
- are part of this portion of the program, and were one of the trickier parts
- of the program to write. This is because Basic is slow to update the menus,
- and attempting to use the menus while thay are being updated is Guru-
- baiting of the worst kind. The HELP key isn't very helpful, but I didn't
- have room to do any more.
-
- The second program is the control panel and requesters. These were designed
- in a modular fashion, to allow them to be easily converted to use in
- other programs. Extensive use is made of subprograms, to draw the various
- controls and to handle the requesters.
-
- The locations and titles of the controls are initialized via DATA state-
- ments, allowing them to be easily changed to design different panel
- layouts. Parameters regarding the status and location of the controls are
- kept in arrays, where they may be easily accessed. The number of controls
- may be changed simply by adding or deleting a few DATA and DIM statements
- and adjusting some FOR..NEXT loops. CtrlLoop is responsible for reading the
- mouse, determining which control is selected, and performing the approp-
- riate action. It then calls one of the subprograms to draw the new control
- setting. SetControls and GetControls handle the transfer of important var-
- iables between the two "halves" of FScapePlus.
-
- Three general-purpose subprograms are used. GetString is used to input text
- in a manner approximating that of an Intuition string gadget. StringReq
- implements a pop-up requester that displays a prompt and gathers a line
- of text. It contains a version of GetString. YesNoReq implements a boolean,
- or Yes/No requester. It duplicates much of the code found in StringReq.
-
- Rather than trapping errors, I tried to design the program so that errors
- could not be generated. This is not possible in the area of disk access,
- so ErrorHandler was included to trap the more likely ones.
-
- Suggestions for FScapePlusPlus [][][][][][][][][][][][][][][]][][][][][]
-
- I've had a lot of fun creating FScapePlus, and learned a lot about Amiga-
- Basic as well. There is always room for improvement, however. If you start
- adding things to the program, note that it is extremely close to the maximum
- size that AmigaBasic will load without executing CLEAR first. To get more
- room either delete some comments, or have a "loader" program execute the
- CLEAR and then run the main program.
-
- Here are some things that got left out of FScapePlus 1.0:
-
- The variable rh, defined in FInit, controls the rotation of the fscape.
- The variable vt, also defined in FInit, controls the amount of tilt-down
- applied to the fscape. Making these two values variable would allow the
- fscape to be viewed from any point in space (edge on, straight down,
- etc.)
-
- Controls for letting the user adjust the colors could be added.
-
- The ability to create a script file of pre-saved fscapes to be shown
- sequentially would allow slide shows to be created.
-
- A lot of code is duplicated in the requester routines. By creating sub-
- programs containing the common code the amount of duplicated code, and
- thus the size of the program, could be reduced.
-
- The really enterprising programmer might even make the edges of all of
- the triangles black and color in the interiors, to create a more solid
- looking landscape.
-
- If you make any of these improvements, or any others, I'd like to see them.
- Contact me at the network numbers given earlier.
-
-