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

rethinking the terrain

Discussion in 'Civ4 - Fury Road Modpack' started by davidlallen, Aug 31, 2008.

  1. davidlallen

    davidlallen Deity

    Joined:
    Apr 28, 2008
    Messages:
    4,743
    Location:
    California
    We've explored a few technical approaches to make the ruins look better, and it has kind of stalled. This thread is to find a better solution.

    From the original version up through today (version 9), the city ruin is a terrain feature. Various resource/bonuses appear on it such as the ruined depot, airbase, silo, and munitions. The resources are hidden until you develop a certain technology. Each resource has a related improvement.

    So there are several stages for viewing the plot.
    1. Start: looks like any other city ruin
    2. Early: looks like a ruin but has a new object, say a ruined depot, on it
    3. Late: rebuilt depot, no ruin buildings

    Stage 3 looks fine, stage 1 and 2 don't look good today.

    The problems

    In stage 1, the basic ruin is a simple circle of ruined ancient buildings. So if you have a multi-plot area of ruins, you get a set of circles instead of one larger shape. Thanks to geomodder and refar, we have tried some other possibilities.

    We could make a set of nifs which provide curving edges, so that two adjacent plots of ruins look like an oval instead of two circles, or a rectangle. That would be some work but at least we understand how to do it.

    We can make a nif which fills the full square. But then the buildings get placed on top of rivers, roads, or sometimes coast. Refar has investigated the way trees avoid rivers; details in this thread and posts around here. Oddly, the conclusion is that we can make a nif which avoids rivers, but then the buildings sway like trees do. It's a disconcerting effect.

    In either case we could use better buildings, such as the ruined buildings used in the actual city/town/village. But neither of these solutions is really ideal.

    The problem with stage 2 is that the new object, say the depot, is drawn on top of the existing buildings. It would be nice if the buildings re-arranged themselves like with the L-system, to avoid buildings on top of each other. There is a small problem with stage 3, which I am a little surprised nobody has pointed out; the improvement gets drawn over the bonus, and sometimes the shadows overlap. You can see a graphical "shimmer" when this happens, or a flicker between the ruined building and the non-ruined one.

    Possible solutions

    Maybe the solution is to have a set of ruin resources, instead of trying to use terrain. If it was a resource, it could use the L-system to avoid rivers. We would need a base graphic plus a separate graphic for each ruined object: depot airbase silo munitions. But, then how do we handle the reveal? Before a player has salvaging, they can't see the depot. If one player has salvaging and another doesn't, one player can see it and the other can't. That is why I made the ruin a "feature" and the depot is the improvement. So the depot can be revealed separately.

    I am sure I could use python to swap graphics when the technology is achieved. But for multiplayer, I cannot think of any way to do it. If somebody else achieves salvaging before you do, suddenly you see the new graphics on the plots.

    I can't think of any other way to mix up existing features, resources, improvements to get this effect. If only the buildings didn't sway :-(
     
  2. Refar

    Refar Deity

    Joined:
    Apr 10, 2005
    Messages:
    4,608
    A possible solution could be making the Ruines pre-existing "improvement" - improvements can use LSystem...

    This solves the problem of revealing ressurces - they would apper under the improvements.

    This does however cause another problem - AFAIK 2 Improvements can not co-exist in one plot. So once you improve your Deopot, the ruines would be gone :(
    Also it would make Ruines pillage-able, wich we dont really wan't...
     
  3. davidlallen

    davidlallen Deity

    Joined:
    Apr 28, 2008
    Messages:
    4,743
    Location:
    California
    I don't understand how the L-system solves the problem that some players can see the depot, and some players can't? Suppose there is a depot between you and me, I have salvaging, and you don't. I can see the depot, but you can't. This works for vanilla resources on features. I had to hunt a little for an example, but uranium on jungle is an example. You see jungle, I see jungle plus uranium, and the game manages it.

    I can probably make xml/python to allow building a depot improvement on a ruined depot improvement; but I can't make the depot visible differently to different players. Or at least I don't know how.
     
  4. Refar

    Refar Deity

    Joined:
    Apr 10, 2005
    Messages:
    4,608
    Because the depot would stay a bonus. A bonus can co-exist with a improvement on a plot.
    So it won't be revelead the the player who does not have the required tech.

    If you have Heavy arms, but i dont, you will se a plot with the Depot Bonus and Ruins improvement, while i would only see the ruines improvement.

    Once you rebuild the depot (replacing the Ruines improvement with a Rebuilt Depot improvement) i will of course see the rebuilt depot as well - but it's how it is right now (and how it is in the unmodded game) too.

    The only problem here is, that rebuilding the Depot will permanently remove the Ruines...

    -----

    EDIT.: I should note - using LSystem does not solve all our goals as well...
    + It would allow us to get ruines "cutting", so we have free roads and rivers,
    + It will give us some randomness in the ruin composition.
    - LSystem handles each plot sepatately (meaning it will not give us tiling)... Compare late game mature cottages.
    We can probalby do a little better - tweak the productions a bit, so we dont have round blobs, and the ruines spread out a bit, but most likey there still will be a visible separation between adjacent ruine plots.

    So while it would be a step forward from the current single-nif ruines, it's still not exactly what we want.
     
  5. davidlallen

    davidlallen Deity

    Joined:
    Apr 28, 2008
    Messages:
    4,743
    Location:
    California
    So ruins is an improvement which appears by default. Whenever there is a ruined depot it is a bonus on the same plot, and it is conditionally revealed by salvaging. When the depot improvement is built, I would have python code which removes the ruin improvement and puts the depot improvement. I'm not sure how to keep the ruin improvement from being pillaged, I have to look into that. And if the depot improvement is pillaged, I would have python code to re-add the ruin improvement. Is that right?

    Today I have a ruin feature, ruined depot bonus, and depot improvement. The only thing I completely don't know how to do is the L-system part. Could you make an L-system fragment which shows how the proposed ruin improvement and ruined depot bonus would work together?
     
  6. Refar

    Refar Deity

    Joined:
    Apr 10, 2005
    Messages:
    4,608
    You don't need any python code here - it's strictly XML
    When a rebuilt depot improvement is built, it will automatically remove the ruins.

    Imagine standard game...
    You built a cottage...
    Then a later tech reveals uranium under this cottage...
    Only the people who have the Tech (fission) can see uranium under the cottage. Everybody else still see just a cottage.
    When you mine the uranium, your new mine replaces the cottage...
    At that point people who have fission can see mined uranium. People without fission see a grassland mine (and can guess that you probably mined uranium there...)

    EDIT:
    Ok, you need Python, is if you want to re-add the ruines after the rebuilt depot is destroyed/pillaged again - but that's it.

    ------

    I will set it up in XML.
    Will also let us better evaluate if we really like the visual... (See Edited note in my previous post)
     
  7. Refar

    Refar Deity

    Joined:
    Apr 10, 2005
    Messages:
    4,608
    Ok, here is a tech demo on placing the Ruines via LSystem.

    The gameplay functionality i described in my post above.

    I declared a new IMPROVEMENT_PREWAR_RUINS and made it be handled via LSystem. I didn't remove the FEATURE_RUINS nor did i change the map script, so you need to put some prewar ruins in Worldbuilder to see it.

    It also uses just one building model right now, which of course can be expanded for more randomness, if we decide to go this way....

    Here's the same ruins field before/after Salvaging tech.
    You can see they avoid roads and rivers;
    You can see after ressources get revealed, they appear under the Ruins;
    You can also see the ruins cut on Ammo after it was revealed (because it's stock Aluminium) - so it's possible to make them cut on Depot/Airbase, when these appear, as well.


    Here's a shot of a bigger ruines field.
    We see good random look, and we can see it adequately handling Roads and Rivers.
    However, we can see as well, that there is visible separation between plots.
    This is something we might be able to tweak a little bit, but can not overcome completely.
    LSystem handels each plot separately, and tries to avoid them cutting into each other.


    Now the caveeat...
    LSystem apparently does not adjust to terrain height... So ruins on hills will look odd.
    Compare the unmoded Cottage - it is not adjusted to terrain either - it is just less visible on cottages, because they are centred in the plot - a effect we sought to avoid on ruins.


    -----

    Another Notes...

    On Gameplay...

    Revealing ressources works fine - as described above.
    However, as it is now, Ruins can be Pillaged, and they are removed if we put another improvement there...

    We can probably make other improvements built on ruines look right (Salvage Center, rebuilt stuff) by adding some ruined buildings around them via LSystem.

    Python code will be needed to make them come back if the Improvement is pillaged, to prevent pillaging the ruins them self.

    -----

    On Graphics...

    Most you see in screens - still a recap:
    + Cutting on Roads/Rivers
    + Random Look

    Blending in with additional stuff in same plot (Ressources, Salvage Centers, Rebuilt Depots) might be some hassle, but is possible.

    - Visible plot separation
    - Does look bad on Hills (this is a big one)

    -----

    There is another graphics issue - the city set we are using is quite high poly (~ 15 times the normal budget).
    It bugged me all the time, however so far was not too apparent, because it was used only on cities and - relatively rare - cottages.

    However with the ruines, there will be
    a) [a lot] more plots with these buildings and
    b) [a lot] more buildings per plot - because we want to avoid separation as much as possible, so we need to cover the plot well...

    We are talking 100.000+ Polygones per plot here.

    The fields you see in above screenshots already caused a [minor] slowdown on my computer.

    So overall, if we go this way, city set will need re-doing.

    -----

    I am not sure if i like the whole thing or not... (I.e. the hills issue causes concern)... Then again... It might be the closest thing we can get to what we actually want...
     
  8. davidlallen

    davidlallen Deity

    Joined:
    Apr 28, 2008
    Messages:
    4,743
    Location:
    California
    Wow, that was fast. I am surprised the L-system doesn't compensate for hills. Some improvements like mines and windmills are designed to go on hills or plains; do those work correctly?

    One thing I have seen on some building models is what I would call a "deep foundation" -- basically a cube of basic grey color which extends down really far. So if a building is sitting on a hillside, you can see part of the foundation rather than seeing it float. It doesn't look great if the entire building is way up in the air, but it is better than floating.
     
  9. KillerClowns

    KillerClowns Emperor

    Joined:
    Oct 6, 2007
    Messages:
    1,139
    I reckon you should steal the "deep foundation" for the ruins as well... it's simple, and not particularly pretty, but it works alright for Vanilla... even of it's only as a temporary measure.
    They're using the foundation on cottages on that last screen shot, and it doesn't look too bad (EDIT: from a distance).
    If you really wanted to cheat, you could just have ruins not appear on hills...
     
  10. Refar

    Refar Deity

    Joined:
    Apr 10, 2005
    Messages:
    4,608
    Well, i only put one building art node in it, and did not do any tweaking yet...
    "Doesn't compensate" is a bit wrong - it does place everyting at one level - roughly matching the hill top. So they do look ok on Hills, if they are placed in the center of a plot and not stretch out...

    But i am a bit surprised as well... I was expecting the LSystem to adjust... However comparing with the unmodded cottages from the base game, we must conclude, that it doesn't... :(

    Mines and Windmills are not handled by the LSystem at all, as far as i can tell - they are placed as is - again on the top of the hill.
    Yes, usually all city buildings shoudl have it. If i and up redoing the ruis anyway to cut polycount, i can easily add these fountations... But as you said - it won't look great...
    Keep in mind, these cottages in the screenshot cover only 40% of the plot.
    We want to cover the entire plot, so our foundations will have to cover much more elevation - we will have roughtly the foundation beeing as high as the above ground part of the building.
    Actually i was thinking a bout this as well. We could argue, that the ruines only survived in the valeys, beeing somewhat shileded vrom destruction, while these on the hills were swept away by the armageddon...
     
  11. Refar

    Refar Deity

    Joined:
    Apr 10, 2005
    Messages:
    4,608
    I have found a additional parameter in the LSystem definition, that will enable adjustment to elevation.

    It is unfortunately not enought - the buildings in the outer area of the plot are still floating...

     
  12. davidlallen

    davidlallen Deity

    Joined:
    Apr 28, 2008
    Messages:
    4,743
    Location:
    California
    Based on the roof heights, it seems to be adjusting, but not enough. That is strange. At least it will look "better". With deep foundations also, would it look "good enough", do you think?

    I am not in favor of preventing ruins on hills; it is a common strategy to build cities on hills. Even if the buildings are destroyed, it's not like they would blow into the next plot; the ruined materials, which are the point, would still be there.
     
  13. Refar

    Refar Deity

    Joined:
    Apr 10, 2005
    Messages:
    4,608
    I am not sure. It's definitely a improvement, even if just making the whole thing less uniform. But there is still some serious floating - you can see in the low-right inset - so the foundations would have to be quite high.

    I have the idea of making foundations look as part of the building - so you wouldn't see a immensely high foundation - just the ruins on the outer ranges would have 2 more floors. But i am not quite sure how it will turn out...

    Perhaps i should make another "test box" ? Despite looking ugly they give us a idea of how the final thing might look like.
     
  14. Refar

    Refar Deity

    Joined:
    Apr 10, 2005
    Messages:
    4,608
    Here's a preview with a somewhatdifferent test box, showing how the "deep foudations" might look like. Note how much height difference the foundation still has to overspan - despite "forcingGround"...



    Overall i am not too happy... But concidering the other options, it might be bearable. Adding different buildings will brak the patterns a bit. I do also have a trick in mind:
    Putting some buildings (maybe 20%) below ground level - we can't controll where they are placed - its random - if they end up right on the top if the hill, they will leave a small gap - not that bad i think, concidering its ruins anyway... - but on the lover levels they will look just tight.

    This would requre to make separate improvements for Hill/Flat - as came up in the other thread.
     
  15. Refar

    Refar Deity

    Joined:
    Apr 10, 2005
    Messages:
    4,608
    Ok, we know for sure now, that we can not use the TREE_TILING without getting the sway effect.

    I think this leaves us with the LSystem beeing the best option, despite the height adjustment issue. If you want to go this way, i will try to put a new set of ruins together, to better support the LSystem placement.
     
  16. davidlallen

    davidlallen Deity

    Joined:
    Apr 28, 2008
    Messages:
    4,743
    Location:
    California
    It seems like the L-system may be worth considering, although I am a little concerned about floating buildings on hills. I can reduce this a little by preventing any of the "ruin improvements" such as depots on hills; that is a small change to the mapscript.

    In order to get started, the mapscript needs a change to put IMPROVEMENT_PREWAR_RUINS instead of FEATURE_RUIN. There are only two places where this happens (search for FEATURE_RUIN in PublicMaps/Fury_Road.py). If the change isn't clear let me know and I can easily make it.

    In case of pillaging a rebuilt depot, I will need to add python code to put back the prewar ruin improvement, but that is relatively minor.

    The big change is to the L-system XML to handle the various building combinations, right? Plus creating the ruin nif; but you have a preliminary version of that.
     
  17. Refar

    Refar Deity

    Joined:
    Apr 10, 2005
    Messages:
    4,608
    Yes creating combinations i will need to look into - as it is set rgiht now, rebuilding a depot will replace the ruin improvement and hence completely remove any visible ruins.

    I know from other bonuses, that it is possible to mix somehow - like farms built over bonuses for example. But i will have to look how to reproduce this.
     
  18. davidlallen

    davidlallen Deity

    Joined:
    Apr 28, 2008
    Messages:
    4,743
    Location:
    California
    Er, the current behavior in the release version is that when a depot is rebuilt, all the ruins disappear. That is useful, since it makes the fact that it is rebuilt stand out more. I think the tricky stage is where the ruined depot is revealed, ie, you have salvaging, but you haven't rebuilt it yet. In *that* case, the ruined depot shares the plot with ruined buildings. Maybe that is what you meant, at any rate that seems to be the part where the L-system needs to make the ruin buildings interact with the depot buildings.
     
  19. Refar

    Refar Deity

    Joined:
    Apr 10, 2005
    Messages:
    4,608
    I actually meant both - if arranged in orderly fashion and without intersection, i think some ruins around a rebuilt depot might add to the look.

    The same should work - perhaps with some more ruines, and in less orderly fashion - on revealed but not yet rebuilt depots.

    Once i figured out how to merge these within the LSystem tree, adjusting the details shouldnt be a problem.
     

Share This Page