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

[MODCOMP] 16 height levels

Discussion in 'Civ4 - Mod Components' started by ollj, Dec 27, 2006.

  1. ollj

    ollj Warlord

    Joined:
    Nov 21, 2006
    Messages:
    222
    "Level15" creates 15 heightlevels of different brightnesses out of the 3 heightmap-levels, Plains, Hills and Peaks, by adding their overlay brightness to textures of 5 more diferent brightnesses.

    Download v3

    5 texture brightnesses * 3 overlay brightnesses +1 oceanlevel = 16 final brightness-heightlevels.
    (this is a work in progress preview, fixing terrain textures and XMLs takes a while.)

    If ocean, plains, hills and peaks are not enough height detail this adds smoothness, you can easily see a change of 2 or more levels but a height change of a single level takes a closer look:

    (first version. A flat hill made out of 5 different PLAIN grassland textures)

    (second version. blue marble textures.)

    (third version, endgame minimap)

    The fake grassland-bumpmap and the civ4 minimap really helps the illusion of 15 different heights.
    The checker shadow illusion is its archnemesis (the hill is much darker than civ4 standart grass).
    The basic idea is that hills and plains just increase the brightness of the same texture below (they are overlay textures), and the textures below come in different brightnesses to add up to 15 different brightnesses in total.

    concept and reality:

    The right column in the left image, and the upper left square in the right image, shows unchanged textures in comparison.

    Large images of flat PLAIN-hills, For now only onlythey look good because of bad alpha maps in hills and peaks (in large):


    ---how it works:
    It adds copies of desertblend, grassblend, plainsblend, tundrablend and iceblend 5 times in different brightnesses (+0%, +5%, +10%, +15% +20% white) while all of them are 35% darker and have 35% more contrast (been brighter in earlier versions).
    Hills and peaks are replaced with an absolute white texture and an alpha map that adds 25% white for hills and 50% white on peaks so they are just representated by brightness (and 3D heightmap).
    - 35% brightness by default + 10% brighter (middle brightness) + 25% righter by hill (middle elevation) = normal brighness (only contrast suffers decrease, thats why we increased it from the start).

    The result is 15 different brignesses for desert, grassland, plains, tundra and ice.
    Darker versions have more contrast than brighter ones.
    It does not work as good on textres that already have a high saturation, like BLUE ocean.

    Target:
    The actual version is "level15" but the target is "level16", it will create rivers that only flow downwards (I always wanted waterfalls), volumetric oceans of variable height (ice ages decreasing the ocean level), and might enable detailed terraforming (dig a hole here for a canal and stack the earth on a hill for a wall, let the ocean flow trough the canal but not past your hill) and continental drift (I want rivers to be dynamically created by rain from clouds that move upwards on hills that change during the game).
     
  2. NeverMind

    NeverMind Proud to be Russian

    Joined:
    Apr 29, 2005
    Messages:
    618
    Gender:
    Male
    Location:
    Moscow, Russia
    Cool! :goodjob: I would like to see this in the game as soon as possible.
     
  3. kristopherb

    kristopherb Protective/Charismatic

    Joined:
    May 23, 2006
    Messages:
    2,210
    Location:
    British Empire Soul:Tesco
    awesome it looks cool
    but does it work with blue marble?
    have you added defence modifyeirs?
    when the comp make's a map it is it used correctly,like the further away fromthe sea the higher?
     
  4. Gaurav

    Gaurav Prince

    Joined:
    May 14, 2006
    Messages:
    402
  5. ollj

    ollj Warlord

    Joined:
    Nov 21, 2006
    Messages:
    222
    Free hostings are slow on the hollidays.
    Its just many testures with even more optical errors, too ugly for many minor update releases.

    --but does it work with blue marble?
    It just adds new terrains and changes hill and mountain textures, works with both and looks better with one.
    How could I NOT use bluemarble textures to start with?
    I switched to textures that are 90% like blue marble.

    --Have you added defense modifiers?
    Yes but that also added to many bugs because I did it at 4am so the first attempt was useless.

    --When the comp make's a map it is it used correctly,like the further away from the sea the higher?
    This modcomp basically adds the verbs "lower, low, medium, high and higher" to "plains, mountains and peaks.
    It should be simple to make a map creation script that just smoothes "plains, hills, mountains" by slight up or down movement depending on how many plains,hills,mountains are next to it.
    A plain field surrounded by mountains will become "high plains". A mountain peak surrounded by water and coast will become "low peak".
    A high plain is still lower than a low hill and a high hill is still lower than a low peak.

    So ive been working on textures, looks much better in blue marble, except for ice having too much contrast and too much brightness.

    Low hills and low peaks still do not blend correctly into the next lower level, leaving dark borders and a contrast-increasing optical illusion as seen on the middle image.
    15 different height levels also enables a slow 15 tiles long incline, you can place 3 cities along that.

    Anyways, I made a larger mountain (mapsize is medium) with 7-8 diferent height levels (final should be able to have twice the size with the same slow incline):


    low Tundra hills surrounded by higher tundra plains look like larger bluemarble peaks (because more brightness on tundra looke like ice), I wonder how tundra peaks look like...
    Is my monitor so bad or why does it look much better on a small image?

    There are MANY issues especially with many alpha maps if the terrain brightness goes from -35% to +35% brightness.
    You see much contrast on most objects, the same city or unit looks much much brighter on a low level than on a high level due to the checker color illusion.
    This gets ugly with rivers and forests. Too ugly for a release.
     
  6. ollj

    ollj Warlord

    Joined:
    Nov 21, 2006
    Messages:
    222
    Finally got it working, here is a closeup of Mt. Ollj, 35 plots wide:


     
  7. NeverMind

    NeverMind Proud to be Russian

    Joined:
    Apr 29, 2005
    Messages:
    618
    Gender:
    Male
    Location:
    Moscow, Russia
    Thanks, ollj! Already downloaded. I will report as soon as i can play Civ. Not much spare time now, though. New Year is coming! :D
     
  8. NeverMind

    NeverMind Proud to be Russian

    Joined:
    Apr 29, 2005
    Messages:
    618
    Gender:
    Male
    Location:
    Moscow, Russia
    How it is going, ollj?

    I've finally started my first civ game this year and i play it with this mod. It looks pretty cool so far. :)
     
  9. ollj

    ollj Warlord

    Joined:
    Nov 21, 2006
    Messages:
    222
    Spend 2 more weeks with the sdk, trying to add more height types, right after the 2 clueless weeks before, where I tried the same without knowing much about modding.
    Result is accepting that this workaround is the only and best way to add more height levels for now and propably for a long time.

    Added water textures and land textures.
    It sums up to 5 temperature levels with 2 moisture levels in 15 height levels:
    Code:
                 dry:        wet:
    hottest:   lava rock  deep sea abyss
    hotter:    desert     ocean
    temperate: plains     shelf
    colder:    grass      swamp
    coldest:   tundra     ice
    
    Temperatures and moistures can be merged into 10 temperature-moistures by just linking swamp and grass and assuming that colder always equals wetter)
    Then you can also place high shelf/swamp next to low grass/plains to add 5 more height levels.

    Succeeded in giving peaks yields and in adding a "peakyieldchange" modifier to the sdk and python code that works like "hillsyieldchange"; hills removing one food and adding 1 hammer, peaks ... adding 1 gold (all depending on terrain and needing ballancing)

    I paused on the terraforming and mapmaking code, waiting for a helping response.
    Id like to start with something similar to the terraforming code of the "genetic era" mod but this includes lots of cvgamecore.dll editing and i took a break from that and tried some pythoon to make any techtree more colorfull.

    Yield detail issue -> double yields halved by civics:
    To emphatize the differences of twice as many terrain types I need more yields per tile in average.
    Seems like I have to double the average yields per tile (and doube any yield bonus and decrease) or tile yields are too similar.
    The idea is that civics halve all the doubled yields back to normal (with variations between the civics):
    Every of the 5 choosen civics gives 3 times -10% on one of the 3 yields (one civic could give -30% food).
    5 civics add up to 3 times -50% for the 3 yields.
    In average the doubled yields are halved, -50%, (*2*5/10=1) to normal but one doubled yield could go up to -10% (*2*9/10==*1,8) for another doubled yield goes down to -90% (*2*1/10==*0,2)...
    "Doubled yields halved by civics should add a lot of detail and strategy value to the game[/b] (and really confuse the AI) sadly there is a limit of yields per tile in the gamecore.dll and after 2 weeks of triing just to see that adding height types is impossible ive had it with the gamecore.dll for some time.
     
  10. Arexack_heretic

    Arexack_heretic Emperor

    Joined:
    Oct 10, 2006
    Messages:
    1,119
    Location:
    Lugdunum
    Interesting.

    Did you find out how height is added to tiles during mapgeneration?
    I'm looking into that now, but just starting out on python.

    tile-Height (not tobe confused with map-height) determines the way rivers flow, I understand, but is height added to landmasses depending on their size?

    You mention that you are unable to introduce height terrains.
    Is it not possible to do it in python?
    [ If height > iHeight: terrain type is level1] or somesuch

    ---
    I find you effort realy fascinating:

    With a tile.height value|(iH), you can do things such as altering biotopes based on altitude.
    (every +3km of alt.above sealevel = 1 degree colder.) IIRC.

    In python feature generator something like:
    Code:
    lat = ((self.iHeight/2)-iY)-(iH/15)*(self.iHeight)
       If lat >1: lat = 1
       If lat < 0: lat = 0  
    
     
  11. kristopherb

    kristopherb Protective/Charismatic

    Joined:
    May 23, 2006
    Messages:
    2,210
    Location:
    British Empire Soul:Tesco
    Can map scripts (loaded from site)work with this cool mod?

    why does it have to be a non-zip mod?
     
  12. Fiend777Fits

    Fiend777Fits Social Parasite

    Joined:
    Sep 29, 2006
    Messages:
    303
    Location:
    Agrasse Knoll, Texas
    this looks like a nice idea for mods. pre-made maps could use this definitely. but any map generator probably would fubar this. keep up the good work. with all the work that the cfc guys are doing on the sdk code, they probably should get you guys to make civ 5.
     
  13. Jouda

    Jouda .

    Joined:
    Jul 10, 2005
    Messages:
    101
    Location:
    Prague, Czech Republic
    any progress on this, guys?
     
  14. primem0ver

    primem0ver Emperor

    Joined:
    Jun 16, 2006
    Messages:
    1,116
    Location:
    Mesa, AZ
    Sometime in the next year I may write a map script that WONT mess it up. Actually this mod could come in quite handy because it will not just be a script, it will involve SDK code because I am developing a geologic evolution simulator outside of the game that I can use a simplified version in a new map generator class... but we will see if I find the time.
     
  15. Fanatic Demon

    Fanatic Demon Student in Wizardry

    Joined:
    Aug 6, 2004
    Messages:
    403
    Location:
    The Netherlands
    Very intresting mod. I realy hope it will be posible to create the illusion of height difference or simulate it. It would be realy great to so this combines with some realistic global warming effects, where the sea litterly rises after full global warming strikes
     
  16. Mylon

    Mylon Amateur Game Designer

    Joined:
    Nov 4, 2005
    Messages:
    1,013
    Ooo, nice concept. Now if you can add cliffs... Movement would be difficult to get involved since most units only move 1-2 tiles anyway. It's already easy to exploit the default game with a movement 2 unit by moving plains->forest to get the effect of having 3 movement points for only 2.
     
  17. Seven05

    Seven05 Warmonger

    Joined:
    Dec 5, 2005
    Messages:
    2,056
    Gender:
    Male
    Location:
    USA
    It's pretty easy with a map generation script to achieve the results you're looking for without messing with the SDK at all. Well, maybe I should rephrase that, it isn't impossible :)

    The first thing you need to do is generate your maps with a heightfield rather than doing what most currently do and simply assign the plot value (ocean, lanc, hill or peak). There are a lot of open source heightfield generators available, converting them to python would be tedious but not difficult. Translating that into the game's existing plot types and then your textures is considerably easier, the hard part would be the time needed to add all of those as new terrains in the XML but I think you've already done that.

    Now, the good news is that there is a map script out there already that would be relatively easy to modifiy. I've done something similar using that map script and modified versions of cool, temperate and hot versions of the base terrains (excluding tundra and ice of course). Since the map script already simulates rainfall and places grasslands, plains and deserts accordingly and has the temperature data for ever plot readily available it was pretty easy to do.

    The map script you want is called 'Perfect World' you can find it here on the CF forums under map scripts. For an example of how easy it was for me here is a code snippet of the terrain mapping (placing textures basically):
    Code:
                    elif rm.rainMap[i] < self.desertThreshold:
                        if tm.tempMap[i] < 0.11:
                            self.terrainMap[i] = self.ICE
                        elif tm.tempMap[i] < 0.22:
                            self.terrainMap[i] = self.TUNDRA
                        else:
                            if rm.rainMap[i] < (random() * 0.5 + (1 - rm.rainMap[i])) * self.desertThreshold:
                                if tm.tempMap[i] < (random() * 0.25 + 0.75) * 0.35:
                                    self.terrainMap[i] = self.COOLDESERT
                                elif tm.tempMap[i] > (random() * 0.25 + 0.75) * 0.70:
                                    self.terrainMap[i] = self.HOTDESERT
                                else:
                                    self.terrainMap[i] = self.DESERT
                            else:
                                if tm.tempMap[i] < 0.35:
                                    self.terrainMap[i] = self.COOLPLAINS
                                elif tm.tempMap[i] > 0.65:
                                    self.terrainMap[i] = self.HOTPLAINS
                                else:
                                    self.terrainMap[i] = self.PLAINS
    If you're curious the rainmap and temperature map both hold their values for each tile, there is also a heightmap readily available. Once you have the height, temperature and rainfall data for any given tile it's not to hard to get some very realistic terrain types. Each of those maps stores their data as a floating point value between 0 and 1 so simulating a mere 15 altitude levels is no problem :)

    Anyway, take a look at his map script and let me know if you want to colaborate some of our work. I'm not in the mood to edit all of those textures so I'm willing to do your python work in exchange for a few textures :)
     
  18. Faladh

    Faladh Chieftain

    Joined:
    Sep 26, 2010
    Messages:
    15
    Location:
    Rio de Janeiro
    Sorry if im ressurrecting the topic, but however this is a thing i've been seaching since I discovered CIV Row of games...

    There is any work with this add to the game?

    I can think in a lot of things to be done with this, i'm sure that with the time the map creation engeneering and the ai can be teached, however, i think in the way it can be implemented in the game...

    I'm waiting for an answer really thank you in advance ...
     

Share This Page