What resources are available for AI programming

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

ZaphodBeeblebrox
Posts: 1849
Joined: Mon, 10. Apr 06, 20:35
x4

What resources are available for AI programming

Post by ZaphodBeeblebrox »

I am interested in finding out what resources are available for AI programming.

Tools, scripts other resources that I can look at to get an idea of what is involved in doing this.

Thanks

ZB
It was a woman who drove me to drink... you know I never went back and thanked her.

Don't try to outweird me, three-eyes. I get stranger things than you free with my breakfast cereal.
User avatar
YorrickVander
Posts: 2774
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander »

For xr specific the existing scripts are about it, and this info from Egosoft :
AI Scripts

To maintain compatibility with older versions of AI scripts, which may be restored from a savegame, there are some special measures that you have to take. At time of saving a game, the most important state information of an AI script is the blocking action that it is currently in. When loading a savegame, the blocking action has to be found again. This imposes some restrictions on how to change existing scripts in newer versions.

How to add new blocking actions? The <aiscript> node can have a version attribute. Without the attribute, the version is assumed to be 0. All blocking actions, including <run_script>, now have the attribute "sinceversion". So when creating a new version of the script, increment the script version, and add new blocking actions with the according sinceversion attribute.

There is a validation mechanism in the game that can find out if you have forgotten a sinceversion attribute, see the command line documentation. However, note that there is no such validation when a savegame is loaded. When loading a savegame with incompatible scripts, the affected scripts will be in wrong states. This may not be obvious right away after loading, but it can break the AI in many subtle ways.

Some helpful facts and restrictions:

You CANNOT remove a blocking action in a later version
however, you can e.g. use chance="0" so it's skipped in the future.
You CANNOT change the order of blocking actions in the script (e.g. move a <wait> past a <run_script>).
Be careful when adding a new <attention> node, or when changing the min attribute of an existing node. For the affected attention level(s), blocking actions of old and new <actions> have to be compatible.
You SHOULD NOT rename or remove label sections which contain any blocking actions, or move the blocking actions to another label section. (Doing so is not really harmful but it affects the label to which an interrupted script will return.)
You CAN add, remove or change any non-blocking actions without restrictions, except for <label> (see above).
You CAN change the flow control surrounding blocking actions, e.g. move them in or out of <do_if>, <do_while> etc.
You SHOULD NOT move blocking actions in or out of blocks of a repeating <do_all> (e.g. with exact, min, or max attribute).
You SHOULD NOT change the counter variable name of a repeating <do_all> if it contains blocking actions.
You CANNOT remove or rename scripts that contain blocking actions. Changing the file name is OK, since only the internal name matters. (If you do rename or remove them, this triggers a return to the previous script on the callstack, but with an error message.)
You CAN add new scripts, of course.
You CAN change the interrupt priorities of scripts. This automatically adjusts the priorities of existing callstacks. It's up to you to make sure that the callstack priorities still make sense after loading a game.
You CAN add, remove or change global interrupt conditions, actions, and script calls. Global interrupt handlers are not saved, they are set up again when loading a game.
You CAN add, remove or change <interrupt>, <interrupt_after_time> and <on_attentionchange> nodes of blocking actions. They are set up again when loading a game.
You CAN change the delays in <wait> and <interrupt_after_time>. The start times of blocking actions are saved, and the delays are re-evaluated when loading a game (even if they are random!).
You CAN change the content of blocking actions, but you SHOULD NOT change the attributes that are used for the event sources
they are re-evaluated in RestoreBlockingState(), see above.


Analogously to MD cues, AI scripts can have <patch> elements to perform patch actions immediately after loading a savegame of an older version. See the XML schema documentation.

There is no mechanism like the MD refresh to update AI scripts at run-time. Saving and reloading the game is the only way to get close to this.
Otherwise, google, library, bookshop and patient testing :D
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

dont forget the xsd files included in the Gama Cat/Dat files which contain all valid commands ;)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

Return to “X Rebirth - Scripts and Modding”