Jump to content

SCS v32: prebuffing

Recommended Posts

'Prebuffing' - that is, casting spells immediately at the start of combat, to simulate having cast spells well in advance of combat - is one of the more controversial bits of any AI mod. Pretty much all AI does it to some extent (even in the vanilla game) and without it the player has a huge advantage, but exactly how much prebuffing to use is very much a matter of taste and it's one thing that some players find annoying about SCS.

Version 32 of SCS (now feature-complete and most of the way through its testing cycle) systematises and fine-graines the prebuffing options, and ties them to the difficulty slider (hopefully making it easier for players to adjust prebuffing on the fly if they find it's too much or too little). The system is based on the spell's duration: roughly speaking,

  • defensive sequencers and contingencies are used on all difficulty settings.
  • spells with a duration of several hours or more (like Stoneskin, or (in IWD/SR) Mind Blank) are precast on IMPROVED (setting 2) and higher difficulty.
  • spells with a duration of one turn per level or more are precast on TACTICAL (setting 3) and higher difficulty.
  • spells with a duration of three rounds per level or more are precast on HARDCORE (setting 4) and higher difficulty. They're also precast on TACTICAL difficulty if the spellcaster appears in front of the party (e.g. by teleporting, or because they're in sight when you enter the map).
  • spells with a duration of one round per level or more are precast on INSANE (setting 5) difficulty. They're also precast on HARDCORE difficulty if the spellcaster appears in front of the party.
  • spells with a duration of less than one round per level never get precast.
  • spells that don't fit the usual N rounds per level duration get treated a bit ad hoc, but roughly as if the caster was 10th level, e.g. spells with a fixed duration of 10 rounds count as "one round per level".

As usual, you can fine-tune this difficulty using the difficulty widget. Prebuffing difficulty is independent of the rest of the spellcaster's difficulty, so you can (e.g.) turn off prebuffing entirely and otherwise have the spellcaster fight at INSANE level.

I should say that this is all a bit less systematic in SR, which changes the durations a lot and in particular doesn't have durations proportional to level (I assume at least in part because the way SR was coded would have made it very tedious to implement.) I've kept a vague eye on the changes but for the most part I've just treated SR spells as if they had the vanilla durations.

Link to comment

Sounds like a definite improvement over the old all-or-nothing prebuffing routine (thumbup)


On that note, rather than duration you could try segregating buffs by their type instead. In SoD I grouped them like this:

1) Buffs against physical attacks, further split into:

- Decremental defenses (Stoneskin, Mirror Image)

- Immunity to weapons (Protection from Weapons/Missiles, Physical Mirror)

2) Buffs against spells, split into:

- Immunity to spells by level (Spell Turning, Globe of Invulnerability)

- Invisibility - not really an anti-magic defense with SCS+SR, but nevertheless so in SoD

3) Partial protections (Pro Evil, Fire Shield, Armor of Faith, Blur, Spirit Armor) and combat enhancements (DUHM, Blade Barrier, again Fire Shield).


On Normal difficulty AI would randomly select a subgroup for both anti-attack and anti-magic protections and cast the strongest buff it has available there. If the wizard had no spells in selected subgroup at all, there'd be no buffing in that category. This effectively reduces the amount of buffing by 50%.

On Core there'd be no random rolling, and the strongest buff from each subgroup would be precast. In addition, any extra buff from the third group would also be applied.


For high-level BG2 caster with access to wider array of spells the grouping can be further refined and extended across difficulty levels (the SoD buffing routine was mostly for low to mid levels, and I readily admit I was too lazy to spread it across more than three difficulty levels).

Edited by Ardanis
Link to comment

The idea of duration (over and above having *something* systematic) is that it pays at least lip service to verisimilitude: the higher the difficulty, the more the spellcaster is assumed to be keeping close track of the strategic situation, and so the more precisely they can time their casting. (At one extreme, there's just no excuse for a spellcaster remotely expecting combat *not* to cast Stoneskin, so I wouldn't want to block Stoneskin except on the absolute-easiest difficulty setting.)


But it's something to monitor when I get reports in - theory only goes so far here, and of course SoD had and has a large playtest data-set.

Link to comment

The idea of duration (over and above having *something* systematic) is that it pays at least lip service to verisimilitude

I think this is the more reasonable approach, too. Put another way, the odds that a mage has cast Stoneskin sometime in the last eight hours before meeting the party are substantially higher than he/she casting Protection from Magical Weapons in the last four rounds. The exception being, as you noted, the mages that are ambushing the party.

Link to comment
Guest Macnube

Does the following still hold true?


DMWWNeutralPrebuff - set to 1 to allow neutral mages and priests to have long-term defences like Stoneskin in place, rather than insta-casting them when they go hostile. (Arguably this is more realistic, but it can be offputting.)


Changing this setting in the console doesn't seem to affect prebuff behavior as far as I can tell, and the only reference I can find to the variable lives in gohostile.ssl.

BGEE+SOD (Steam)

SCS 32 r8  commit: 6700e5040f6a3793077e718e975e95412f683d46

Link to comment
Guest Macnube

I'm really enjoying how SCS 32 ties prebuffing behavior to the difficulty settings - in which file(s) is this behavior controlled? I'm currently going through BG1EE and am thinking that, in BG2, I would like to tweak some of the behavior to a mix of tactical and hardcore if the architecture supports it; is there a variable I can search for to help me get started? Along the same lines, and as a thought for future versions of SCS, it might be cool to split prebuffing behavior based on whether or not a caster appears in sight of the party if doing so wouldn't be too radical of a change. The feel i'm going for is that casters in general would only prebuff with long lasting buffs (i.e. tactical behavior, where 1 turn per level is the limit to what strikes me as reasonable for all day buffs), but that casters expecting a fight prebuff with everything they have (i.e. hardcore behavior, they buff to the max in preparation for an ambush or whatever).

Link to comment

Look in stratagems/ssl/difficulty.slb - it’s controlled by the *Prep trigger definitions. (Be warned that they are easy to break - I had to resort to propositional logic in the end to get them working correctly.)

Glad you’re enjoying it, in any case, and I’ll consider the suggestion, though there is some complexity overhead.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...