    I have released the first version of Fractal Terrain Mapper, complete with its Linoleum source code. These are the results after only four nights of coding, and the program seems to be progressing at a fast rate. I originally was intending the fractal libraries for use in a game project I've been working on, but have found that they work well for a standalone terrain generation program as well. I have also posted about this in the 'Member's Projects' forum, and most messages should be placed there. This thread is mainly intended for questions and comments about the code itself, and the fractal generation / fractal modifier libraries. Also note that the source for the main file might be a bit less organized than the rest, as it is still in its early stages.
cd/zips/Cryoburner/fractal_terrain_mapp (24 Kb)     

written by Alex on May 28, 2003 01:25 
    This is FASTRAND.TXT, a fast random generator, not even nearly good as the MT19937, but surely faster.
  "workspace"
FR Seed = 1;
FR Range = 1;
FR RND = 1;
"programme"
"fast srand"
[FR Seed]  3;
end;
"fast random"
A = [FR Seed]; A & FFFFh; A * A;
B = A; B & FFFFh; A > 16; A + B;
A & FFFFh; [FR RND] = A; [FR RND] & [FR Range];
[FR Seed] + A; A & 15; B = 1; B < A; [FR Seed]  B;
end;
"ranged fast random"
[FR Range] & FFFFh;
? [FR Range] = 0 > RFR zero range zero result;
[FR Range]>; [FR Range] = FFFFh; => fast random; <[FR Range];
[FR RND] % [FR Range];
end;
"RFR zero range zero result"
[FR RND] = 0;
end;
"fast flandom"
[FR Range] = FFFFh; => fast random;
[FR RND] ,= [FR RND]; [FR RND] ** 0.00001525902f;
end; 
     HTH
to use it, set [FR Seed] to a value between 0 and 65535, more than that is useless, it's cut to 16 bit. Then call "fast srand".
Then to extract an integer, set [FR Range] to what must be the range, it'll return a number between 0 and [FR Range]  1. And call "ranged fast random".
"fast random" is faster, but supposes the [FR Range] to be a bitmask, like 11111b for numbers between 0 and 31, so it can only work by powers of two to "scale" the range.
"fast flandom" needs no range, and returns a random number between 0 and 1, in floating point.
All returned numbers are in variable [FR RND].     

    Thanks Alex... I'll try it out as soon as possible. This could greatly increase fractal generation speed even more. I'll let you know how much faster it makes the huge 4096x4096 heightmap, which currently takes a mere 10 (11 including smoothing) seconds to render on my 667Mhz machine. I may also look for other potential slight speed increases in my code. While I'm at it, I should add a render time notification, and fps for the fly throughs.     

written by Alex on May 28, 2003 16:31 
    It could be further optimized, also. And it's not difficult, just use more registers and/or refit the code of "ranged fast random" so that it embeds "fast random" and doesn't need to push/pop [FR Range]. For a couple easy optimizations, but the concept itself it pretty fast, uses only one integer multiplication, basically.     

    I added a general operation speed display and fps counter for the flythrough last night, and spent the rest of the time optimizing various parts of the code.
I ended up not using FastRand quite yet. While it increases fractal generation speed by an additional 10%, there are some anomalies in the form of horizontal "valleylike" lines that sometimes appear across the resulting heightmap. I may be able to modify it to fix that, or to just access FastRand 9 times out of 10, and random the other time to mix it up enough to remove the problem, but for now, the current method is fast enough.
I did add some other optimizations though, which speed up fractal generation by around 1520% or so, and the animated smoothshaded flythough by around 20% on average. On my 667Mhz system, generation of a 512x512 fractal landscape now takes about 150 milliseconds, with an additional 45 ms to smooth it.
Another addition I plan on adding is a version of the fractal generator that can run in the background of a program, so that it could be use to take a given percentage of processing time, (4 ms worth, for instance) every screen refresh, so that generation could take place silently in the background while one traverses an environment.     

    I don't have a new version of Fractal Terrain Mapper ready yet, so I decided to release an updated version of the fractal generation libraries for those wishing to include them in their programs. These will likely be of little interest to the nonprogrammer, as there is no example program in this download, just the libraries' source files.
The actual generation libraries, Fract2d.txt and Fract3d.txt should be in fully working order. Both have been greatly optimized, a tiny graphical glitch has been fixed, and they now support the ability for the programmer to specify his own target vector, along with a seed for the landscape.
As an added bonus, I have included a preview version of the new FractFX.txt library. You can feel free to make use of the functions contained within it, but I have not documented the source much, aside from providing a brief description of what each function does. Also, I removed a number of incomplete parts of the library, and those that are included may change significantly in future releases.
If you have any comments or questions about these libraries, feel free to ask.
cd/zips/Cryoburner/fractal_terrain_preview_v012 (7 Kb)     

    I'm posting a slightly updated version of Fractal Terrain Mapper and my terrain libraries, since someone was asking about modifying FTM. There's nothing particularly special in this release, aside from relatively minor updates in some areas. Whenever I continue work on a fractal terrain editor, I'll likely start with entirely new code for at least the main program, as pretty much all of it needs to be replaced. The following program and its source can be used however you would like. cd/zips/Cryoburner/fractal_terrain_preview_ (37 Kb) Wierd... Postline cut the name of my file short when I uploaded it. It should be fractal_terrain_preview_v013 Release Notes: This version of the FTM demonstration is VERY UNFINISHED, and I haven't worked on it much in a while, aside from cleaning up a couple areas of the code a little today. The libraries Fract2D and Fract3D should be in proper working order, and have been slightly updated since the .12 version, but should work identically. The FractFX library (which mostly includes postprocessing effects) is mainly in working order, although it includes a couple experimental features that aren't anywhere near finished, and are not very useful as they are. FracMap itself (The FTM demonstration program) is in disrepair, with lots of messy code and some partially implemented features. A few small sections of code can be uncommented to test some of the postprocessing functions from FractFX. The animated views are much faster now, and the smoothshaded animation view now uses a basic lightmap. Also, there is a framerate display for the animated view, as well as another reflecting the time required to generate the raw heightmap. Everthing is now in grayscale, rather than shades of blue, which should make details stand out a little better. There are some controls not listed on the main screen, which do such things as blurring and adding noise to the heightmap and lightmap. The keys for all controls are as follows...   create new 3d fractal: space
create new 2d fractal: enter
next profile of fractal: +
previous profile of fractal: 
autodraw profile of fractal: tab
toggle profile shading: s
enlarge 3d map: >
shrink 3d map: <
decrease elevation of 3d fractal: 1
increase elevation of 3d fractal: 2
round edges of 3d fractal: r
add noise to 3d fractal: *
smooth 3d fractal: /
add noise to lightmap: ]
smooth lightmap: [
new raw lightmap: l
clear fractal: backspace
close program: escape 
     I won't likely develop this version of the FTM demonstration much further, as it would probably be better to start over from scratch. The original version was only written over the course of a few days, and was mainly intended to be a simple test program for the libraries. For that, I think it works well enough, but to be a useful tool for other purposes, it would greatly benefit from an entirely new interface and preview frames. Since that's nearly the entire program, and the code is mostly thrown together to begin with, it makes sense just to replace it all with something better. If anyone would like to add their own features to this, or use parts of it in their programs, they can feel free to do so as they wish.     

