Contacting Me ------------- The single best way to contact me is via email: Fubster@wadasia.com. I have ICQ and my number is 329663925, although I do not log in to ICQ everytime I am on the computer. If you send me an "add to contact list" request for ICQ, please put the word "Empire" somewhere in the request text so that I can add you as soon as I receive the request. Otherwise (unless I recognize your ICQ nickname), I will send you back a message asking who you are 8). Please do not contact Mark Kinkead or Killer Bee Software about any problems with this DLL. Also, this DLL comes with no warranties or guarantees whatsoever. If you are unhappy with it in any way, feel free to uninstall it at any time. Uninstallation -------------- I know it's unusual to start with uninstallation, but there is a reason. If you already have a version of my DLL installed on your computer, you should uninstall that version before installing the new version. If you do not, then you will end up with multiple versions listed in your "Add/Remove Programs" listing. I thought about getting another installer that handles this correctly, but I thought that you would rather me spend my time and energies adding new features to the DLL. To uninstall, open up "Add/Remove Programs" from your Control Panel (if you do not know how to get to Add/Remove programs, use Windows Help). Find the entry called "Fub.DLL - Fubster's World Build for EDIE" and click on "Change/Remove". You should be prompted with a "Are you Sure?" dialog box. Answer "Yes". The DLL is now removed and you can continue with the installation of the new version. Installation and Setup ---------------------- Download FubDLL.zip and unzip the contents into some temporary folder. The zip file contains the following files: FubWB.CAB, setup.exe, Setup.lst. Double click on the Setup.exe file, this will start the installation routine. When prompted for an installation folder, make sure you specify the folder where Empire Deluxe is installed. This should install 3 files to that folder: Fub.DLL, FubWB.DLL, and Fub.txt (this text document). After the installation is complete, you may delete the temporary foler with the files FubWB.CAB, setup.exe, and Setup.lst. You will have to manually make a change to your ED.INI file, and it is recommended that you make a backup copy first. Edit the ED.INI file and find the line that starts with "WORLDBUILD_DLL" (if you have not changed this line previously, it should read "WORLDBUILD_DLL=WorldBuild.dll"). Change it to read: WORLDBUILD_DLL=Fub.dll Then save your changes to the ED.INI file. Accessing from EDIE ------------------- There are two places you can access the DLL from EDIE: 1) From the Map/Scenario editor, by clicking the menu options Map|Build with DLL (or pressing Alt-D) 2) From the New Game dialog, by clicking the button "Generate Random World with DLL". In both cases, EDIE prompts you with the original parameter screens: a window titled "Choose Your World Building Factors" and another titled "Choose Your City Building Factors". Simply click on OK for both of these windows. Fub.DLL completely ignores these selections. Fubster's World Build User Interface ------------------------------------ If everything is installed/setup correctly, the next thing you should see is the User Interface for Fubster's Random Map Builder. Click on the tabs across the top (labeled "Land Masses", "Terrain and Cities", "Player Cities", "Building Algorithms", and "Shapes") to access the various groups of parameters. Once you have the parameters as you like them, click on the "Build" button to build your world. General Flow ------------ This world build function generates worlds that are mostly water (usually 50% or more) with land masses scattered throughout. Internally, the flow goes something like this: 1) Start with a world cleared to sea. 2) For each land mass requested: 2a) Build the land mass as all Clear Terrain. This is done on a "template" separate from the rest of the world. 2b) Attempt to place the land mass on the world such that it does not overlap previously placed land masses. 2c) All Large land masses are built and placed first, followed by Mediums, then Smalls. 3) Build "Tiny Islands" as requested. These are small groups of adjacent land squares scattered throughout the map. These may end up touching other land masses, and may even connect two land masses. 4) Add Terrain as requested. Notice that this is done on a world-wide basis all at once, so that an individual land mass is probably not going to have an even distribution of terrain. 4a) Mountains are placed first. 4b) Rough is second, and will not overwrite existing mountains. 4c) Forrest is third, and will not overwrite existing mountains or rough. 4d) Rivers are run last, and a river may overwrite existing terrain. 5) Add cities as requested. Cities are randomly placed anywhere on the map where there is already land, and can be placed overtop of existing terrain. Parameters ---------- In keeping with the idea that this is a random map, most parameters are in the form of a "range". You can specify a low value and a high value, and the program will calculate some random value inside that range. If you want a known value for a parameter, simply enter the same value for Lo and Hi. To save typing, there are some strategically placed "Lo = Hi" check boxes. When checked, the effected parameters will allow you to type in a value for the Lo value, and automatically fill in the same value for Hi. There is also a button near the bottom of the window labeled "Set Lo = Hi for All" that checks all of these boxes simultaneously. Land Mass Parameters -------------------- Land masses are segregated into three sizes, Large, Medium, and Small. You can specify how many of each size to build, how big (in squares) each size is, and how wide a border to use when placing the mass (see "Sea Borders" below). Also, you may specify how many total squares to use in placing tiny islands. Note the status bar at the bottom of your window. The first cell shows the dimensions of your map (specified in EDIE prior to calling the DLL). The second cell shows the total number of squares for this map, the result of the map width multiplied by the map height, so this number does include edge sqaures. The third cell shows the percentage of land that results from the current parameters. Notice that this is also in the form of a range. The last two cells are more meaningful after your press "Build", and are covered under "Build" below. Sea Borders ----------- Borders only affect a land mass that is being placed, previously placed land masses no longer have sea borders. Large masses are created and placed first, followed by Medium, then Small. So if you have Large Borders set to 8, and medium borders set to 2, it is possible to have a medium land mass within two squares of a large. Also, borders are created perpendicular only, or NSEW of existing squares. So that a mass with a border of 1 may end up "connected" to another land mass through a diagonal. Also, remember that tiny islands can end up adjacent to land masses, and may connect land masses. Land Mass Placement Options --------------------------- Land masses are built separate from the final map, and there is a separate algorithm for placing a land mass. This algorithm randomly chooses a square on the map, treats this as the center of the land mass, and looks for any conflicts. If a conflict arises, then it picks another spot. This will continue a certain number of times, and when the limit is reached, the algorithm will report placement failure. Certain parameters affect this algorithm: - "Space Large Masses Evenly across Map (6 max)" (default to No): When checked, this will cause the large land masses to be spaced evenly across the map, and the sea border is completely ignored. - "Sea Borders Effect Placement of Mass near Edges" (default to No): If yes, then the sea border will also keep the land mass that far away from any map edge. If no, then the land mass may be placed right up to the edge. - "Allow Mass to be placed where it is partially off edge" (default to No): If yes, then only other land masses will effect placement. Note that since the center of the land mass is used for placement purpose, a large portion of the land mass should still be on the map. - "Force placement if an opening cannot be found" (default to No): [NOTE: THIS PARAMETER IS NOT YET IMPLEMENTED] Terrain & Cities ---------------- The Terrain parameters control the percentage of each terrain that is placed on the final map. All remaining land terrain will be clear. If the percentages entered total more than 75%, then all percentages are dropped until they total 75% or less. This happens internally after you press "Build", and you will not see the values on the screen change. The City parameters control how cities are built and placed on the map. Number = the total number of cities placed on the map. Production % defines a range for the random production percentage assigned to each city. % Specialty controls what percentage of cities will be assigned a specialty. % Coastal controls the number of cities that are placed next to a sea square. A few notes about Cities: 1) When placing cities, the DLL calculates a number for Coastal Cities and a number for Inland Cities. If the map does not have enough coastal or inland squares to accommodate the calculated number, then the DLL places those cities it can, then stops. It will not place additional cities of the other type to compensate for those it could not place. 2) When placing Coastal cities, the DLL does not distinguish between land-locked lakes and the open sea. A city that sits next to a land-locked lake was placed as a coastal city. 3) Cities are only placed on existing land, new land squares will not be created to accommodate requested cities. 4) Terrain is placed prior to cities, and cities will be placed on any land square, overwriting the existing terrain. Player Cities ------------- Currently there are no parameters to control assigning cities to players, all cities are neutral. This tab is simply holding a spot where parameters will be placed in a future version. Building Algorithms ------------------- Currently, the DLL has three different algorithms for building a land mass. Place a check mark next to the algorithms you want to be used. The "weight" beside each algorithm can be any number 1-100. he DLL uses the relative weights for each algorithm to determine which one will be used for each land mass. Each algorithm also has it's own associated set of parameters that control the behavior of that algorithm. To determine how each parameter affects the final land mass shape, I suggest that you select a single algorithm and play around with the parameters. Here is a brief description of each algorithm: - Wandering Blob: First a base, random shape is created. This is done by starting with a single square, then randomly adding squares in "wandering" pattern. After the base shape is created, then entire shape is padded by randomly adding squares to all existing squares. After the "random-even" pad is added, an "erratic" pad is added. - Stick Blob: First a base, random shape is created. This is done by starting with a few scattered squares (points), then connecting them (resulting in "sticks"). After the base shape is created, a "random-even" pad is added, followed by an "erratic" pad. - Shapes: Most of the final land mass is used to create a "known" shape. Then, a "random-even" pad is added, followed by an "erratic" pad. A final note on parameters. The values labeled "Erratic/Evenness" are considered more "erratic" for smaller values, and more "even" for larger values. The value labeled "Loose/Tightness" is considered more "loose" for smaller values, and "tighter" for larger values. Shapes ------ This tab allows you to select what shapes are available for the Shapes algorithm. Currently there are 24 separate shapes available. Any shape that is checked will be in the pool for shapes used in making the map. When a shape is created, there are several factors that determine it's final outcome: - Size: This is determined by the size parameters on the first tab as well as the "Percent of Mass" parameter. - Proportions: Most shapes have proportions that further define its shape. For instance, a rectangle will have a proportion between its width and height. These proportions are randomly calculated within predefined limits internally. - Orientation: Any shape can exist in one of 8 orientations. Think of taking a shape and rotating it 90 degrees 4 times, and also looking at the mirror images of those 4 orientations. That defines the 8 orientations of a shape. Obviously, for some shapes, two or more orientations are equivalent. The circle is a notable exception, as it appears the same in all orientations. The "teardrop" is an easy to see example of a shape that is distinct in each orientation. In fact, if you make a map with shape as the only algorithm, teardrop as the only shape, and set Percent of Mass = 100, you can readily see all 8 orientations (assuming you specify enough land masses). Load Settings & Save Settings ----------------------------- These two buttons give you the opportunity to save the parameter settings to a file, and retrieve those settings from a file. Please notice that if you want to save your settings, you must do so prior to pressing "Build". The first time you press "Load Settings" or "Save Settings", a subfolder named "fubsett" will be created. This is the default folder where all setting files will be kept. Setting files are created with an extension of "fst". Long filenames are supported. If you save a file named "default.fst" in the "fubsett" subfolder, that setting file will automatically be loaded when the DLL is called. This is extremely useful if you want to run the same settings over and over again in rapid succession. Set Lo = Hi for All ------------------- As mentioned earlier, there are some strategically placed "Lo = Hi" check boxes throughout the user interface. Pressing the "Set Lo = Hi for All" button checks all of these boxes simultaneously. Recommend Parameters -------------------- [This feature is not yet implemented] Cancel ------ Pressing the Cancel button will cause the DLL to exit without building a world. EDIE does not provide a way for the DLL to communicate that the user chose to cancel, only the ability to report "failure". So, after pressing cancel, EDIE will report "World Build Function Returned an Error". Build ----- When you press "Build", the DLL starts to do its work. On the status bar, the last two cells keep you informed on the progress. The first one shows some text to explain what is happening internally ("Large - Making", "Medium - Placing", etc.) The second one is a progress indicator, which will grow as the DLL is nearing completion. There are a few situations that will cause the DLL to run slow, and these usually involve the DLL trying to accomplish some nearly-impossible task over and over again until the fail-safe limit is met. Usually this is when the DLL is trying to place a land mass and cannot find a spot to place it. Here are a few conditions that may cause this to happen: - You have requested land mass parameters that result in a land percentage greater than 50%. - You have asked for several large land masses with erratic shapes. The more erratic a shape is the harder it will be to find a spot to place it. - You have asked for large sea borders. Large sea borders make it harder to place land masses. During the build, if you decide that the parameters are not going to give you the desired result, or if the processing is taking too long, press the ESC key. You will then be given the option to cancel the build. If you select "Yes", the build stops and you are back at the parameters form, where you can change your options and press build again, or simply click on "Cancel" to exit without building a random world. History & Technical Stuff ------------------------- I first started writing a graphical map & scenario editor. Since Visual Basic 6.0 has become my language of choice, that is the language I used. At some point during the course of developing the editor, I wanted some random maps to work with. Next thing I know, I had spent almost as much time working on making random maps as I had working on the rest of the editor. So I decided to continue working on the random map maker, and put it out as a DLL prior to finishing the editor. This is when I discovered that VB does not have the ability to create normal DLLs. So, armed with almost no C++ knowledge, I embarked upon creating an ActiveX DLL from the VB code I had written, and then calling that from a regular DLL written in C++. I got through what should have been the hardest part, actually making a successful call, only to discover that I cannot pass an array parameter to the VB ActiveX DLL in a way that the VB code can modify the array! If you are aware of the technical specs for a World Build DLL, then you understand what a huge stumbling block this is. Mark gave me the idea that finally worked. After the C++ "shell" code calls the main function exposed by VB and control returns to C++, the C++ code makes a series of calls to other exposed VB functions, basically sending array position as a parameter, and receiving the value of that position as a return value. While this is not as elegant as an array parameter would be, it is surprisingly quick, even for a max sized map! Here is the history behind the shapes and building algorithms. I started with some code that just placed a single square on the map and randomly added squares until the desired size land mass was created. The problem with this algorithm was that all land masses over a certain size (say 100 squares or so) ended up being the same shape, a roughly circular blob. So I started building known "shapes", then adding random squares to make something unique. (So, looking at the final three algorithms implemented, "shapes" was actually the first one written.) Adding new shapes became as fun to me as anything else; call me a geek, I guess, it is pure geometry and algebra. At the small level, less than 500 or so squares, this worked very well. However, as the land mass grew larger, the base shape became very recognizable. Like my "blob" algorithm, randomly adding a lot of squares simply padded the original shape. So, I played with the concept of limiting where the random squares were added. This was much better, as I was able to achieve a random(ish) coastline, and some large irregularities. As I was working on the "Erratic Pad" part of the shape algorithm, I realized that I could use the same concept to build random blobs with distinct shapes. This led to the Blob version 2 algorithm, which I have renamed the "Wandering Blob" algorithm. I liked the results, and this quickly became my favorite over "shapes". But, I noticed that as I tried to make the shape more interesting, or erratic, the result had a lot of "holes", or land-locked lakes, and this was undesirable to me. Try using 80/3 as the first two values for the Wandering Blob to see similar results. This led to the Blob v3 algorithm, which I have renamed the "Stick Blob" algorithm. Here, the base shape is created by starting with a few scattered squares (points), then connecting them (resulting in sticks). The main problem I had with this was that small land masses tended to end up as mostly sticks with only a few additional random squares. To overcome this I try to ensure that no more than 1/3 of the entire land mass is used in making "sticks". Enhancements & Bug Fixes ------------------------ Version 1.0.5: - Fixed bug that caused DLL to generate an error when the user attempted to alter the Terrain River Low value. Version 1.0.7: - Added the ability to Save and Load settings - Display version information on the form - Enforce the "6 max" rule when the "Space Large Masses Evenly" option is checked. - Do a final check on parameters when user presses build - Make sure at least one buildling algorithm is checked - If the Shapes algorithm is checked, then make sure at least one shape is checked - Provide a warning if average Land % > 50% - Changed the progress text display to include the "|/-\" characters so that the user can see movement even when it may appear "locked up" - Allow the user to stop the processing during build by hitting the ESC key. Known Bugs ---------- - Blows up when the parameters specify zero cities on the map - Blows up when the parameters specify a 0 sized land mass Future Plans ------------ By no means is this the final version of my Random Map Builder. If there is something you would like to see, please email me at Fubster@wadasia.com, I'd enjoy hearing your ideas. Below is a list of possible enhancements. Notice that the items on this list are un-ranked and un-prioritized. There is no guarantee that I will get to any specific item on this list. Please let me know if something on this list is a "hot item" for you. - Enable the "Force placement if an opening cannot be found" option - Enable the "Recommend Parameters" button - Enable "Player Cities" options - Add a message at the end of build that reports on any placement failures - land masses and cities - Add More Shapes - Allow as an option for Large Land masses to have terrain added evenly - Allow as an option to disallow land locked lakes - Allow as an option to not count cities on land locked lakes as coastal cities - Allow as an option to specify that tiny islands will not be placed adjacent to other land masses - Allow Building Algorithm parameters to be specified as a range - Allow Building Algorithm parameters and weights to be specified separately for Large, Medium & Small land masses - Add "spinners" to all parameter value text boxes - Re-work mountain placement routine - try to make mountain ranges that follow a nearby coastline. - Find a calculation to determine if Sea Border size is going to cause unusually long build time Special Thanks -------------- I'd like to offer sincere appreciation to the following EDIE enthusiasts who have offered some their time to help test this DLL, and continue to help through testing new versions. Your feedback has been invaluable to me in putting this auxiliary program together. Thank You! AJ Bryce Jones General Error Gryphin And, of course, a huge thanks and round of applause for the man who made all of this possible by reviving Empire Deluxe: Mark Kinkead