Changeset 8980 for code/branches/presentation2011/src/orxonox
- Timestamp:
- Dec 14, 2011, 2:38:37 PM (13 years ago)
- Location:
- code/branches/presentation2011
- Files:
-
- 17 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2011
- Property svn:mergeinfo changed
/code/branches/gamecontent (added) merged: 8893,8895,8899-8901,8904,8907,8909-8910,8922-8924,8930,8932,8941-8942,8950-8951,8956
- Property svn:mergeinfo changed
-
code/branches/presentation2011/src/orxonox/controllers/AIController.cc
r8891 r8980 74 74 } 75 75 76 // search enemy 77 random = rnd(maxrand); 78 if (random < (15 + botlevel_* 20) && (!this->target_)) 79 this->searchNewTarget(); 80 81 // forget enemy 82 random = rnd(maxrand); 83 if (random < ((1-botlevel_)*6) && (this->target_)) 84 this->forgetTarget(); 85 86 // next enemy 87 random = rnd(maxrand); 88 if (random < (botlevel_*20) && (this->target_)) 89 this->searchNewTarget(); 90 91 // fly somewhere 92 random = rnd(maxrand); 93 if (random < 50 && (!this->bHasTargetPosition_ && !this->target_)) 94 this->searchRandomTargetPosition(); 95 96 // stop flying 97 random = rnd(maxrand); 98 if (random < 10 && (this->bHasTargetPosition_ && !this->target_)) 99 this->bHasTargetPosition_ = false; 100 101 // fly somewhere else 102 random = rnd(maxrand); 103 if (random < 30 && (this->bHasTargetPosition_ && !this->target_)) 104 this->searchRandomTargetPosition(); 105 106 // shoot 107 random = rnd(maxrand); 108 if (!(this->passive_) && random < (75 + botlevel_*25) && (this->target_ && !this->bShooting_)) 109 this->bShooting_ = true; 110 111 // stop shooting 112 random = rnd(maxrand); 113 if (random < ((1 - botlevel_)*25) && (this->bShooting_)) 114 this->bShooting_ = false; 115 116 // boost 117 random = rnd(maxrand); 118 if (random < botlevel_*100 ) 119 this->boostControl(); 120 121 // update Checkpoints 122 /*random = rnd(maxrand); 123 if (this->defaultWaypoint_ && random > (maxrand-10)) 124 this->manageWaypoints(); 125 else //if(random > maxrand-10) //CHECK USABILITY!!*/ 126 if (this->waypoints_.size() == 0 ) 127 this->manageWaypoints(); 128 76 this->defaultBehaviour(maxrand); 129 77 } 130 78 … … 136 84 if (this->state_ == MASTER) 137 85 { 138 139 140 86 this->commandSlaves(); 141 87 … … 170 116 this->searchNewMaster(); 171 117 172 // search enemy 173 random = rnd(maxrand); 174 if (random < (botlevel_)*25 && (!this->target_)) 175 this->searchNewTarget(); 176 177 // forget enemy 178 random = rnd(maxrand); 179 if (random < (1-botlevel_)*6 && (this->target_)) 180 this->forgetTarget(); 181 182 // next enemy 183 random = rnd(maxrand); 184 if (random < 10 && (this->target_)) 185 this->searchNewTarget(); 186 187 // fly somewhere 188 random = rnd(maxrand); 189 if (random < 50 && (!this->bHasTargetPosition_ && !this->target_)) 190 this->searchRandomTargetPosition(); 191 192 193 // fly somewhere else 194 random = rnd(maxrand); 195 if (random < 30 && (this->bHasTargetPosition_ && !this->target_)) 196 this->searchRandomTargetPosition(); 197 198 // shoot 199 random = rnd(maxrand); 200 if (!(this->passive_) && random < 25*(botlevel_)+1 && (this->target_ && !this->bShooting_)) 201 { 202 this->bShooting_ = true; 203 this->forceFreeSlaves(); 204 } 205 206 // stop shooting 207 random = rnd(maxrand); 208 if (random < ( (1- botlevel_)*25 ) && (this->bShooting_)) 209 this->bShooting_ = false; 210 211 // boost 212 random = rnd(maxrand); 213 if (random < botlevel_*100 ) 214 this->boostControl(); 215 216 // update Checkpoints 217 /*random = rnd(maxrand); 218 if (this->defaultWaypoint_ && random > (maxrand-10)) 219 this->manageWaypoints(); 220 else //if(random > maxrand-10) //CHECK USABILITY!!*/ 221 if (this->waypoints_.size() == 0 ) 222 this->manageWaypoints(); 118 this->defaultBehaviour(maxrand); 223 119 } 224 120 } 225 226 121 } 227 122 … … 321 216 { //Vector-implementation: mode_.back() == ROCKET; 322 217 if(controllable) 323 { 324 if(controllable->getRocket())//Check wether the bot is controlling the rocket and if the timeout is over. 218 {//Check wether the bot is controlling the rocket and if the timeout is over. 219 if(controllable->getIdentifier() == ClassByString("Rocket")) 220 325 221 { 326 222 this->follow(); … … 342 238 } 343 239 240 void AIController::defaultBehaviour(float maxrand) 241 { float random; 242 // search enemy 243 random = rnd(maxrand); 244 if (random < (botlevel_* 100) && (!this->target_)) 245 this->searchNewTarget(); 246 247 // forget enemy 248 random = rnd(maxrand); 249 if (random < ((1-botlevel_)*20) && (this->target_)) 250 this->forgetTarget(); 251 252 // next enemy 253 random = rnd(maxrand); 254 if (random < (botlevel_*30) && (this->target_)) 255 this->searchNewTarget(); 256 257 // fly somewhere 258 random = rnd(maxrand); 259 if (random < 50 && (!this->bHasTargetPosition_ && !this->target_)) 260 this->searchRandomTargetPosition(); 261 262 // stop flying 263 random = rnd(maxrand); 264 if (random < 10 && (this->bHasTargetPosition_ && !this->target_)) 265 this->bHasTargetPosition_ = false; 266 267 // fly somewhere else 268 random = rnd(maxrand); 269 if (random < 30 && (this->bHasTargetPosition_ && !this->target_)) 270 this->searchRandomTargetPosition(); 271 272 if (this->state_ == MASTER) // master: shoot 273 { 274 random = rnd(maxrand); 275 if (!(this->passive_) && random < (100*botlevel_) && (this->target_ && !this->bShooting_)) 276 { 277 this->bShooting_ = true; 278 this->forceFreeSlaves(); 279 } 280 } 281 else 282 { 283 // shoot 284 random = rnd(maxrand); 285 if (!(this->passive_) && random < (botlevel_*100) && (this->target_ && !this->bShooting_)) 286 this->bShooting_ = true; 287 } 288 289 // stop shooting 290 random = rnd(maxrand); 291 if (random < ((1 - botlevel_)*50) && (this->bShooting_)) 292 this->bShooting_ = false; 293 294 // boost 295 random = rnd(maxrand); 296 if (random < botlevel_*50 ) 297 this->boostControl(); 298 299 // update Checkpoints 300 /*random = rnd(maxrand); 301 if (this->defaultWaypoint_ && random > (maxrand-10)) 302 this->manageWaypoints(); 303 else //if(random > maxrand-10) //CHECK USABILITY!!*/ 304 if (this->waypoints_.size() == 0 ) 305 this->manageWaypoints(); 306 } 307 344 308 } -
code/branches/presentation2011/src/orxonox/controllers/AIController.h
r8729 r8980 44 44 virtual ~AIController(); 45 45 46 virtual void tick(float dt); 46 virtual void tick(float dt); //<! Carrying out the targets set in action(). 47 47 48 48 protected: 49 virtual void action(); 49 virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour ~ setting targets. 50 void defaultBehaviour(float maxrand); //<! Helper function for code reusage. Some concrete commands for a bot. 50 51 51 52 private: 52 53 static const float ACTION_INTERVAL; 53 54 54 Timer actionTimer_; 55 Timer actionTimer_; //<! Regularly calls action(). 55 56 }; 56 57 } -
code/branches/presentation2011/src/orxonox/controllers/ArtificialController.cc
r8892 r8980 42 42 #include "gametypes/TeamDeathmatch.h" 43 43 #include "gametypes/Dynamicmatch.h" 44 #include "gametypes/Mission.h" 44 45 #include "controllers/WaypointPatrolController.h" 45 46 #include "controllers/NewHumanController.h" … … 92 93 this->target_.setCallback(createFunctor(&ArtificialController::targetDied, this)); 93 94 this->bSetupWorked = false; 94 this->botlevel_ = 0. 2f;95 this->botlevel_ = 0.5f; 95 96 this->mode_ = DEFAULT;////Vector-implementation: mode_.push_back(DEFAULT); 96 97 this->timeout_ = 0; … … 998 999 } 999 1000 1001 Mission* miss = orxonox_cast<Mission*>(gametype); 1002 if (miss) 1003 { 1004 if (entity1->getPlayer()) 1005 team1 = miss->getTeam(entity1->getPlayer()); 1006 1007 if (entity2->getPlayer()) 1008 team2 = miss->getTeam(entity2->getPlayer()); 1009 } 1010 1000 1011 TeamBaseMatchBase* base = 0; 1001 1012 base = orxonox_cast<TeamBaseMatchBase*>(entity1); … … 1110 1121 { 1111 1122 Pawn* pawn = orxonox_cast<Pawn*>(this->getControllableEntity()); 1112 if(pawn )1123 if(pawn && pawn->isA(Class(SpaceShip))) //fix for First Person Mode: check for SpaceShip 1113 1124 { 1114 1125 this->weaponModes_.clear(); // reset previous weapon information -
code/branches/presentation2011/src/orxonox/controllers/ArtificialController.h
r8891 r8980 51 51 void abandonTarget(Pawn* target); 52 52 53 inline void setTeam(int team) 53 inline void setTeam(int team) //TODO: write through to controllable entity. 54 54 { this->team_ = team; } 55 55 inline int getTeam() const -
code/branches/presentation2011/src/orxonox/controllers/HumanController.cc
r8858 r8980 195 195 this->boosting_ = true; 196 196 this->boostingTimeout_.startTimer(); 197 198 this->controllableEntity_->boost(this->boosting_);197 if(this->controllableEntity_) 198 this->controllableEntity_->boost(this->boosting_); 199 199 // orxout() << "Start boosting" << endl; 200 200 } … … 209 209 this->boosting_ = false; 210 210 this->boostingTimeout_.stopTimer(); 211 212 this->controllableEntity_->boost(this->boosting_);211 if(this->controllableEntity_) 212 this->controllableEntity_->boost(this->boosting_); 213 213 // orxout() << "Stop boosting" << endl; 214 214 } -
code/branches/presentation2011/src/orxonox/controllers/WaypointPatrolController.cc
r7184 r8980 42 42 RegisterObject(WaypointPatrolController); 43 43 44 //this->team_ = 0;45 44 this->alertnessradius_ = 500; 46 45 … … 53 52 54 53 XMLPortParam(WaypointPatrolController, "alertnessradius", setAlertnessRadius, getAlertnessRadius, xmlelement, mode).defaultValues(500.0f); 55 // XMLPortParam(WaypointPatrolController, "team", setTeam, getTeam, xmlelement, mode).defaultValues(0);56 54 } 57 55 -
code/branches/presentation2011/src/orxonox/controllers/WaypointPatrolController.h
r7163 r8980 46 46 virtual void tick(float dt); 47 47 48 /* inline void setTeam(int team)49 { this->team_ = team; }50 inline int getTeam() const51 { return this->team_; } */52 53 48 inline void setAlertnessRadius(float radius) 54 49 { this->alertnessradius_ = radius; } … … 59 54 void searchEnemy(); 60 55 61 //int team_;62 56 float alertnessradius_; 63 57 Timer patrolTimer_; -
code/branches/presentation2011/src/orxonox/gametypes/CMakeLists.txt
r8178 r8980 9 9 LastManStanding.cc 10 10 LastTeamStanding.cc 11 TeamGametype.cc 12 Mission.cc 11 13 ) -
code/branches/presentation2011/src/orxonox/gametypes/Gametype.cc
r8858 r8980 85 85 this->dedicatedKillBots_ = createConsoleCommand( "dedicatedKillBots", createExecutor( createFunctor(&Gametype::killBots, this) ) ); 86 86 /* HACK HACK HACK */ 87 //this->numberOfPlayers_ = 0; 87 88 } 88 89 … … 132 133 this->gtinfo_->playerReadyToSpawn(it->first); 133 134 } 134 135 135 136 this->checkStart(); 136 137 } … … 439 440 if(player->isHumanPlayer()) 440 441 this->gtinfo_->playerSpawned(player); 441 442 442 443 this->playerPostSpawn(player); 443 444 } -
code/branches/presentation2011/src/orxonox/gametypes/Gametype.h
r8706 r8980 123 123 { return this->gtinfo_->getHUDTemplate(); } 124 124 125 v oid addBots(unsigned int amount);125 virtual void addBots(unsigned int amount); 126 126 void killBots(unsigned int amount = 0); 127 128 inline unsigned int getNumberOfPlayers() const129 { return this->players_.size(); }130 127 131 128 virtual void addTime(float t); … … 151 148 152 149 //inline bool getForceSpawn() 153 // { return this->bForceSpawn_; } 150 // { return this->bForceSpawn_; } 154 151 155 152 virtual void resetTimer(); 156 153 virtual void resetTimer(float t); 154 inline unsigned int getNumberOfPlayers() 155 { return this->gtinfo_->getNumberOfPlayers(); } 157 156 158 157 protected: … … 192 191 ConsoleCommand* dedicatedKillBots_; 193 192 /* HACK HACK HACK */ 193 194 194 }; 195 195 } -
code/branches/presentation2011/src/orxonox/gametypes/TeamDeathmatch.h
r5781 r8980 56 56 57 57 int getTeam(PlayerInfo* player); 58 59 58 inline const ColourValue& getTeamColour(int teamnr) const 60 59 { return this->teamcolours_[teamnr]; } -
code/branches/presentation2011/src/orxonox/infos/GametypeInfo.h
r8706 r8980 119 119 inline const std::string& getHUDTemplate() const 120 120 { return this->hudtemplate_; } 121 122 inline unsigned int getNumberOfPlayers() const 123 { return this->spawnedPlayers_.size(); } 121 124 122 125 void sendAnnounceMessage(const std::string& message); -
code/branches/presentation2011/src/orxonox/worldentities/ControllableEntity.cc
r8891 r8980 74 74 this->bMouseLook_ = false; 75 75 this->mouseLookSpeed_ = 200; 76 this->bIsRocket_ = false;77 76 78 77 this->server_position_ = Vector3::ZERO; … … 88 87 this->setPriority( Priority::VeryHigh ); 89 88 this->registerVariables(); 89 this->team_ = -1; 90 90 } 91 91 … … 120 120 SUPER(ControllableEntity, XMLPort, xmlelement, mode); 121 121 122 XMLPortParam(ControllableEntity, "team", setTeam, getTeam, xmlelement, mode).defaultValues(-1); 122 123 XMLPortParam(ControllableEntity, "hudtemplate", setHudTemplate, getHudTemplate, xmlelement, mode); 123 124 XMLPortParam(ControllableEntity, "camerapositiontemplate", setCameraPositionTemplate, getCameraPositionTemplate, xmlelement, mode); -
code/branches/presentation2011/src/orxonox/worldentities/ControllableEntity.h
r8891 r8980 163 163 { return this->target_.get(); } 164 164 void setTargetInternal( uint32_t targetID ); 165 inline bool getRocket() const 166 { return this-> bIsRocket_; } 165 166 inline void setTeam(int team) 167 { this->team_ = team; } 168 inline float getTeam() const 169 { return this->team_; } 167 170 168 171 protected: … … 183 186 184 187 Ogre::SceneNode* cameraPositionRootNode_; 185 bool bIsRocket_; //Workaround to see, if the controllable entity is a Rocket.186 188 187 189 private: … … 240 242 CameraPosition* reverseCamera_; 241 243 WeakPtr<WorldEntity> target_; 244 245 int team_ ; //<! teamnumber 242 246 }; 243 247 } -
code/branches/presentation2011/src/orxonox/worldentities/pawns/Pawn.cc
r8891 r8980 129 129 XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0); 130 130 XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f); 131 132 131 133 } 132 134 … … 455 457 SUPER(Pawn, changedActivity); 456 458 457 this->setRadarVisibility(this->is Active());459 this->setRadarVisibility(this->isVisible()); 458 460 } 459 461 -
code/branches/presentation2011/src/orxonox/worldentities/pawns/Pawn.h
r8891 r8980 53 53 inline bool isAlive() const 54 54 { return this->bAlive_; } 55 55 56 56 57 virtual void setHealth(float health); … … 194 195 { return NULL; } 195 196 197 196 198 float health_; 197 199 float maxHealth_;
Note: See TracChangeset
for help on using the changeset viewer.