Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 7, 2016, 4:00:25 PM (7 years ago)
Author:
bberabi
Message:

bots are finally added; controller has to be implemented

Location:
code/branches/SpaceRace_HS16
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/SpaceRace_HS16/data/levels/newnewnewspacerace.oxw

    r11260 r11272  
    220220
    221221   <!-- ------------------CheckPoints----------------- -->
    222    <OldRaceCheckPoint name="checkpoint1" direction="0,2,0" position="800,20,0" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="0" islast="false">
     222      <OldRaceCheckPoint name="checkpoint1" direction="0,2,0" position="800,20,0" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="0" islast="false">
    223223        <attached>
    224224            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     
    303303        </collisionShapes>
    304304    </OldRaceCheckPoint>
     305
     306
     307
     308   <!-- <SpaceRaceManager>
     309 <checkpoints>
     310    <RaceCheckPoint name="checkpoint1" position="0,8050,-1000" direction="0,1,0" collisionType="static" scale="4" distance="150" checkpointindex="0" islast="false" nextcheckpoints="1,-1,-1">
     311        <attached>
     312            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     313
     314
     315        <Model position="0,0,55" mesh="testcube.mesh" scale3D="110,20,20" />
     316        <Model position="0,0,-55" mesh="testcube.mesh" scale3D="110,20,20" />
     317        <Model position="55,0,0" mesh="testcube.mesh" scale3D="20,20,110" />
     318        <Model position="-55,0,0" mesh="testcube.mesh" scale3D="20,20,110" />
     319
     320
     321
     322
     323        </attached>
     324
     325
     326
     327    <collisionShapes>
     328
     329
     330            <BoxCollisionShape position="0,0,220"     halfExtents="220, 40, 40" />
     331            <BoxCollisionShape position="0,0,-220"      halfExtents="220, 40, 40" />
     332            <BoxCollisionShape position="220,0,0"      halfExtents="40, 40, 220" />
     333            <BoxCollisionShape position="-220,0,0"       halfExtents="40, 40, 220" />
     334
     335
     336        </collisionShapes>
     337
     338
     339
     340
     341    </RaceCheckPoint>
     342
     343<RaceCheckPoint name="checkpoint2" position="1000,8050,-4000" direction="0,1,0" roll="45" collisionType="static" scale="4" distance="150" checkpointindex="1" islast="false" nextcheckpoints="2,-1,-1">
     344        <attached>
     345            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     346        </attached>
     347
     348
     349           <collisionShapes>
     350
     351            <BoxCollisionShape position="0,0,220"     halfExtents="220, 40, 40" />
     352            <BoxCollisionShape position="0,0,-220"      halfExtents="220, 40, 40" />
     353            <BoxCollisionShape position="220,0,0"      halfExtents="40, 40, 220" />
     354            <BoxCollisionShape position="-220,0,0"       halfExtents="40, 40, 220" />
     355
     356        </collisionShapes>
     357    </RaceCheckPoint>
     358
     359
     360</checkpoints>
     361</SpaceRaceManager> -->
     362
     363
    305364
    306365  </Scene>
    307366</Level>
     367 
  • code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.cc

    r11260 r11272  
    3636#include "items/Engine.h"
    3737#include "controllers/HumanController.h"
    38 #include "SpaceRaceBot.h"
    3938
    4039#include "core/CoreIncludes.h"
     
    4342#include "worldentities/pawns/Pawn.h"
    4443#include "core/config/ConfigValueIncludes.h"
     44#include "infos/Bot.h"
     45#include "SpaceRaceBot.h"
    4546
    4647
     
    5657       
    5758        //this->botclass_ = Class();
     59        this->botclass_ = Class(SpaceRaceBot);//ClassByString("")
    5860
    5961        this->checkpointsReached_ = 0;
     
    168170    }
    169171
     172        /*void playerEntered(PlayerInfo* player) {
     173
     174
     175                  Gametype::playerEntered(player);
     176
     177        const std::string& message = player->getName() + " entered the game";
     178        ChatManager::message(message);
     179           
     180        }*/
     181
     182
     183
     184
     185 void OldSpaceRace::addBots(unsigned int amount)
     186    {
     187        for (unsigned int i = 0; i < amount; ++i)
     188            this->botclass_.fabricate(this->getContext());
     189    }
     190
     191
     192
     193
    170194
    171195}
  • code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.h

    r11256 r11272  
    3838
    3939#include "gametypes/Gametype.h"
     40#include "SpaceRaceManager.h"
    4041
    4142#include "OldRaceCheckPoint.h"
     
    6364            virtual void playerEntered(PlayerInfo* player) override;
    6465            virtual void newCheckpointReached();
    65             virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command.
     66            virtual void addBots(unsigned int amount) override; //<! overwrite function in order to bypass the addbots command.
    6667                                          //<! This is only a temporary solution. Better: create racingBots.
    6768
  • code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc

    r11256 r11272  
    2323 *      Author: purgham
    2424 */
     25#include <vector>
    2526
    2627#include "SpaceRaceBot.h"
     28#include "core/GameMode.h"
    2729#include "core/CoreIncludes.h"
     30#include "core/config/ConfigValueIncludes.h"
     31#include "gametypes/Gametype.h"
     32#include "controllers/AIController.h"
     33#include "gametypes/SpaceRaceController.h"
     34
     35
    2836
    2937namespace orxonox
     
    3341    SpaceRaceBot::SpaceRaceBot(Context* context) : Bot(context){
    3442        RegisterObject(SpaceRaceBot);
    35         this->defaultController_ = Class(SpaceRaceController);// ClassByString("")
    36         this->createController();
    37     }
     43        this->defaultController_ = Class(AIController);// ClassByString("")
     44       
    3845
    3946
     
    4148
    4249
     50        this->createController();
     51
     52    }
     53
     54SpaceRaceBot::~SpaceRaceBot(){
     55
     56}
     57
     58void SpaceRaceBot::setConfigValues()
     59    {
     60        static const std::string names[] =
     61        {
     62            "Dr. Julius No",
     63            "Berkay Berabi",
     64            "Louis Meile"
     65           
     66            "Dominic Greene"
     67        };
     68        static std::vector<std::string> defaultnames(names, names + sizeof(names) / sizeof(std::string));
     69
     70        SetConfigValue(names_, defaultnames);
     71    }
     72
    4373
    4474
  • code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.h

    r11239 r11272  
    3030#include "gametypes/GametypesPrereqs.h"
    3131#include "gametypes/SpaceRaceController.h"
     32#include <vector>
    3233
    3334
     
    3536{
    3637
    37     /**
    38 /sdaasdasdasdasdas     
    39     */
    4038    class _GametypesExport SpaceRaceBot: public Bot
    4139    {
    4240        public:
    43         SpaceRaceBot(Context* context);
    44             virtual ~SpaceRaceBot() {}
     41                SpaceRaceBot(Context* context);
     42            virtual ~SpaceRaceBot();
     43   
     44            void setConfigValues();
     45
     46
     47
     48 virtual inline bool isInitialized() const override
     49                { return true; }
     50            virtual inline float getPing() const override
     51                { return 0; }
     52            virtual inline float getPacketLossRatio() const override
     53                { return 0; }
     54
     55
     56  private:
     57            std::vector<std::string> names_;
     58
     59
    4560    };
    4661}
  • code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceManager.cc

    r11071 r11272  
    4747        RegisterObject(SpaceRaceManager);
    4848        this->race_ = orxonox_cast<SpaceRace*>(this->getGametype());
    49         assert(race_);
     49        //assert(race_);
    5050        //amountOfPlayers=(race_->getPlayers()).size();
    5151        this->firstcheckpointvisible_ = false;
  • code/branches/SpaceRace_HS16/src/orxonox/gametypes/Gametype.cc

    r11071 r11272  
    9696        }
    9797    }
    98 
     98   
    9999    /**
    100100     * @brief Initializes sub-objects of the Gametype. This must be called after the constructor.
Note: See TracChangeset for help on using the changeset viewer.