Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10859 for code/branches


Ignore:
Timestamp:
Nov 25, 2015, 6:46:20 PM (9 years ago)
Author:
gania
Message:

almost all works now, check AITest.oxw

Location:
code/branches/campaignHS15
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/campaignHS15/data/levels/AITest.oxw

    r10855 r10859  
    3434    <TeamSpawnPoint team=0 position="-1000,-1000,-1000" lookat="1,1,-1" spawnclass=SpaceShip pawndesign=spaceshipassff />
    3535   
    36 <!--
    37     <?lua
    38       for i = 0, 5, 1 do
    39     ?>
    40 
     36<!-- HERE STARTS DEMO FOR THE "WAYPOINTS" -->
     37    <!--   
     38    <Model mesh="cube.mesh" scale=8 position="  0,2000,-600" />
     39    <Model mesh="cube.mesh" scale=8 position="  0,2000,-700" />
     40    <Model mesh="cube.mesh" scale=8 position="100,2000,-700" />
     41    <Model mesh="cube.mesh" scale=8 position="100,2000,-600" />
     42    <Model mesh="cube.mesh" scale=8 position="0,0,0" />
     43
     44    <SpaceShip position="-1500, 1500, -1000" lookat="0,0,0" team=0 name="ss1">
     45      <templates>
     46        <Template link=spaceshipassff />
     47      </templates>
     48      <controller>
     49        <DivisionController team=0 formationMode="finger4">
     50          <actionpoints>
     51            <Actionpoint position="  0,2000,-600" action="FLY" loopStart=true/>
     52            <Actionpoint position="  0,2000,-700" action="FLY"  />
     53            <Actionpoint position="100,2000,-700" action="FLY" />
     54            <Actionpoint position="100,2000,-600" action="FLY" loopEnd=true />
     55          </actionpoints>
     56        </DivisionController>
     57      </controller>
     58    </SpaceShip>
     59    -->
     60<!-- HERE ENDS DEMO FOR THE "WAYPOINTS" -->
     61
     62<!-- HERE STARTS DEMO FOR THE ACTIONPOINTS -->
     63       
     64    <Model mesh="cube.mesh" scale=8 position="0,0,0" />
     65
     66    <SpaceShip position="-2000, 1500, -1000" lookat="0,0,0" team=0 name="ss2">
     67      <templates>
     68        <Template link=spaceshipassff />
     69      </templates>
     70      <controller>
     71        <DivisionController team=0 formationMode="finger4">
     72          <actionpoints>
     73            <Actionpoint position="0,0,0" action="FLY" />
     74            <Actionpoint position="-1000,750,-500" action="ATTACK" attack="ss3" />
     75            <Actionpoint position="-1000,750,-500" action="PROTECt" protect="fuck" />
     76          </actionpoints>
     77        </DivisionController>
     78      </controller>
     79    </SpaceShip>
     80    <SpaceShip position="-2000, 1900, -1000" lookat="0,0,0" team=0>
     81      <templates>
     82        <Template link=spaceshipassff />
     83      </templates>
     84      <controller>
     85        <SectionController team=0>
     86        </SectionController>
     87      </controller>
     88    </SpaceShip>
     89    <SpaceShip position="-2000, 2100, -1000" lookat="0,0,0" team=0>
     90      <templates>
     91        <Template link=spaceshipassff />
     92      </templates>
     93      <controller>
     94        <WingmanController team=0>
     95        </WingmanController>
     96      </controller>
     97    </SpaceShip>
     98    <SpaceShip position="-2000, 2400, -1000" lookat="0,0,0" team=0>
     99      <templates>
     100        <Template link=spaceshipassff />
     101      </templates>
     102      <controller>
     103        <WingmanController team=0>
     104        </WingmanController>
     105      </controller>
     106    </SpaceShip>
     107    <SpaceShip position="0, 0, 0" lookat="0,0,0" team=2 name="ss4">
     108      <templates>
     109        <Template link=spaceshipassff />
     110      </templates>
     111    </SpaceShip>
     112    <SpaceShip position="3000, 1000, 2000" lookat="0,0,0" team=2 name="ss3">
     113      <templates>
     114        <Template link=spaceshipassff />
     115      </templates>
     116    </SpaceShip>
     117    <SpaceShip position="-500, -300, -300" lookat="0,0,0" team=0 name="fuck">
     118      <templates>
     119        <Template link=spaceshipassff />
     120      </templates>
     121    </SpaceShip>
     122   
     123<!-- HERE ENDS DEMO FOR THE ACTIONPOINTS -->
     124<!-- HERE STARTS DEMO FOR FIGHTING -->
     125   <!-- 
     126    <SpaceShip position="-2000, 1500, -1000" lookat="0,0,0" team=0 name="ss2">
     127      <templates>
     128        <Template link=spaceshipassff />
     129      </templates>
     130      <controller>
     131        <DivisionController team=0 formationMode="finger4">
     132          <actionpoints>
     133            <Actionpoint position="0,0,0" action="ATTACK" attack="ss3" />
     134          </actionpoints>
     135        </DivisionController>
     136      </controller>
     137    </SpaceShip>
     138    <SpaceShip position="-2000, 1900, -1000" lookat="0,0,0" team=0>
     139      <templates>
     140        <Template link=spaceshipassff />
     141      </templates>
     142      <controller>
     143        <SectionController team=0>
     144        </SectionController>
     145      </controller>
     146    </SpaceShip>
     147    <SpaceShip position="-2000, 2100, -1000" lookat="0,0,0" team=0>
     148      <templates>
     149        <Template link=spaceshipassff />
     150      </templates>
     151      <controller>
     152        <WingmanController team=0>
     153        </WingmanController>
     154      </controller>
     155    </SpaceShip>
     156    <SpaceShip position="-2000, 2400, -1000" lookat="0,0,0" team=0>
     157      <templates>
     158        <Template link=spaceshipassff />
     159      </templates>
     160      <controller>
     161        <WingmanController team=0>
     162        </WingmanController>
     163      </controller>
     164    </SpaceShip>
     165
     166    <SpaceShip position="2000, -1500, 1000" lookat="0,0,0" team=1 name="ss3">
     167      <templates>
     168        <Template link=spaceshipassff />
     169      </templates>
     170      <controller>
     171        <DivisionController team=1 formationMode="WALL">
     172          <actionpoints>
     173            <Actionpoint position="0,0,0" action="ATTACk" attack="ss2" />
     174          </actionpoints>
     175        </DivisionController>
     176      </controller>
     177    </SpaceShip>
     178    <SpaceShip position="2000, -1900, 1000" lookat="0,0,0" team=1>
     179      <templates>
     180        <Template link=spaceshipassff />
     181      </templates>
     182      <controller>
     183        <SectionController team=1>
     184        </SectionController>
     185      </controller>
     186    </SpaceShip>
     187    <SpaceShip position="2000, -2100, 1000" lookat="0,0,0" team=1>
     188      <templates>
     189        <Template link=spaceshipassff />
     190      </templates>
     191      <controller>
     192        <WingmanController team=1>
     193        </WingmanController>
     194      </controller>
     195    </SpaceShip>
     196    <SpaceShip position="2000, -2400, 1000" lookat="0,0,0" team=1>
     197      <templates>
     198        <Template link=spaceshipassff />
     199      </templates>
     200      <controller>
     201        <WingmanController team=1>
     202        </WingmanController>
     203      </controller>
     204    </SpaceShip>
     205     -->
     206<!-- HERE ENDS DEMO FOR FIGHTING -->
     207<!-- HERE STARTS DEMO FOR FORMATIONS -->
     208    <!--
     209    <Model mesh="cube.mesh" scale=8 position="   0,2000,    0" />
     210    <Model mesh="cube.mesh" scale=8 position="   0,2000,-2000" />
     211    <Model mesh="cube.mesh" scale=8 position="2000,2000,-2000" />
     212    <Model mesh="cube.mesh" scale=8 position="2000,2000,    0" />
     213
     214    <SpaceShip position="-1500, 1500, -1000" lookat="0,0,0" team=0 name="ss1">
     215      <templates>
     216        <Template link=spaceshipassff />
     217      </templates>
     218      <controller>
     219        <DivisionController team=0 formationMode="DIAMOND">
     220          <actionpoints>
     221            <Actionpoint position="   0,2000,    0" action="FLY" loopStart=true/>
     222            <Actionpoint position="   0,2000,-2000" action="FLY"  />
     223            <Actionpoint position="2000,2000,-2000" action="FLY" />
     224            <Actionpoint position="2000,2000,    0" action="FLY" loopEnd=true />
     225          </actionpoints>
     226        </DivisionController>
     227      </controller>
     228    </SpaceShip>
     229
     230    <SpaceShip position="-2000, 1900, -1000" lookat="0,0,0" team=0>
     231      <templates>
     232        <Template link=spaceshipassff />
     233      </templates>
     234      <controller>
     235        <SectionController team=0>
     236        </SectionController>
     237      </controller>
     238    </SpaceShip>
     239    <SpaceShip position="-2000, 2100, -1000" lookat="0,0,0" team=0>
     240      <templates>
     241        <Template link=spaceshipassff />
     242      </templates>
     243      <controller>
     244        <WingmanController team=0>
     245        </WingmanController>
     246      </controller>
     247    </SpaceShip>
     248    <SpaceShip position="-2000, 2400, -1000" lookat="0,0,0" team=0>
     249      <templates>
     250        <Template link=spaceshipassff />
     251      </templates>
     252      <controller>
     253        <WingmanController team=0>
     254        </WingmanController>
     255      </controller>
     256    </SpaceShip>
     257    -->
     258<!-- HERE ENDS DEMO FOR FORMATIONS -->
    41259   
    42     <SpaceShip position="<?lua print(-1600+i*200) ?>,<?lua print(-3000-i*500) ?>, -1500 ?>" lookat="0,0,0">
    43       <templates>
    44         <Template link=spaceshipassff />
    45       </templates>
    46       <controller>
    47         <AIController accuracy=10 team=2>
    48         </AIController>
    49       </controller>
    50     </SpaceShip>
    51     <?lua end ?> -->
    52  
    53 <!--                 <ActionPoint position="12,34,56" action="FIGHT" enemy="ss" />
    54  -->
    55 <!--     <SpaceShip position="2000, 1500, -1000" lookat="0,0,0" team=0 name="ss1">
    56       <templates>
    57         <Template link=spaceshipassff />
    58       </templates>
    59       <controller>
    60         <DivisionController formationMode="wall" action="PROTECT" protect="FUCK" team=0>
    61         </DivisionController>
    62       </controller>
    63     </SpaceShip> -->
    64     <SpaceShip position="-1500, 1500, -1000" lookat="0,0,0" team=0 name="ss1">
    65       <templates>
    66         <Template link=spaceshipassff />
    67       </templates>
    68       <controller>
    69         <DivisionController team=0 formationMode="finger4">
    70           <actionpoints>
    71             <Actionpoint position="-1000,1000,-1000" action="FLY" loopStart=true />
    72             <Actionpoint position="-1250,1250,-500" action="FLY" />
    73             <Actionpoint position="-1500,1500,-1000" action="FLY" loopEnd=true />
    74           </actionpoints>
    75         </DivisionController>
    76       </controller>
    77     </SpaceShip>
    78     <SpaceShip position="-2000, 1500, -1000" lookat="0,0,0" team=0 name="ss2">
    79       <templates>
    80         <Template link=spaceshipassff />
    81       </templates>
    82       <controller>
    83         <DivisionController team=0 formationMode="finger4">
    84           <actionpoints>
    85             <Actionpoint position="0,0,0" action="FLY" />
    86             <Actionpoint position="-1000,750,-500" action="ATTACK" enemy="ss3" />
    87             <Actionpoint position="-1000,750,-500" action="PROTECt" protect="fuck" />
    88           </actionpoints>
    89         </DivisionController>
    90       </controller>
    91     </SpaceShip>
    92     <SpaceShip position="-2000, 1900, -1000" lookat="0,0,0" team=0>
    93       <templates>
    94         <Template link=spaceshipassff />
    95       </templates>
    96       <controller>
    97         <SectionController team=0>
    98         </SectionController>
    99       </controller>
    100     </SpaceShip>
    101     <SpaceShip position="0, 0, 0" lookat="0,0,0" team=2 name="ss4">
    102       <templates>
    103         <Template link=spaceshipassff />
    104       </templates>
    105     </SpaceShip>
    106     <SpaceShip position="1000, 300, 200" lookat="0,0,0" team=2 name="ss3">
    107       <templates>
    108         <Template link=spaceshipassff />
    109       </templates>
    110     </SpaceShip>
    111     <SpaceShip position="-500, -300, -300" lookat="0,0,0" team=0 name="fuck">
    112       <templates>
    113         <Template link=spaceshipassff />
    114       </templates>
    115     </SpaceShip>
    116    <!--  <SpaceShip position="4000 ,1500, -1600 " lookat="0,0,0" team=0>
    117       <templates>
    118         <Template link=spaceshipassff />
    119       </templates>
    120       <controller>
    121         <WingmanController team=0>
    122         </WingmanController>
    123       </controller>
    124     </SpaceShip>
    125     <SpaceShip position="4000, 1500, -2200" lookat="0,0,0" team=0>
    126       <templates>
    127         <Template link=spaceshipassff />
    128       </templates>
    129       <controller>
    130         <WingmanController team=0>
    131         </WingmanController>
    132       </controller>
    133     </SpaceShip>
    134     <SpaceShip position="4000, 1500, -2800 " lookat="0,0,0" team=0>
    135       <templates>
    136         <Template link=spaceshipassff />
    137       </templates>
    138       <controller>
    139         <SectionController team=0>
    140         </SectionController>
    141       </controller>
    142     </SpaceShip>
    143     <SpaceShip position="-4000, 1500, -2800 " lookat="0,0,0" team=0 name="FUCK">
    144       <templates>
    145         <Template link=spaceshipassff />
    146       </templates>
    147       <controller>
    148         <SectionController team=0>
    149         </SectionController>
    150       </controller>
    151     </SpaceShip> -->
    152    
    153     <!-- <SpaceShip position="-4000, 1500, -5000" lookat="0,0,0">
    154       <templates>
    155         <Template link=spaceshipassff />
    156       </templates>
    157       <controller>
    158         <DivisionController team=2 formationMode="wall" action="FIGHT">
    159         </DivisionController>
    160       </controller>
    161     </SpaceShip>
    162     <SpaceShip position="-4000 , 1500, -5600" lookat="0,0,0">
    163       <templates>
    164         <Template link=spaceshipassff />
    165       </templates>
    166       <controller>
    167         <WingmanController team=2>
    168         </WingmanController>
    169       </controller>
    170     </SpaceShip>
    171     <SpaceShip position="-4000, 1500, -6200" lookat="0,0,0">
    172       <templates>
    173         <Template link=spaceshipassff />
    174       </templates>
    175       <controller>
    176         <WingmanController team=2>
    177         </WingmanController>
    178       </controller>
    179     </SpaceShip>
    180     <SpaceShip position="-4000, 1500, -6800 " lookat="0,0,0">
    181       <templates>
    182         <Template link=spaceshipassff />
    183       </templates>
    184       <controller>
    185         <SectionController team=2>
    186         </SectionController>
    187       </controller>
    188     </SpaceShip> -->
    189 
    190260   
    191261   
  • code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc

    r10856 r10859  
    6363    CommonController::CommonController( Context* context ): Controller( context )
    6464    {
    65         this->squaredaccuracy_ = 10000;
     65        this->squaredaccuracy_ = 2500;
    6666        this->bFirstTick_ = true;
    6767        this->tolerance_ = 50;
     
    7171        this->bInLoop_ = false;
    7272        this->bLoop_ = false;
     73        this->bEndLoop_ = false;
     74        this->parsedActionpoints_.clear();
    7375        RegisterObject( CommonController );
     76
    7477    }
    7578    CommonController::~CommonController()
    7679    {
    77        
    7880    }
    7981    void CommonController::tick(float dt)
     
    161163        Vector3 position;
    162164        std::string targetName;
    163         bool inLoop;
     165        bool inLoop = false;
    164166        Point p;
    165167        if (static_cast<Actionpoint*> (actionpoint))
     
    170172            position = ap->getWorldPosition();
    171173
    172             if (!this->bInLoop_ && ap->getStartLoop())
     174            if (this->bEndLoop_)
     175            {
     176                this->bInLoop_ = false;
     177            }
     178            if (!this->bInLoop_ && ap->getLoopStart())
    173179            {
    174180                this->bInLoop_ = true;
    175181            }
    176             if (this->bInLoop_ && ap->getEndLoop())
    177             {
    178                 this->bInLoop_ = false;
     182            if (this->bInLoop_ && ap->getLoopEnd())
     183            {
     184                this->bEndLoop_ = true;
    179185            }
    180186            inLoop = this->bInLoop_;
     
    197203                ThrowException( ParseError, std::string( "Attempting to set an unknown Action: '" )+ actionName + "'." );
    198204            p.action = value; p.name = targetName; p.position = position; p.inLoop = inLoop;
    199             parsedActionpoints_.push_back(p);
    200205        }
    201206        else
     
    519524        while( diff>math::twoPi )diff-=math::twoPi;
    520525        while( diff<-math::twoPi )diff+=math::twoPi;
    521         this->getControllableEntity() ->rotateRoll( diff*ROTATEFACTOR * dt );
     526        this->getControllableEntity() ->rotateRoll( diff*0.2f*ROTATEFACTOR * dt );
    522527    }
    523528    void CommonController::copyTargetOrientation( float dt )
     
    975980    void CommonController::nextActionpoint()
    976981    {
     982        if (!this || !this->getControllableEntity())
     983            return;
    977984        if (this->bLoop_)
    978985        {
     
    10191026    void CommonController::action()
    10201027    {
     1028        if (!this || !this->getControllableEntity())
     1029            return;
     1030        orxout (internal_error) << "Size of actions is " << this->parsedActionpoints_.size() << endl;
    10211031        this->startAttackingEnemiesThatAreClose();
    10221032        //No action -> pop one from stack
     
    11261136      this->bLoop_ = b;
    11271137      this->setAction (Action::NONE);
    1128       this->setTarget(0);
    1129       this->setTargetPosition (this->getControllableEntity()->getWorldPosition());
     1138      // this->setTarget(0);
     1139      // this->setTargetPosition (this->getControllableEntity()->getWorldPosition());
    11301140      orxout(internal_error) << "Top action is " << this->parsedActionpoints_.back().action << endl;
    11311141    }
  • code/branches/campaignHS15/src/orxonox/controllers/CommonController.h

    r10856 r10859  
    138138                virtual void stayNearProtect();
    139139                virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour.
    140            
     140                 virtual void takeActionpoints (std::vector<Point > vector, std::vector<Point > loop, bool b);
     141   
    141142        protected:
    142143            //----[Flying methods]----
     
    227228                bool bFirstTick_;
    228229                bool bInLoop_;
    229                 bool bLoop_;                   
     230                bool bLoop_;   
     231                bool bEndLoop_;               
    230232            //----[/"Private" variables]----   
    231         virtual void takeActionpoints (std::vector<Point > vector, std::vector<Point > loop, bool b);
    232233           
    233234    };
  • code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc

    r10858 r10859  
    5050    DivisionController::~DivisionController()
    5151    {
    52         if (this->myFollower_)
    53         {
    54             this->myFollower_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
    55             if (this->myWingman_)
    56             {
    57                 this->myWingman_->setAction(Action::FIGHTALL);
    58             }
    59         }
    60         else if (this->myWingman_)
    61         {
    62             this->myWingman_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
    63         }
     52        // if (!(this->parsedActionpoints_.empty() && this->loopActionpoints_.empty()))
     53        // {
     54        //     if (this->myFollower_)
     55        //     {
     56        //         this->myFollower_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
     57        //         if (this->myWingman_)
     58        //         {
     59        //             this->myWingman_->setAction(Action::FIGHTALL);
     60        //         }
     61        //     }
     62        //     else if (this->myWingman_)
     63        //     {
     64        //         this->myWingman_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
     65        //     }   
     66        // }
    6467        for (size_t i = 0; i < this->actionpoints_.size(); ++i)
    6568        {
     
    8588    void DivisionController::action()
    8689    {   
     90        if (!this || !this->getControllableEntity())
     91            return;
    8792        CommonController::action();
     93       
    8894    }
    8995    void DivisionController::stayNearProtect()
  • code/branches/campaignHS15/src/orxonox/controllers/LeaderController.cc

    r10856 r10859  
    5252    }
    5353   
    54 
     54   
    5555
    5656}
  • code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc

    r10858 r10859  
    5151    SectionController::~SectionController()
    5252    {
    53         if (this->myWingman_)
    54         {
    55             this->myWingman_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
    56         }
     53        // if (this->myWingman_)
     54        // {
     55        //     this->myWingman_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
     56        // }
    5757       for (size_t i = 0; i < this->actionpoints_.size(); ++i)
    5858        {
     
    8282    void SectionController::action()
    8383    {
     84        if (!this || !this->getControllableEntity())
     85            return;
    8486
    8587        //----If no leader, find one---- 
  • code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc

    r10858 r10859  
    130130                        return;
    131131                    }
     132                   
    132133                    ControllableEntity* leaderEntity = this->myLeader_->getControllableEntity();
    133134                    Quaternion orient = leaderEntity->getWorldOrientation();
     
    176177                case FormationMode::WALL:
    177178                {
    178                     targetRelativePositionOfWingman = new Vector3 (400, 0, 0); 
     179                    targetRelativePosition = new Vector3 (400, 0, 0); 
    179180                    break;
    180181                }
    181182                case FormationMode::FINGER4:
    182183                {
    183                     targetRelativePositionOfWingman = new Vector3 (400, 0, 200); 
     184                    targetRelativePosition = new Vector3 (400, 0, 200); 
    184185                    break;
    185186                }
    186187                case FormationMode::DIAMOND:
    187188                {
    188                     targetRelativePositionOfWingman = new Vector3 (400, 0, 200);                 
     189                    targetRelativePosition = new Vector3 (400, 0, 200);                 
    189190                    break;
    190191                }
     
    193194        else
    194195        {
     196
    195197            switch (this->formationMode_){
    196198                case FormationMode::WALL:
    197199                {
    198                     targetRelativePositionOfWingman = new Vector3 (-400, 0, 0); 
     200                    targetRelativePosition = new Vector3 (-400, 0, 0); 
    199201                    break;
    200202                }
    201203                case FormationMode::FINGER4:
    202204                {
    203                     targetRelativePositionOfWingman = new Vector3 (-400, 0, 200); 
     205                    targetRelativePosition = new Vector3 (-400, 0, 200); 
    204206                    break;
    205207                }
    206208                case FormationMode::DIAMOND:
    207209                {
    208                     targetRelativePositionOfWingman = new Vector3 (400, -200, 0);                 
     210                    targetRelativePosition = new Vector3 (400, -200, 0);                 
    209211                    break;
    210212                }
Note: See TracChangeset for help on using the changeset viewer.