No announcement yet.

[C4:AC][Programming] Technology Tree

  • Filter
  • Time
  • Show
Clear All
new posts

  • [C4:AC][Programming] Technology Tree

    SMACX provides us with, initially, excellent conditions for implementing the SMACX technology tree into Civilization IV. We have the technology quotes, text and audio, and the graphical technology representations.

    I tried to replace the "agriculture" technology with Centauri Ecology, but quickly abandoned the project and decided to built the technology tree from scratch using the existing technology schema (template).

    The "CIV4TechInfos.xml" and the "CIV4GameTextInfos_Objects.xml" files are the ones I use to define the technologies and get the proper names showing in the game. Technology text quotes are stored in the "CIV4GameTextInfos.xml" file.

    In "CIV4TechInfos.xml" I can set a specific sound file to be played once a specific technology is discovered. Additionally, I can set which technology icon to graphically represent the technology. I found that all these icons are read from the "" file.

    The grahics are a bit more complex to add, though. Using the SMACX icons, I copy, resize, and paste these into the "" file as shown in the attached image.

    It would probably not be a problem to add all of the SMACX technologies this way.

    I haven't done more than about 15 technologies, but would appreciate any comments on this particular project--especially if there would be a better way to implement the SMACX technology tree.
    Attached Files

  • #2
    Here's an image showing the preliminary technology tree setup. To make it a bit more interesting I activated the Energy Bank facility (using the default bank graphics).
    Attached Files


    • #3
      Remember that the white arrows in Civ 4 indicate an "or", in that only one of those prerequisite technologies needs to be discovered.
      "Cutlery confused Stalin"
      -BBC news


      • #4
        Woah that's sweet Nice work.


        • #5
          Chaos Theory, while the white arrows do indicate an "or", this relation is not present in SMACX. However, they do help when I am trying to position the technologies in the "tree structure". Ultimately, they will be either completely removed, converted to "and" relations or somehow retaining the "or" relation in a re-design of the SMACX technology structure.

          I managed to isolate the technology buttons into separate smaller .dds files. This allows for a little extra flexibility when trying to create new icons without worrying too much about redoing the whole thing. To this, I tried to add some depth to the icons.

          Here's an in-game example from the Civilopedia (The Merchant Exchange).
          Attached Files


          • #6
            You can position a tech in the tech grid with the gridX and the gridY parameters in the civ4techinfos.xml

            It should make the arrows less cluttered.

            Can you insert comments in this xml file? Whenever I tried, the pre-requisites etc all got messed up.
            no sig


            • #7
              Extremely good work Rubin (as always! )! If you can get all of techs inserted and linked by the time we release the first version of the mod (which won't be for a while yet) then that would be fantastic!

              I haven't inserted the Lal leaderhead pic yet, but will probably do that this evening. Since you are also working on this are you interested in generating another leaderhead? If so let me know which one and I will designate that one next as far as building the Faction via the C4 files.



              • #8
                Does anyone have a list of the secondary benefits gained from techs? I'm thinking commerce techs and fungus bonus here.


                • #9
                  Implementing the entire SMACX technology tree using this method is extremely easy and could be done in a few days, I believe. However, balancing the technology costs, benefits, weights, etc. seems tricky at the moment.

                  I haven't found out how to have a technology description shown in the Civilopedia--only the technology quotes and the strategy advice seem to work.

                  Initially, I placed all the technologies in the F6 Advisor screen so that all tier 1 technologies (E1, D1, C1, B1) would be in the first colomn, tier 2 in the second column, etc. However, this turned out very messy. That is why I added the white arrows and repositioned some of the technologies. Additionally, the prerequisite technologies depicted on a technology (the small icons) partially cover some of the technology names.

                  To make it simple I went for this naming convention for the new technologies:


                  I also found that inserting a : in the technology description didn't work, hence "Doctrine: Mobility" is now "Doctrine Mobility". I am sure someone may be able to figure out how to fix this.

                  For now, I am leaving ou the comments in the .xml files. I haven't tried adding any yet.

                  Regarding the secondary technology bonuses, there is a list in the .xml file. But, I am not sure if we are able to change this "list" in order to match the SMACX bonuses. Though, we can initially mess with the variables already present and get something fairly decent.

                  Darsnan, generating leaderheads of the same poor quality as I did the Lal leaderhead takes a few minutes. I am hoping to have the seven original factions implemented soon; by reading about the work you've done with the Peacekeepers I quickly added that faction based on the "Washington"/American template. Once we know exactly which files are affected by adding a new faction, we can add more factions and remove the default ones; which I am currently preserving in order to be able to test any changes in-game. This applies to technologies as well.

                  Edit: Implemented 27 technologies so far; that is all tier 1 and tier 2 technologies and a single tier 3 technology (Superconductor). For the most part, I am using template/default graphics to be replaced as soon as the entire technology tree is implemented. I am wondering if we could use the existing units, civics, buildings, etc. and tie these to the new technologies in order to produce a playable modded version very quickly. Depending on how the project progresses, this could prove very helpful in terms of fine tuning the code we've already implemented--simply because the default, and now obsolete, technologies could be safely removed from the mod.
                  Last edited by Rubin; November 19, 2005, 00:34.


                  • #10
                    Here is what I know about SMAC tech costs:

                    The cost of each tech is dependent on the number of techs already researched. the increase in cost of each tech (on a large map) starts at 30, and by the end of the game is about 150.

                    The tech cost curve is slightly-greater-than-linear, however it is inconsistent. I wish I could say each subsequent tech is always more expensive than the last, but alas, it's not so. In a game trial I ran exactly ONE tech cost less than the previous one. *sigh* who programmed this schlock... also sometimes techs increase by 30-40, and other times by 90-150, with rhyme nor reason, other than the small increases are the usual at the start of the game, and the large at the end. For all I know the values are taken from a table of costs and not generated by an algorithm. Or it might be semi-randomized or dependent on other things. Lets try and NOT exactly reproduce the SMAC tech costs.

                    Starting tech cost = ~22
                    Final tech cost = ~5000
                    Tech count = 88

                    Formulawise, the difference between each tech is approximately:
                    25 + n
                    (where n is the number of techs researched)

                    Integrate that and each tech costs:
                    25n + (n^2)/2

                    That curve fits it "Good enough" for me.

                    If you want an approximate fit for "fixed costed techs" I would suggest this, from intuition it should play okay...

                    Cost = 50 + 25 * L^2
                    where L is the tech level.
                    This will put starting techs at a cost of 75, which at SMAC energy levels (starting base = 2 labs) would take 36 turns to research. Yay. But Civ4 works differently, because the Capital has 8 energy. So I think we'll need to give the HQ 8-10 bonus energy too.
                    So if you want to give the techs costs, then the above formula should work okay, I think.

                    I will also look into the Python and XML to find a way to reproduce the SMAC system.


                    • #11
                      The formula for tech costs in smac is available on this forum. The problem is, it's completely different than civ4's tech cost:

                      civ4 : each tech has a certain cost, no matter what.

                      smac : tech cost doesn't care about which tech you're researching, but about : # of techs when research starts (so if you trade/steal 5 techs in the mean time, your next one will be much more expensive), turn (later in game costs decrease), tech leader or not (tech leader = more expensive).

                      For simplicity, you could set all level 1 techs to the same cost, all level 2 techs to the same cost ... This way, pure b-lining to certain techs won't be so dificult anymore (because the tech cost doesn't increase if you pop an "unwanted" tech). Maybe with Python we can change the tech costs, but it'd be easiest for the first version to set them fixed for each tech.

                      For the civilopedia texts :
                      no sig


                      • #12
                        PJayTycy, I am aware of the civilopedia entries in the .xml file, but I have no idea how to access these in the game. When browsing the technologies in the in-game civilopedia, I find none of the technology descriptions. How do I get to read the technology descriptions from within the game?

                        Balancing the technology tree may be a delicate endeavor. If we choose to abandon the original SMACX costs model and go for, initially, a fixed cost; then perhaps we ought to utilize the "or" requirements in addition to the "and" requirements. I could be wrong, but I assume this would allow for an easier balancing between the different technology paths--especially considering making "less desireable" technologies desireable. Later, we may wish to change all of this; but for an early playable mod, perhaps this is the way to go?

                        Edit: Found the "hidden" button in the top right corner of the Civilopedia screen enabling the technology descriptions.
                        Last edited by Rubin; November 19, 2005, 07:29.


                        • #13
                          You guys are already at it


                          • #14
                            ah, sorry Rubin, I misunderstood you. Do you mean those civilopedia-texts are never shown in-game ? I haven't really tested when certain texts appear, but you could very well be right.

                            There are 4 texts: description, civilopedia, strategy and quote. Probably description is shown in the civilopedia instead. How many different texts does smac have for each tech? I know the quote, the scientific description of the breakthrough and the datalinks, but maybe there are more?

                            in Python, you can do this:

                            gc = CyGlobalContext()
                            tech_info = gc.getTechInfo(int TechID)
                            civilopedia_text = tech_info.getCivilopedia()

                            So, if we want to acces it for an interface screen (the datalinks) in our mod, it's no problem.
                            no sig


                            • #15
                              PJayTycy, as I noted in the edit above, I found the descriptions in-game. The 4 text references for each technology need not be implemented immediately as long as each new technology entry uses one of the default references already present in the text files. The full text implementation may be done at a later stage--or, perhaps, gradually.

                              I've done a little more than 50% of the technology tree by now (last entry currently is Photon/Wave Mechanics, tier 6).

                              Good news about the Python possibilities.

                              Edit: Minor update. I now have all the SMACX technologies in the game. I still need to do the graphics, technology prerequisites, "discovery" quotes, etc. All default technologies--except Mysticism--are still present; simply removing these might prevent some in-game testing. However, the technology framework is done now.
                              Last edited by Rubin; November 19, 2005, 09:26.