View Full Version : Wondering about BG games AI


Melhisedek
Tue, 29th Apr '08, 1:36am
2 days ago I became obsessed with AI :) Can't explain why, was watching some speed runs and thought monsters reacted dumbly. One thing led to another and now 2 days later I've been constructing some simple AI algorithms (just in my head pseudo code) for so long that I'm gonna pass out soon ;)

Sadly my coding suck so I would like to check some finished examples.

I know people have been modding BG2 and creating AI scripts, I just wonder if I can see source somehow? Either their scripts or original files, so I can see how basic things work :)

Baronius
Wed, 30th Apr '08, 1:45am
You might already know these, but a little information on formats: the binary data of scripts are stored in BCS, the game uses these. The decompiled files have BAF extension. WeiDU extends this format a little bit (the extension does't change, it's still BAF, but it can only be compiled by WeiDU). WeiDU, in case you didn't know, is the currently used platform to package and maintain mods.

You can find source files in the Scripts folder of your BG2 if I remember correctly, and just look for BAF files in the package of most mods.

Scripts are the most important dynamic aspect of the game. AI (and the whole BG2 world) is basically controlled by communicating extended (deterministic) finite state automata, that is what you realize via scripts. SimDing0 has a good practical tutorial (with smaller inaccuries and problems), it's called Scripting Guide or something like that, I suppose google finds it if you type "SimDing0 scripting" (without quotes, of course). If not, you can find it on pocketplane.net somewhere.