View Single Post
Re: Independed Thinking Machine
Old
  (#7)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: Independed Thinking Machine - 21-12-2004

about how I solved this join stuff : In JoeBOT XP most is inside behaviours, but the joining is not. well, I wanted to write it is, but I looked it up and it isnt ... well, so it's basically the same you are doing stefan, except that I have a general function handling all sort of menues, which is a virtual function and thus is automatically used if a derived class has another handling than the normal HL bot. Maybe putting this into the structure of the behaviuors would be a fine way since that doesnt imply the need of another function ... nice idea, if I had only time.

About the network messages : ( havnt yet implemented all of them, just those I need at the moment ) They produce perceipts, like those perceipts when a bot sees another player, therefore they are processed by behaviours like almost everything else. this is something that's so to say part of the layer "converting" the information which the engine provides.

Code:
CBaseBot *pBot = g_pGame->getBot(bot_index);
if ((damage_armor > 0) || (damage_taken > 0)){
/*if ((damage_bits & (DMG_FALL | DMG_CRUSH)){ 
// bot received damage by falling down
}*/
// ignore certain types of damage...
if (damage_bits & IGNORE_DAMAGE){
// let the bot 'feel' something strange is going on ... health is going down, m8 !
CPerceipt *pNewPerceipt = pBot->m_pPerception->addPerceipt();
 
pNewPerceipt->m_VOrigin = damage_origin;
pNewPerceipt->m_lType = CPerceipt::PT_DAMAGE;
pNewPerceipt->m_lTypeSpec |= CPerceipt::PTX_DAMAGE_STRANGE;
pNewPerceipt->m_fDistance = (pBot->getOrigin()-damage_origin).length();
pNewPerceipt->m_iAddInfo = damage_bits;
}
else{
// let the bot 'feel' that he's attacked :)
CPerceipt *pNewPerceipt = pBot->m_pPerception->addPerceipt();
 
pNewPerceipt->m_VOrigin = damage_origin;
pNewPerceipt->m_lType = CPerceipt::PT_DAMAGE;
pNewPerceipt->m_fDistance = (pBot->getOrigin()-damage_origin).length();
pNewPerceipt->m_iAddInfo = damage_bits;
g_Map.m_Waypoints.addDamage(pBot->getOrigin(),damage_origin,damage_armor + damage_taken);
}
}
( bah, again that distance code I wanted to change )

and then those information is used fully engine indep in a behaviour

Code:
// watch Damage
void CBV_HLDM_WatchDamage::evaluate(list<CGoal> *pGoals,CPerceipt* p){
if(p->m_lType == CPerceipt::PT_DAMAGE
&&!(p->m_lTypeSpec & CPerceipt::PTX_DAMAGE_STRANGE)){
pGoals->push_front(CGoal(
(15)*((p->m_fLifetime - g_pGame->getTime() + p->m_fLUpdate)/p->m_fLifetime),
CGoal::GT_LOOK,this,p));
}
return;
}
 
 
void CBV_HLDM_WatchDamage::execute(CGoal *pGoal){
m_fLastExecution = g_pGame->getTime();
 
if(pGoal->m_pPerceipt){
m_pBot->m_pAction->lookTo(pGoal->m_pPerceipt->m_VOrigin);
}
}



Last edited by @$3.1415rin; 21-12-2004 at 23:36..
  
Reply With Quote