Nice description PM, these steps are well-defined and I agree to this separation. But: My goals file is exactly your step 2! What makes you think it's an entire Think function? ???
The perception is implemented completely in C-code (a part of that is still missing in PIA, though), as is the action... (called Behaviour in PIA, but still). Look at the latest Think function, I added comments for the steps:
Code:
void PIA_Bot::think()
{
// step 1: sense
myPerception->scanEnvironment( game()->world() );
// step 2: decide what to do, this is based on the goals.xml file
myGoalFinder->analyze( myPerception );
// step 3: get C modules for the implementation of the goal and execute
PIA_Behaviour *behaviour = myGoalFinder->getBehaviour();
PIA_Perceipt *trigger = myGoalFinder->getTrigger();
if (behaviour) behaviour->execute( this, trigger );
};
I mean, that code is the definition of your 3 steps, man... I think I have to add the missing classes and a bit of documentation to the framework to make things clearer. Actually, the basic "action execution" part is missing as well, that might make you think the XML does this - but it does not, trust me
