1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Civ4Edit

Discussion in 'Civ4 - Utility Programs' started by Lamabreeder, Aug 11, 2015.

  1. Lamabreeder

    Lamabreeder Chieftain

    Joined:
    May 11, 2004
    Messages:
    45
    Features of civ4edit

    • Paint plots, terrain, features, boni and rivers
    • Unlimited undo-/redo
    • Select custom-shaped areas to copy, move or delete whole areas at once
    • Regardless of what you do - right mouse button drags the map
    • Rivers can be directly placed with a cursor on the grid
    • Multiple cursor shapes and sizes
    • Zoom with an always visible slide bar
    • Fill
    • Protect coastline option
    • Internal saves to save and reload whole sessions including undo-/redo-history, city positions, resource tables etc. (see below)
    • Edit start positions
    • Edit labels
    • Tolerant load and save - can even load and in many cases save maps without information loss from maps of mods

    Advanced Features:
    • Edit city positions to fine-tune and balance maps. City-Positions give you lots of statistics and are required for the generation commands
    • Generate terrain and distribute resources automatically in all city-positions at once using prior prepared resource-tables

    Negatives:
    • Improvements, units, cities, technologies, diplomatic relations etc. CANNOT be edited with this editor. (It's not intended for that)
    • Uses symbolic graphics for all entities instead of bitmaps. Most of them should be quite obvious, however, the rest is learned fast (I hope)
    • No toolbars (yet), you have to use the menus
    • Requires Java

    For images and a small demo see at the bottom of the post!


    Introduction

    I will for the time being refrain from writing up a comprehensive user guide - most people will not read it anyway. I will, however, explain some of the more advanced or more interesting features of this editor. If you have questions please ask away.


    Download, Installation, Deinstallation

    http://s000.tinyupload.com/?file_id=06451986024305825069

    If the download is not available anymore but you are still interested, let me know and I will reupload it (~30 sec. I can afford that much time.)

    Extract (i.e. with 7zip).

    Use by executing either the jar or the bat. If neither does work, check if you actually do have java installed (JRE is sufficient).

    To deinstall, simply delete all extracted and downloaded files.


    Keyboard

    While using a tool like paint tiles, paint rivers, place start positions or place city positions you can hold down <ctrl> to delete things. This is of course easier than selecting the delete function from the corresponding menu. There are actually a lot of semi-supported keyboard commands available to quickly access different things, but since these are in part very old and cover only a portion of what's there, I will only mention these still very useful ones: <b> (think "back") is for undo, <n> (think "next") is for redo. <m> is for "Distribute Resources, Terrain and Forest (even)".


    Select, Copy, Move and Delete

    The selection mode allows to select a custom shaped area and either copy, move or delete it. First, choose Mode -> Select. Now you can "paint" your selection. All tiles under the hatching are considered selected. Now in the Mode menu choose either "Delete Selection", "Copy and Move Selection" or "Cut and Move Selection". In the first case your selected tiles will be replaced by water. In the latter two cases you now have your selected tiles floating above the regular map, the only difference being that when choosing the "Cut and Move Selection" the originally selected tiles are now water. Drag the floating tiles around until you are satisfied. If you are done, select another Mode from the Mode menu. If you are unsatisfied, just undo.


    Load/Save and Internal Load/Save

    There are two ways to load and save maps. With "Load WBS", "Save as WBS" you are accessing WorldBuilderSave files that Civ4 generates and reads itself. To generate such a file while playing in in Civ4 enter the WorldBuilder (<ctrl>-W) and save the current map (3rd icon from right in the upper right corner, a globus with a downward arrow). The saved WorldBuilderSave file will then be located in a subfolder of My Documents, i.e. Documents\My Games\Beyond the Sword\Saves\WorldBuilder. You can now load this file in civ4edit, modify it and save it back, perhaps under a new name. civ4edit will retain even (most of the) data that it does not know and save them safely back. I will explain the specifics below. "Reimport WBS" does work almost like "Load WBS" with the difference that "Reimport WBS" will not destroy meta data like city positions. This can be useful for doing some editing work outside civ4edit, then returning to civ4edit without losing said meta-data.

    With "Save as internal save" and "Load internal save", however, you are writing more or less the complete session data as a binary file on disk. This file contains not only the map, but also the complete undo/redo-history, resource tables and city positons. It does not contain selections, however.


    "Tolerant" Load and Save

    civ4edit is "tolerant" towards loaded WBS files, which shall mean that it loads and retains all data of that file and faithfully also writes it back, even those that it does not know or does not represent graphically, like units, cities, improvements, unknown resources etc. With a very few very specific exceptions: Unknown terrain and unknown plot types (plot values outside the 0..3 range) will be replaced with ocean. This behaviour was intended, so maps of mods not too different from the regular game could be edited - at least up to a certain degree. I have successfully built FfH2 maps (with only a little final tweaking in the WorldBuilder itself) and even Civ4 - Colonization maps can be viewed - albeit with notable absences of resources, features, and even a bit of terrain.

    This is possible because civ4edit loads WBS files in two steps. In the first step it parses the WBS and builds a tree out of it. In the second step all information is extracted from this tree that civ4edit knows and cares about. When saving the whole process is reversed.


    City Positions and Resource Tables

    The city position mode allows you to place, modify and edit city positions. This is meta-data and does not affect the file if you save it back as WBS. City positions are a planning tool. They calculate a lot of statistics for a given city-position, i.e. the food surplus. You can delete a city position by clicking on its center field again. You can edit which tiles shall belong to it by clicking on the respective tiles of the city position. In this way you can also swap ownership of tiles between overlapping city positions. You can edit some attributes of the city position by clicking on it while holding down <ctrl>. This editable data is interesting for the generation tool.

    The generation tool distributes boni, plots and terrain in all city positions. You can group city positions together by number, so all city positions with the same number belong to the same group. This number is independent of team numbers, by the way. For every group exists a resource table. This is a list of resources to be distributed among the city positions of this group, accompanied by additional parameters. To select this number choose Generation -> Set party. All city positions placed from now on will now have the selected number. If you use Generation -> Edit Resource Table you will access the resource table with this number.

    A resource table is mainly a list of resources who have two additional parameters: amount and frequency. There are three ways to set up a resource: The easiest is to just keep amount at -1. -1 means that standard distribution frequency shall be used. You can also use a positive value and select the frequency field. Then this resource will be distributed with the given relative frequency, or to be precise, 1/frequency. That means that a greater number will lower the occurence of this resource relative to other resources. If you use a positive value and do not select the frequency field then you have set up the absolute number this resource shall be distributed. If you set it to 3 for instance then this resource will be distributed three times.

    A resource table has also a field for food surplus, the amounts of food, shield and trade resources per city position and a field with the "hills percentage". The generation algorithm will distribute resources according to these requirements and then distribute hills or plains until the food surplus is reached - if possible. These values can also be overwritten by individual city positions (<ctrl> - click on the city position while in city position mode). If a hill or plain is chosen next depends on the value of "hills percentage". A value of 100 for instance ensures that only hills and no plains will be generated.

    Because the generation tool requires potentially a lot of resource tables, another table has been introduced to ease the required work somewhat: the master resource table, accessible with Generation -> Edit Master Resource Table. This table allows you to specify values for the paramters of all resource tables as well as control how many resources and of what kind shall be present in a resource table. After choosing Generation -> Generate Random Resource Tables and agreeing to execute this operation all resource tables will be initialized with the values from the master resource table and filled with random resources following the specifications of the master resource table. You can, of course, alter individual resource tables afterwards.

    The proposed method to use the generation tool is this:
    1. Place and edit your city positions. Make sure they have the intended group number.
    2. Edit the map so that city positions have mostly flat grassland for future land tiles and water tiles for, ehm, water tiles. The Generation -> Change City Positions to flat grass command can help in this regard.
    3. Edit the master resource table to your liking, generate random resource tables and alter individual resource tables if you wish.
    4. Use one of the "Distribute Resources etc." commands to actually generate terrain, resources and forest for all your city positions. If you don't like this particular result, undo the operation und use this command again. By the way, the "even" version of the two commands tries to distribute the minus food terrain, well, evenly, while the "accentuated" version tries to put plains on hills and hills on plains.


      Proposed Method to make maps for a mod

      The applicability of this method of course depends on the similarity of the mod to the vanilla game. FfH2 i.e. is acceptably similar (I use this method for this mod successfully), FF is most certainly not.
      • Load up Civ4 with your mod
      • Start a custom game, check all civs and options
      • Start the game and enter world builder
      • Use the tool to convert water to land, then land to water to get rid of anything
      • Save the now empty map as a WBS
      • Kill civ4 or end it regularily, your choice (the latter results in a Civ4 bug for me)
      • Start civ4edit
      • Load the WBS and build your map with civ4edit
      • Save the WBS
      • Start the WBS in Civ4, enter WorldBuilder and make final touches
      • Save the WBS
      • (optional) reopen the WBS in civ4edit to remove units and visibility

      Legal Issues

      This editor is my property and not in the public domain. You may use it for free. All other rights are reserved. This is so I don't lose control over my work. This point is negotiable to a certain extent.


      Known Issues

      Lots of placed city positions slow civ4edit considerably down. I suspect to know the source for this and also a way to speed it up considerably, but this requires work and additionally is low on my list.
      This editor is most certainly not free from bugs. If you find any, let me know. You know the drill: Describe the situation the bug occured in a for me reproducible way. As soon as I find it, I can correct it.


      Plans for the future

      I plan to release the source code - if there are interested parties. I have also a number of planned features for future releases, but very little time to realize them. You may note that the copyright notice spans three years. That is not due to the fact that this editor required that much work but because real life interferred when I was done with perhaps 80% of the work and the development of the last few years was a slow crawl. But since I use my editor myself I will with certainty continue its development, just very slowly. If you have wishes, please let me know, but be aware that my current work speed with this editor as well as my own priority list may put realizing a requested feature in the distant future. The next planned feature is support for FfH2.


      A small demo

      For a small demonstration I chose to quickly construct a new pangea-style map using default parameters of civ4edit (which happen to be the default parameters for civ4's pangea map for standard size). I set 7 city positions for 7 civs, constructed the outline of the continent, distributed rivers and filled the few tiles not covered by city positions with terrain (mountains, hills, desert...). You can see the result in attached images #1 (magnified) and #3 (overview). This took me perhaps 10 minutes. Then I edited the master resource table, generated resource tables and then generated terrain. This corresponded to more or less 3 mouse clicks and was done in approx. 10 seconds. The result is visible in attached images #2 (magnified) and #4 (overview). Finally I started Civ4 and a new scenario using this map. Attached image #5 shows you how attached image #2 finally looks in Civ4. The complete editing process was done within civ4edit, the WorldBuilder was only opened for the screen shot.
     

    Attached Files:

  2. Yin Cognito

    Yin Cognito Chieftain

    Joined:
    May 2, 2016
    Messages:
    87
    Well, this looks visually similar to my own Excel based Civ 4 "planner" from 2016, except that I used text to show the bonuses/improvements/routes/citynames instead of images...
    Spoiler Screenshots :
    Civ IV Plan - File Page.jpg Civ IV Plan - Draw Page.jpg

    One thing I would like to ask you, since you mentioned that your tool can also be used to plan stuff, is how you'd approach an automatic optimization of cities' placement on the map. Me, I've added other features to my editor instead of designing the algorythm which was meant to be the actual purpose of making my tool in the first place, but now I'm going to (finally) tackle this, LOL. As you can see, I'm already calculating all the potential or real tile/city yields for every cell on the map, so the required data is there. The problem is designing a method to simulate the placement of the cities in a selected range so that a certain total yield (in my case the science output of all cities) is the maximum possible ... but avoiding the "brute force"/direct method of filling the range with all the possible city arrangements/combinations, as this would obviously take ages to complete. It's been a while since my computer science classes, but I remember such "optimum fill" things were teached at school (for other, but similar scenarios) - although in this case there is a particularity in that when a city is positioned on the map, it takes away the tiles (and their output) in its range so they can't be used/taken into account for subsequent cities.

    This is just a question, if you feel like you have an opinion on it (or it crossed your mind while you were working on your tool), I'd be interested to hear it. Great job with your editor, by the way!
     

Share This Page