-
Notifications
You must be signed in to change notification settings - Fork 2.2k
BPD classroom
Almost everything in here is courtesy of LightChaosMan so go say thanks, that said dont annoy him about this stuff since its complicated.
Welcome to the BPD-classroom. Here we will be explaining how BPDs (Behavior Provider Definition) work, and how you can change them, without crashing your game, as well as the parts that are currently unknown.
BPDs govern most interesting stuff in the game.
NPC's transfering during quests, the Butcher ammo gimmick, intersting skills like blood soaked shields, all action skills, amp shields, enemies spawning attached to each other and 100s of more things probably.
What does a BPD do?
- Well, it's all in the name, it provides behavior to whatever it is it is attached to. Some things that have just a single behavior, like splash damage, can use the Behavior_xxxxx directly.
If you need more than one Behavior to accomplish your goal, a BPD comes into play.
A BPD will combine multiple Behaviors into a single neat package, that works on it's own. It can be thought of as a different level of code inside the Borderlands code.
This is because you can make the separate Behaviors in a BPD affect one another.
For example, with amp shields, the BPD more or less translates to
If current shield == max shield
then damage shield
and play sound effect
All 3 code blocks above are separate Behaviors, and the latter two will only be executed if they get the okay sign from the first.
Like this, you can create complicated if-then-else things, with random chance, delay and whatnot in between, hence my comparison to a different level of code.
If you want an example of a full blown web of behaviors, have a look at the BPD of an action skill.
Alright, so we know it does cool stuff, but what does it actually look like?
we'll be using one main BPD during this tutorial, which is the one chaos used to teach myself how they work, the BPD for amp shields. GD_Shields.Skills.Impact_Shield_Skill:BehaviorProviderDefinition_0
Using a certain awesome tool, you can make it look somewhat organized, as shown here
Like in the example above, all BPDs contain an array BehaviorSequence
. This array will usually only contain a single entry, which is the actual BehaviorSequence
we're interested in.
When referring to a BPD in the rest of class, we will be referring to whatever is inside this BehaviorSequence
.
Each BehaviorSequence contains a couple of fields of its own. The parts that are interesting to us are EventData2
, BehaviorData2
, ConsolidatedOutputLinkData
, ConsolidatedVariableLinkData
and ConsolidatedLinkedVariables
.
As the name implies, a BehaviorSequence
, is actually a sequence of behaviors. That is, it is a load of behaviors linked together, in some way.
The actual behaviors that are being linked are the ones listed in BehaviorData2
.
How they are linked, is not clear at all, at least not at first glance. You'll notice throughout the entire BPD, there's all these wierd looking numbers, that seem completely random.
Well, they're not random. These numbers are actually the things that connect everything together, in a 'connect the dots' kind of fashion.