Game Development Reference
In-Depth Information
Evaluating knowledge sources
To evaluate a blackboard attribute, we iterate over each knowledge source and return the
result with the highest confidence. As confidence indicates the best result, each blackboard
attribute can have any number of knowledge sources providing resulting calculations.
Note
Even though the blackboard structure supports multiple attribute providers, balancing con-
fidence values can quickly hit a dimensionality problem where balancing each confidence
becomes unmaintainable.
To implement source evaluation, we'll evaluate all knowledge sources and return the result
that has the highest confidence.
Blackboard.lua :
local function EvaluateSources(self, sources)
local bestConfidence = 0;
local bestResult = nil;
-- Since there can be multiple data source for a
single
-- blackboard attribute, return the best result based on
the
-- confidence of the knowledge source.
for index = 1, #sources do
local eval = sources[index]:Evaluate(self.userData_);
if (eval.confidence > bestConfidence) then
bestConfidence = eval.confidence;
bestResult = eval.evaluation;
end
end
return bestResult;
end
Search WWH ::




Custom Search