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

Custom Layout Engine

Discussion in 'Civ4 - Creation & Customization' started by Jean Elcard, Jun 23, 2007.

  1. Jean Elcard

    Jean Elcard The Flavournator

    Joined:
    Feb 26, 2006
    Messages:
    1,008
    Location:
    Leipzig, Germany
    I suppose you know the file "Civ4CityLSystem.xml"? Its main reason is to make buildings visible on the map. So far so good.

    My intention was to allow lighthouses for inland cities, so you are able to get a food bonus for water tiles in the city radius. That part was easy. Now I wanted to put the lighthouse on th map. No trouble either. The problem is, it looks a bit weird to have a lighthouse in the city center.

    My idea is now to put it in on a free water tile outside the city but in the city radius. I think I have to write a new custom layout engine for this, because similiar code already exists for aqueducts in the file mentioned above. Supposedly to connect the aqueduct to a hill in the city radius:

    Code:
    <LNode Name="BuildingsUsingCustomLayoutEngines">
    ...
    <ArtRef Name="building:BUILDING_AQUEDUCT">
    	<Attribute Class="Scalar">szSpecialLayout:CityCenter</Attribute>
    	<Attribute Class="Scalar">szBuilder:AqueductBuilder</Attribute>
    	<Attribute Class="Scalar">bLayoutAfterGenerics:0</Attribute>
    	<Attribute Class="Scalar">bNoContour:1</Attribute>
    	<Rotate>45</Rotate>
    </ArtRef>
    ...
    </LNode>
    
    But how am I going to do? I couldn't find anything like "SpecialLayout", "AqueductBuilder" or "CustomLayoutEngine" in the Python or SDK source code. Maybe I'm just stupid or it doesn't exist at all, but I still hope somebody might be able to help me out here. Any ideas where to look or what to do? Thx.
     
  2. Jean Elcard

    Jean Elcard The Flavournator

    Joined:
    Feb 26, 2006
    Messages:
    1,008
    Location:
    Leipzig, Germany
    No ideas? What a shame. :(

    I couldn't find a way eiter, so I decided to start another approach by adding lighthouses as tile improvements. Not so easy to understand for the AI but for a human player very handy.

    The idea is to create a unit called "Lighthouse Construction Set" which is kind of a mechanical worker (imagine it as a heap of stone and wood which can move around. It can only build the lighthouse improvement once and vanishes afterwards. This part is already done.

    Now my problem: How can I restrict the availability of this improvement to tiles bordering to water and disable it everywhere else?

    Edit 1: Almost forgot to mention the most important part. If the improvement is finally built near the coast and lies within a city radius, the city will get the common lighthouse bonuses. If the improvement becomes pillaged, the city will lose this bonuses.

    If this works I can imagine many more possible applications of construction sets already. :)
     
  3. Jean Elcard

    Jean Elcard The Flavournator

    Joined:
    Feb 26, 2006
    Messages:
    1,008
    Location:
    Leipzig, Germany
    Problem solved by adding two new XML tags to "CIV4ImprovementInfos.xml" and changing some stuff in the SDK. :)

    Thanks to Kael, because this thread paved the way for my solution: Case Study: Adding new XML attributes and using them in the SDK

    Next thing to do: Find out, if there is a lighthouse improvement in the city radius an if so, add one to the city, but undestructible by conquest as long as the improvement stays unpillaged.
     
  4. Jeckel

    Jeckel Great Reverend

    Joined:
    Nov 16, 2005
    Messages:
    1,637
    Location:
    Peoria, IL
    I have run into similar problems, as have those before me, in getting a port improvement to aline in the water when built on the coast. Not sure if anyone ever solved it, but I know I got tired of staring at the LSystems file for improvements.

    If you figure it out, please let the rest of us know. I know I would throw a party in your honor. :)
     
  5. Jean Elcard

    Jean Elcard The Flavournator

    Joined:
    Feb 26, 2006
    Messages:
    1,008
    Location:
    Leipzig, Germany
    To fiddle around with the LSystem is really a pain.To be honest I still don't really get it completely all these things about BLeafs, GLeafs and so on, especially not the cryptic numbers at the end of the L-Files. There is a nice article in the Wikipedia about the "Lindenmayer-System" (L-System) by the way, but some more Civ4 specific information about its implementation would be nice. Does anybody know where to look for it?

    For some reason you can't use the custom layout engine stuff from CityLSystem in PlotLSystem, in case of the Harbor (I tried this too), this would be absolutely necessary. However, if you do it anyway, it just gets ignored. It's good to know, I'm not alone with this problem by the way. :)

    I just read the superb "Modders Guide to Beyond the Sword". They changed a lot, even the LSystem handling, but it seems this threads problem is not adressed.
     

Share This Page