Changeset 10859
- Timestamp:
- Nov 25, 2015, 6:46:20 PM (9 years ago)
- Location:
- code/branches/campaignHS15
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/data/levels/AITest.oxw
r10855 r10859 34 34 <TeamSpawnPoint team=0 position="-1000,-1000,-1000" lookat="1,1,-1" spawnclass=SpaceShip pawndesign=spaceshipassff /> 35 35 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 --> 41 259 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 190 260 191 261 -
code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc
r10856 r10859 63 63 CommonController::CommonController( Context* context ): Controller( context ) 64 64 { 65 this->squaredaccuracy_ = 10000;65 this->squaredaccuracy_ = 2500; 66 66 this->bFirstTick_ = true; 67 67 this->tolerance_ = 50; … … 71 71 this->bInLoop_ = false; 72 72 this->bLoop_ = false; 73 this->bEndLoop_ = false; 74 this->parsedActionpoints_.clear(); 73 75 RegisterObject( CommonController ); 76 74 77 } 75 78 CommonController::~CommonController() 76 79 { 77 78 80 } 79 81 void CommonController::tick(float dt) … … 161 163 Vector3 position; 162 164 std::string targetName; 163 bool inLoop ;165 bool inLoop = false; 164 166 Point p; 165 167 if (static_cast<Actionpoint*> (actionpoint)) … … 170 172 position = ap->getWorldPosition(); 171 173 172 if (!this->bInLoop_ && ap->getStartLoop()) 174 if (this->bEndLoop_) 175 { 176 this->bInLoop_ = false; 177 } 178 if (!this->bInLoop_ && ap->getLoopStart()) 173 179 { 174 180 this->bInLoop_ = true; 175 181 } 176 if (this->bInLoop_ && ap->get EndLoop())177 { 178 this->b InLoop_ = false;182 if (this->bInLoop_ && ap->getLoopEnd()) 183 { 184 this->bEndLoop_ = true; 179 185 } 180 186 inLoop = this->bInLoop_; … … 197 203 ThrowException( ParseError, std::string( "Attempting to set an unknown Action: '" )+ actionName + "'." ); 198 204 p.action = value; p.name = targetName; p.position = position; p.inLoop = inLoop; 199 parsedActionpoints_.push_back(p);200 205 } 201 206 else … … 519 524 while( diff>math::twoPi )diff-=math::twoPi; 520 525 while( diff<-math::twoPi )diff+=math::twoPi; 521 this->getControllableEntity() ->rotateRoll( diff* ROTATEFACTOR * dt );526 this->getControllableEntity() ->rotateRoll( diff*0.2f*ROTATEFACTOR * dt ); 522 527 } 523 528 void CommonController::copyTargetOrientation( float dt ) … … 975 980 void CommonController::nextActionpoint() 976 981 { 982 if (!this || !this->getControllableEntity()) 983 return; 977 984 if (this->bLoop_) 978 985 { … … 1019 1026 void CommonController::action() 1020 1027 { 1028 if (!this || !this->getControllableEntity()) 1029 return; 1030 orxout (internal_error) << "Size of actions is " << this->parsedActionpoints_.size() << endl; 1021 1031 this->startAttackingEnemiesThatAreClose(); 1022 1032 //No action -> pop one from stack … … 1126 1136 this->bLoop_ = b; 1127 1137 this->setAction (Action::NONE); 1128 this->setTarget(0);1129 this->setTargetPosition (this->getControllableEntity()->getWorldPosition());1138 // this->setTarget(0); 1139 // this->setTargetPosition (this->getControllableEntity()->getWorldPosition()); 1130 1140 orxout(internal_error) << "Top action is " << this->parsedActionpoints_.back().action << endl; 1131 1141 } -
code/branches/campaignHS15/src/orxonox/controllers/CommonController.h
r10856 r10859 138 138 virtual void stayNearProtect(); 139 139 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 141 142 protected: 142 143 //----[Flying methods]---- … … 227 228 bool bFirstTick_; 228 229 bool bInLoop_; 229 bool bLoop_; 230 bool bLoop_; 231 bool bEndLoop_; 230 232 //----[/"Private" variables]---- 231 virtual void takeActionpoints (std::vector<Point > vector, std::vector<Point > loop, bool b);232 233 233 234 }; -
code/branches/campaignHS15/src/orxonox/controllers/DivisionController.cc
r10858 r10859 50 50 DivisionController::~DivisionController() 51 51 { 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 // } 64 67 for (size_t i = 0; i < this->actionpoints_.size(); ++i) 65 68 { … … 85 88 void DivisionController::action() 86 89 { 90 if (!this || !this->getControllableEntity()) 91 return; 87 92 CommonController::action(); 93 88 94 } 89 95 void DivisionController::stayNearProtect() -
code/branches/campaignHS15/src/orxonox/controllers/LeaderController.cc
r10856 r10859 52 52 } 53 53 54 54 55 55 56 56 } -
code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc
r10858 r10859 51 51 SectionController::~SectionController() 52 52 { 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 // } 57 57 for (size_t i = 0; i < this->actionpoints_.size(); ++i) 58 58 { … … 82 82 void SectionController::action() 83 83 { 84 if (!this || !this->getControllableEntity()) 85 return; 84 86 85 87 //----If no leader, find one---- -
code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc
r10858 r10859 130 130 return; 131 131 } 132 132 133 ControllableEntity* leaderEntity = this->myLeader_->getControllableEntity(); 133 134 Quaternion orient = leaderEntity->getWorldOrientation(); … … 176 177 case FormationMode::WALL: 177 178 { 178 targetRelativePosition OfWingman= new Vector3 (400, 0, 0);179 targetRelativePosition = new Vector3 (400, 0, 0); 179 180 break; 180 181 } 181 182 case FormationMode::FINGER4: 182 183 { 183 targetRelativePosition OfWingman= new Vector3 (400, 0, 200);184 targetRelativePosition = new Vector3 (400, 0, 200); 184 185 break; 185 186 } 186 187 case FormationMode::DIAMOND: 187 188 { 188 targetRelativePosition OfWingman= new Vector3 (400, 0, 200);189 targetRelativePosition = new Vector3 (400, 0, 200); 189 190 break; 190 191 } … … 193 194 else 194 195 { 196 195 197 switch (this->formationMode_){ 196 198 case FormationMode::WALL: 197 199 { 198 targetRelativePosition OfWingman= new Vector3 (-400, 0, 0);200 targetRelativePosition = new Vector3 (-400, 0, 0); 199 201 break; 200 202 } 201 203 case FormationMode::FINGER4: 202 204 { 203 targetRelativePosition OfWingman= new Vector3 (-400, 0, 200);205 targetRelativePosition = new Vector3 (-400, 0, 200); 204 206 break; 205 207 } 206 208 case FormationMode::DIAMOND: 207 209 { 208 targetRelativePosition OfWingman= new Vector3 (400, -200, 0);210 targetRelativePosition = new Vector3 (400, -200, 0); 209 211 break; 210 212 }
Note: See TracChangeset
for help on using the changeset viewer.