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

How will Civ IV use XML?

Discussion in 'Civ4 - General Discussions' started by TastySheriff, Oct 11, 2005.

  1. TastySheriff

    TastySheriff Chieftain

    Joined:
    Oct 2, 2005
    Messages:
    93
    <snip> I want to get a look at the xml files that i will be modding soon. Ive never worked in XML so it should be an enlightening experience for me. I also want to try to get a head start on designing a tool to swap mods in and out. So if uve seen one or have one, id like to know what it looks like.

    Piracy is wrong! capitalism!

    Moderator Action: You can ask about XML without asking for pirated versions, or leaked files. I'm editing this thread to remove references of piracy.
     
  2. weakciv

    weakciv Prince

    Joined:
    Jul 15, 2005
    Messages:
    469
    Location:
    -1, -4
    if you would like to look at XML formated files. take a trip over to www.w3schools.com

    You can even go through some XML tutorials
     
  3. Urederra

    Urederra Mostly harmless

    Joined:
    Apr 22, 2004
    Messages:
    5,310
    Location:
    Sea of tranquility
    At least you can say that you have pre-order the game. Don't let piracy kill the sequels of the game!!!! (That is a message aimed to all posters ;) )

    I am with Hopper, just wait two weeks, that is nothing compared to what we have already waited. Ahhh... I just remember when civrules posted the firsts screenies, It seem so long ago....
     
  4. viz

    viz Prime Minister

    Joined:
    Sep 27, 2005
    Messages:
    205
    Location:
    England
    Here is some xml for you:

    <unit name="warrior">
    <movement>1</movement>
    <attack>1</attack>
    <defense>1</defense>
    <cost>10</cost>
    </unit>

    <unit name="settler">
    <movement>1</movement>
    <attack>0</attack>
    <defense>0</defense>
    <cost>20</cost>
    </unit>

    :cool:
     
  5. weakciv

    weakciv Prince

    Joined:
    Jul 15, 2005
    Messages:
    469
    Location:
    -1, -4
    Dont forget the top level element.

    in a file named Units.xml

    <units>
    </units>
     
  6. viz

    viz Prime Minister

    Joined:
    Sep 27, 2005
    Messages:
    205
    Location:
    England
    :goodjob: well spotted
     
  7. TastySheriff

    TastySheriff Chieftain

    Joined:
    Oct 2, 2005
    Messages:
    93
    Thanks viz and weak, that looks like itll be a breeze.

    Im sure XML has some sort of comment escape sequence, but do the files come with comments in them to identify different sections or anything?

    oh and for the non-believers i preordered the game a week ago and ive cleared a weekend and stocked up on Dr Pepper and coffee for the arrival. Im freaking excited.
     
  8. weakciv

    weakciv Prince

    Joined:
    Jul 15, 2005
    Messages:
    469
    Location:
    -1, -4
    <!-- this is an XML comment -->

    as far as how much Civ4 is commented we dont know.
     
  9. Jecrell

    Jecrell Ruled: Civ3 - Civ5

    Joined:
    Oct 9, 2005
    Messages:
    709
    Location:
    California, USA
    I wasn't aware there was ANY Civ IV leaks of anything out yet except screenshots, videos, and some previews. That's the most leaking I've seen. I mean, Civ IV isn't having a Half-Life 2-like leak crisis.
     
  10. weakciv

    weakciv Prince

    Joined:
    Jul 15, 2005
    Messages:
    469
    Location:
    -1, -4
    these aren't leaks. they are just structured XML data based on known units. :D
     
  11. Louis XXIV

    Louis XXIV Le Roi Soleil

    Joined:
    Mar 12, 2003
    Messages:
    13,579
    Location:
    Norfolk, VA
    I haven't even seen any leaked screenshots, just official preview screenshots (the difference being they were authorized).
     
  12. apatheist

    apatheist Emperor

    Joined:
    Jun 28, 2005
    Messages:
    1,270
    To clarify. This is just what the files could look like. They don't necessarily have this structure.
     
  13. Aks K

    Aks K Scientist

    Joined:
    Oct 15, 2003
    Messages:
    246
    Location:
    On the Run
    @TastySheriff: Will you mod civ 4 before playing it first? I will play a few games first myself before modding.

    Settler movement is 2 btw ;).

    Aks K
     
  14. TastySheriff

    TastySheriff Chieftain

    Joined:
    Oct 2, 2005
    Messages:
    93
    ok, well thanks for the idea, I hope that its just that simple. Thatll make the tool o so easy to write (at least when it comes to editing the xml data).

    I think itll take someone with more python experience than i have to be able to package python edits, unless you can mod them with seprate files and link to those new files with xml. Any thoughts?
     
  15. viz

    viz Prime Minister

    Joined:
    Sep 27, 2005
    Messages:
    205
    Location:
    England
    :p

    If you want to learn python, I suggest starting here http://www.python.org/ :) . XML is simply a data container, you can change the data that the game uses via the xml files, in order to change the actual features you will need to dive into coding with python.
     
  16. Rexflex

    Rexflex Prince

    Joined:
    Oct 1, 2005
    Messages:
    313
    Another possible (but less likely to be used) structure of the XML is this :

    <units>
    <unit name="warrior" movement="1" attack="1" defence="1" cost="10"/>
    <unit name="settler" movement="1" attack="0" defence="0" cost="20"/>
    </units>
     
  17. evil_linus

    evil_linus Chieftain

    Joined:
    Jul 21, 2005
    Messages:
    57
    Location:
    Sweden
    XML is very easy to use and most of the time it's not even need to be commented as the tags almost coments themselfs, if ya get what I mean.

    I say: Don't worry about the xml - thay will be a piece of cake. But for Python there's a bit more advanced programming requiered or am I wrong?
     
  18. Rexflex

    Rexflex Prince

    Joined:
    Oct 1, 2005
    Messages:
    313
    The main thing about scripting that you will find invaluable is to know about object referencing - particularly when it comes to referencing the XML data.
     
  19. warpstorm

    warpstorm Yumbo? Yumbo!

    Joined:
    Dec 19, 2001
    Messages:
    7,688
    Location:
    Snack Food Capital of the World

    Yes, but Python is one of the easiest languages to learn. Look at the sticky thread obove here for much more info of head on over to www.python.org for more than you want to know about it.
     
  20. Harrier

    Harrier Deity

    Joined:
    Feb 19, 2002
    Messages:
    2,414
    Location:
    UK

    Easy to learn maybe. But probably not easy to master by people who have not programmed before. :)

    I can forsee hundreds of posts from people asking why their python program does not do what they intended.

    Maybe Thunderfall should consider having a forum dedicated to python and XML queries and questions only once Civ4 is released. So as not to frighten away those only interested in playing the game.
     

Share This Page