Announcement

Collapse
No announcement yet.

Calling all mod'rs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling all mod'rs

    Begginers guide on how to mod in python


    A Python and XML tutorial aimed at Civilization IV modding
    anti steam and proud of it

    CDO ....its OCD in alpha order like it should be

  • #2
    Thanks. A good start in Python. Anyone want to provide info on XML?
    "And so, my fellow Americans: ask not what your country can do for you—ask what you can do for your country. My fellow citizens of the world: ask not what America will do for you, but what together we can do for the freedom of man." -- JFK Inaugural, 1961
    "Extremism in the defense of liberty is not a vice." -- Barry Goldwater, 1964 GOP Nomination acceptance speech (not George W. Bush 40 years later...)
    2004 Presidential Candidate
    2008 Presidential Candidate (for what its worth)

    Comment


    • #3
      There are many places to learn about Python, one that I like myself is the tutorial on the official website: http://www.python.org/moin/BeginnersGuide (it should be noted that it covers most aspects of Python, it's quite extensive). This one is particularly good for people with zero programming experience.

      I would indeed recommend that everyone who wants to get into Python for Civilization 4 start looking into tutorials like these before the game's release. You now have all the time in the world anyway, so you can see what it's like and if it would be something for you (not everyone will be into it). Then, when you get your hands on Civilization 4, you only need to learn the Civ4-specific parts of Python before you can start writing scripts.

      As far as XML goes, if you want to see an example of XML, go to the menu View of your browser and select Source or Page Source or something like that (depending on your browser). You'll see the HTML source of this page, that's a fine example of what XML looks like (it's not actually XML, but very, very similar; XML is based on HTML). XML allows programmers to make up their own 'language', so there's no way to predict what XML for Civilization 4 will look like, that's entirely up to the programmers at Firaxis. However, all XML languages look alike. The portion of XML that stores the unit data might look something like this:

      <Unit>
          <Type>Spearman</Type>
          <Class>Melee</Class>
          <CostToBuild>240</CostToBuild>
          <MaintenanceCostShield>2</MaintenanceCostShield>
          <MaintenanceCostFood>0</MaintenanceCostFood>
          <MovementPoints>1</MovementPoints>
          <StrengthValue>4</StrengthValue>
          <BonusAgainstHorse>100</BonusAgainstHorse>
          <BonusAgainstTank>0</BonusAgainstTank>
      </Unit>

      Of course, the details such as exact names and stats will be different and presumably there will be many, many more stats, but the basic idea is always the same. All other in-game data will be stored using a similar pattern.

      As you can see, providing Firaxis uses meaningful naming conventions XML should be pretty easy and intuitive to use, and at least for simple modding the learning curve is almost much flat (you only need to figure out where everything is located)...
      Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

      Comment


      • #4
        Originally posted by Locutus
        so there's no way to predict what XML for Civilization 4 will look like,


        However, all XML languages look alike.
        "And so, my fellow Americans: ask not what your country can do for you—ask what you can do for your country. My fellow citizens of the world: ask not what America will do for you, but what together we can do for the freedom of man." -- JFK Inaugural, 1961
        "Extremism in the defense of liberty is not a vice." -- Barry Goldwater, 1964 GOP Nomination acceptance speech (not George W. Bush 40 years later...)
        2004 Presidential Candidate
        2008 Presidential Candidate (for what its worth)

        Comment


        • #5
          By that I mean that the pattern in XML is always the same:

          <SomeDataType>
             <SomeProperty>SomeValue</SomeProperty>
             <SomeProperty>SomeValue</SomeProperty>
             <SomeProperty>SomeValue</SomeProperty>
             <SomeProperty>SomeValue</SomeProperty>
          </SomeDataType>

          However, all the details of an XML language, such as the exact names of the datatypes, properties, etc and the exact values that are allowed, and of course what impact they will have when you use the language, those differ per language. E.g. in HTML <b> displays text in bold, in Civ4 it will probably mean nothing and generate an error. In Civ4 <StrengthValue> might indicate the unit strength, in HTML it means nothing. Thus, exactly what XML for Civ4 will be like is impossible to predict, but it will still follow the same pattern that all XML languages use.

          To compare it to natural languages: knowing that Civ4 will be XML is like knowing a language is Germanic. But to be able to speak that language, you will still need to know whether it is English or Dutch or German or Swedish or Frisian, etc. Without knowing that you still won't be able to make yourself understandable in that language. All those languages may have a lot in common, but they also have a lot of differences.
          Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

          Comment


          • #6
            I was just thinking of posting a thread asking for this info. Thanks!

            -Nudge-

            Hey, Mark, I think this would be a good thread to top in the CivIV creation forum (when it will inevitably come).
            Founder of The Glory of War, CHAMPIONS OF APOLYTON!!!
            1992-Perot , 1996-Perot , 2000-Bush , 2004-Bush :|, 2008-Obama :|, 2012-Obama , 2016-Clinton , 2020-Biden

            Comment


            • #7
              anyone interested in starting groundwork for a fantasy mod?
              I wasn't born with enough middle fingers.
              [Brandon Roderick? You mean Brock's Toadie?][Hanged from Yggdrasil]

              Comment


              • #8
                Originally posted by Donegeal
                I was just thinking of posting a thread asking for this info. Thanks!

                -Nudge-

                Hey, Mark, I think this would be a good thread to top in the CivIV creation forum (when it will inevitably come).
                Great idea. This will be a huge subject generating lots of questions (and threads) when the time comes.
                "And so, my fellow Americans: ask not what your country can do for you—ask what you can do for your country. My fellow citizens of the world: ask not what America will do for you, but what together we can do for the freedom of man." -- JFK Inaugural, 1961
                "Extremism in the defense of liberty is not a vice." -- Barry Goldwater, 1964 GOP Nomination acceptance speech (not George W. Bush 40 years later...)
                2004 Presidential Candidate
                2008 Presidential Candidate (for what its worth)

                Comment


                • #9
                  I'm not so interested in a fantasy mod but in a Alpha Centauri recreation mod. I've whispered here and there that it would be a good idea. I don't think anyone would object to having working Social Engineering or Unit Workshop code available for incorporation into their own mods and it would be a mod for gathering experience with Civ4.

                  Any thoughts?

                  Comment


                  • #10
                    Could do a Centauri type mod that allows "colonization" of the moon and the other planets and moons of the solar system. I always thought we should expand out more before going to A.C.
                    "And so, my fellow Americans: ask not what your country can do for you—ask what you can do for your country. My fellow citizens of the world: ask not what America will do for you, but what together we can do for the freedom of man." -- JFK Inaugural, 1961
                    "Extremism in the defense of liberty is not a vice." -- Barry Goldwater, 1964 GOP Nomination acceptance speech (not George W. Bush 40 years later...)
                    2004 Presidential Candidate
                    2008 Presidential Candidate (for what its worth)

                    Comment


                    • #11
                      Senethro: Nice idea, but first I think I want to play Civ4.
                      Do not fear, for I am with you; Do not anxiously look about you, for I am your God.-Isaiah 41:10
                      I praise you because I am fearfully and wonderfully made - Psalms 139.14a
                      Also active on WePlayCiv.

                      Comment


                      • #12
                        Locutus, your xml examples are only one possibility of doing xml. There's also this one:
                        <Unit name="Spearman" strength="2" someProperty="someValue"/>
                        I don't think Soren showed an example of what the actual format would look like? Although I definitely perfer the more verbose one using <x>value</x> instead of x="value" since you can't do everything with the latter format but can with the former.
                        [edited the lt; > stuff]
                        Last edited by LDiCesare; May 4, 2005, 14:26.
                        Clash of Civilization team member
                        (a civ-like game whose goal is low micromanagement and good AI)
                        web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

                        Comment


                        • #13
                          My my example was not supposed to be exhaustive, there are other things I didn't mention either (e.g. I didn't really mention (multi-layer) nesting). IMO attributes work nicely in HTML but should be avoided whenever possible in XML (there are some distinct disadvantages to them, as you said). And this is also usually what you usually see in practice. But yes, it is indeed a good form of XML that I problably should have mentioned...

                          Edit: for those who don't know how to read the example LDiCesare mentioned, I'll repost it in a readable form:

                          <Unit name="Spearman" strength="2" someProperty="someValue"/>
                          Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                          Comment


                          • #14
                            hmm...with proper stylesheets this could make it easy to create online civpedias for mods
                            <Kassiopeia> you don't keep the virgins in your lair at a sodomising distance from your beasts or male prisoners. If you devirginised them yourself, though, that's another story. If they devirginised each other, then, I hope you had that webcam running.
                            Play Bumps! No, wait, play Slings!

                            Comment


                            • #15
                              Yes, that is one of the great things about XML, you can really easily re-use existing XML documents it to develop your own tools. Fan-made editors, reference charts, websites, etc should all be pretty easy to make.
                              Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                              Comment

                              Working...
                              X