I've seen a lot of games that define the entity components in script files, but when they configure each entity and specify what components it has, they use some other file format (like XML). Why do they do that?
I'm asking mostly to see what others' rationale was for this. I also configure my entities outside of scripts (though I chose JSON not XML). My reasons for doing this are to make it easier for me to implement save games and also because I think this kind of configuration is better organized in something like XML or JSON.
@Christopher Larsen's answer: Too long to post as a comment
I fear you might have deviated a bit from the subject of the question. The problems you are describing are more related to hierarchy-based entities; note in my question I mentioned I was talking about component-based entities.
Here's an example of what I wanted to ask. Below are two alternative ways to configure an entity: through the script and through an external JSON file. My question was, why do so many people prefer to configure the entity outside of scripts?
A base Entity class:
class Entity:
def __init__(self, name):
pass
def addComponent(self, comp):
pass
The script approach:
orc = Entity('Orc')
orc.addComponent(PositionComponent(3.4, 7.9))
The JSON approach:
{
"name" : "Orc",
"components":
{
"PositionComponent": {
"x" : 3.4,
"y" : 7.9
}
}
}
I already stated my reasons for using this approach, which are technical and organizational. I wanted to know why so many others (from what I've seen) use this.