Would Python have been better than XML?

Jet

No, no, please. Please.
Joined
Mar 16, 2006
Messages
2,431
Would it have been better for Civ 4 to have used instead of its XML framework a Python framework in which mod-level information was coded in Python files rather than XML files?

Some reasons to do it might have been:
* Python doesn't have the clutter of XML tags
* Python is more powerful than XML
* a Python framework would be simpler than the XML framework
 
Python is a programming language, xml is a markup language. They are different beasts and I think Firaxis choose to use them appropriatly.
 
Why?
(ten characters)
 
If you've ever used XMLSpy, you'll know why XML is far superior at especially editing units & buildings. For example, I can make any number of units have, say, a movement of 1 with just a few mouseclicks.

Try it, all versions have a 30-day free trial, which can be extended with proper, full uninstalls & reinstalls to last forever.
 
> full
:)

What would I have to do with XMLSpy to appreciate its superiority? Would opening some Civ 4 XML files and exploring the XMLSpy UI suffice, or would I have to do some serious editing?

Is it something you can explain? Your example was helpful, but I'm not sure how to generalize it.
 
You cant program anything in XML. You couldn't write an XML program to add 1+1, its not a programming language. Its a markup language, which basically means its a format for storing data.

Since it is a common format for storing data a ton of industry tools work easily with XML (like XMLSpy). Its also extensible, so new attributes can be easily added to it.

Python is a programming language, it isn't written to store data but to do things. You can add 1 + 1 in python, but you wouldn't want to store a database there. And even if you did decide to push all of the variables into python it would be a pain to modify and track them all.

But I guess I need to ask you, why do you think Python is more powerful than XML? Why would a python framework be simplier than an xml framework?
 
Python is more powerful because it's a programming language. Maybe I should have said more expressive, to be more precise. In the context of setting Civ 4 object attributes, logic more complicated than what's expressed in the Civ 4 XML would be possible. Off the top of my head, it might use subclassing for civ-specific object variations, for example. I'm not saying that's necessarily a good example or that more expressiveness is greatly needed, only that it might be useful.

Simpler because it would remove XML and the XML integration, and leverage the Python integration that's present anyway. To me, that and the lighter lexical syntax of Python are the more compelling reasons why a Python framework might have been better.

> [XML is] also extensible, so new attributes can be easily added to it.
Do you think new attributes can be added more easily with XML than with Python?

> And even if you did decide to push all of the variables into python it would be a pain to modify and track them all.
I don't see why. The code that sets the object values would be structurally identical in either Python or XML and different only in the particulars of the syntax. The structure could be different in Python, for example if information could be factored out with subclassing, but it wouldn't have to be different.

> You can add 1 + 1 in python, but you wouldn't want to store a database there.
I'm sorry to nitpick, but the issue is the database of Civ 4 object attributes in particular. The fact that XML was designed for some class of tasks doesn't imply that it's best for this task.

You mentioned other tools. For example, if I understand correctly you have an Excel-based editor for FfH. Is it easier for that to generate XML than Python?
 
> Do you think new attributes can be added more easily with XML than with Python?
I think I can answer this. Even if you did create new attributes in python, you'd still need to tell the game what they do, which means sdk & c++. The same thing needs to be done if you create a new attribute in XML.


If you use a text editor to edit all xml files, then storing everything in python might be quite alike. But with the two programs I use, I can either massedit many units/buildings/other stuff, or easily edit a few unmbers from selected ones.
Screenies:
http://www.zoschke.com/products/Altova/XMLSpy/XMLSPY_gridview.gif
http://symbolclick.com/index_files/intro.gif
 
Back
Top Bottom