Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: Baldur's Gate AI and using simple rules (was Matching Rule)



> I would ask - how many monsters/unit types did they have to programs
> (if many then I figure they were busy getting all of them programmed...)
> How many spells are available to  units

Let me make this really clear - the AI for Baldur's Gate blew goats

They had to list every single stinkin' spell. You had 100 spells, they
listed evey single one out

__IF haveSpell(DeathHurricane) THEN...

They listed a ton of these really simple lines out. The first to match
wins. The result were scripts that were hundreds of lines long. And if
you added a new spell, it would never get used unless you modified the
script

Weapons, too, were like this. LONG_SWORD_+3, LONG_SWORD_+4,
LONG_SWORD_OF_LIGHTNING, etc. Another hundred of those

Now what happens when your character is a fighter but happens to have
a few spells (rangers, paladins, some NPCs and multiclassed)? Another
script which is really, really long and makes you answer the question,
which is better, a +4 sword or a lightning bolt spell?

Needless to say, given how many lines were spent just on the attack
option, BG made almost no attempt to add context. So you shot fire
dragons, who are 100% fire resistant, with fire arrows. The arrow
would do nothing and the engine was smart enough to notice this and
trigger the WAV file "my weapon is doing no damage!". But it kept
using the weapon anyway. Grr...

Another effect of this is that the most powerful items were used first
and your once-a-day special attacks were all used right away, not
spaced out. No sense of pacing

If i had to give an example of how not to write an AI, Baldur's Gate
would be it. Not just because the default AI was frustratingly bad but
because the API was so limited that users could write their own AI but
couldn't write good AI

On the bright side, many games have atrocious AI but BG was one of the
few that let you modify it, so that's a plus


As i analyzed the AI for BG, i did notice one thing that was
interesting. All the spells could be described by just a few
parameters, which to me always screams "formula!". 
  Purpose: defensive, offensive, curative
  NumAffected: single person, group
  Medium: fire, cold, poison, acid, magic
  Strength: spell level 1-9
You could also add in, if you wanted, casting time (weaker spells took
less time) and duration, but these usually didn't vary much and didn't
define/discriminate spells (ie, there weren't many spells that did the
same thing but one took 3 rounds and the other took 9)

Given that, you would think you could just tag each spell with values
for each of the 4 primary parameters and then use a nice simple
formula to pick the spell. Then you could add and remove spells all
you wanted

How do you let users customize that? Well, you could let them set the
weights for each value (heavy defense, heavy offense, prefer damage to
spell casting time, etc.) or you could let them override/write the
actual spell picking formula

And it let's you match a response to a threat. Fighting a 4hp goblin?
Use a spell that comes closest to doing 4hp of damage (bias to >=).
Don't use your sole Power Word Death on it


> Alot of these games also leave the strategy to the player who have to match
> the proper unit flavor as a counter to the oponents flavor mix.

Yup. Kinda not fun (in many games, not all) if you have to
micromanage. And it means the enemy probably isn't too smart either


> Did any other units have more versatile script -  like some arch-mage who
> has more versatile attacks (and maybe even filters to use them appropriately)

In BG, no

-b



<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com




Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.




Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.