XML scripts - Please, explain.

This forum is the ideal place for all discussion relating to X4. You will also find additional information from developers here.

Moderator: Moderators for English X Forum

Meme Turtle
Posts: 175
Joined: Thu, 27. Nov 14, 16:33

XML scripts - Please, explain.

Post by Meme Turtle »

Some time ago I started a topic on AI logic being defined via XML scripts:
https://steamcommunity.com/app/392160/d ... 770055767/

However, I have not received any reply from the developers. I am still wondering why XML was chosen as the scripting language and if it is feasible to modify the game engine to provide support for custom DLLs(similar to Unity games). I.e. in the form of plugins(like in UE). I would greatly appreciate if one of the engine developers/architects could provide an insight or explanation.
Rei Ayanami
Posts: 3354
Joined: Wed, 6. Nov 02, 20:31
x4

Re: XML scripts - Please, explain.

Post by Rei Ayanami »

There was a discussion some months ago about Egosofts decision to have XML for scripting and why they didn't use another scripting system for X4.
I can't guarantee that i'm absolutely correct with these points and obviously i don't claim to speak for Egosoft, but if i remember correctly the main reasons stated by the developers were
1) XMLs patching/modification/diffing features are really powerful, especially for the incremental patching system that Egosoft uses with their .cat files and extensions
2) Egosoft already had developed their XML scripting engine for many years with X:Rebirth and previous X titles, creating a new scripting system from scratch and throwing away all the work that went into their XML scripting engine was not an efficient option
3) Veteran modders were already familiar with Egosofts XML scripting from previous X games
4) The XML scripting possibilities are sufficient enough for what Egosoft needs
CBJ
EGOSOFT
EGOSOFT
Posts: 54307
Joined: Tue, 29. Apr 03, 00:56
x4

Re: XML scripts - Please, explain.

Post by CBJ »

To save time I'll quote an old post on the subject of XML.
CBJ wrote: Tue, 10. Jan 17, 17:56 Some of the original reasons for choosing XML for the MD were:

- Domain-specific structure (it's laid out in the form of the conditions and actions required for mission progress) and syntax (many of the conditions and actions are directly mapped to mission activities rather than just being generic programming terms)
- Missions can be created with very limited programming knowledge (while it's possible to do programmer-y things like loops, it is also possible to create simple missions entirely without this, which helps with the learning curve)
- Editing comes with built-in self-documentation as well as syntax auto-completion (most self-respecting XML editors understand schemas, and the schemas can also be used to provide the documentation)
- Easy to parse and convert to internal format (it is loaded and parsed very simply using standard XML libraries, then converted into an internal form that is that is, like the raw syntax, closely tied to its purpose, rather than using a generic third party interpreter or JIT compiler)

Now, bearing in mind that we have been working with the MD, in one form or another, for nearly 10 years, the reason we continue to use it is very simple: we have it, it works, and it does what mission developers need it to. The AI scripting system shares some key elements, such as actions and conditions, with the MD, saving a lot of effort in maintenance and development, but is, again, tailored to the task in hand. It would be a very poor use of developer time to throw all that away in favour of something different, with all the issues and unknowns that would come with it, just because some people turn their noses up at it for being XML rather than a "proper" programming language.
As for supporting much deeper forms of modification such as DLLs, I will just point out that a) we are a not creating a generic game engine for which this kind of thing is really beneficial and b) we are a small team with a tiny fraction of the resources available to the Unity team and can therefore only practically provide modders with tools that we need to create for the game's development anyway.
Meme Turtle
Posts: 175
Joined: Thu, 27. Nov 14, 16:33

Re: XML scripts - Please, explain.

Post by Meme Turtle »

Thank you for the perfectly reasonable explanation. Perhaps, raising this question would have made sense when X:R was being worked on or when(if) X5 is in development. In the mean time I will keep throwing money at the monitor so you can afford bigger team while being frustrated for not being able to override API functions(like turret tracking or pathfinding).

Return to “X4: Foundations”