Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11281


Ignore:
Timestamp:
Nov 14, 2016, 1:37:01 PM (8 years ago)
Author:
bberabi
Message:

bots addiert checkpoint problem gelost

Location:
code/branches/SpaceRace_HS16
Files:
6 edited

Legend:

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

    r11279 r11281  
     1
     2  <!-- Authors:
     3Louis ...? :D
     4Berkay Berabi
     5@2016
     6-->
     7
    18<LevelInfo
    29 name = "New Old Space Race 2"
     
    512 screenshot = "spacerace.png"
    613/>
    7 
     14   
    815<?lua
    916  include("stats.oxo")
     
    1724<Level
    1825 plugins = "gametypes"
    19  gametype = "OldSpaceRace"
     26 gametype = "SpaceRace"
    2027>
    2128  <templates>
     
    181188    <?lua end ?>
    182189
    183    <!-- ------------------CheckPoints----------------- -->
     190   <!-- ------------------CheckPoints-----------------
    184191   <OldRaceCheckPoint name="checkpoint1" yaw=90 pitch=90 position="1000,30,0" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="0" islast="false">
    185192        <attached>
     
    360367            <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
    361368        </collisionShapes>
    362     </OldRaceCheckPoint>
     369    </OldRaceCheckPoint> -->
     370
     371
     372
     373<!-- ---------------------Trying to solve checkpoint problem---------------------- -->
     374
     375<SpaceRaceManager>
     376 <checkpoints>
     377   
     378
     379    <RaceCheckPoint name="checkpoint1" position="1000,30,0" yaw=90 pitch=90 direction="0,1,0" roll="0" collisionType="static" scale="1" distance="40" checkpointindex="0" islast="false" nextcheckpoints="2,-1,-1">
     380        <attached>
     381            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     382        </attached>
     383
     384
     385           <collisionShapes>
     386
     387            <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
     388            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
     389            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
     390            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
     391
     392        </collisionShapes>
     393    </RaceCheckPoint>
     394
     395
     396
     397<RaceCheckPoint name="checkpoint2" yaw=90 pitch=90 position="3000,200,100" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="40" checkpointindex="1" islast="false" nextcheckpoints="3,-1,-1">
     398        <attached>
     399            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     400        </attached>
     401       <collisionShapes>
     402
     403
     404           <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
     405            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
     406            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
     407            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
     408
     409
     410        </collisionShapes>
     411
     412    </RaceCheckPoint>
     413
     414
     415<RaceCheckPoint name="checkpoint3" yaw=90 pitch=90 position="5000,100,300" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="40" checkpointindex="2" islast="false" nextcheckpoints="4,-1,-1">
     416        <attached>
     417            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     418        </attached>
     419        <collisionShapes>
     420
     421
     422        <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
     423            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
     424            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
     425            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
     426
     427
     428        </collisionShapes>
     429
     430    </RaceCheckPoint>
     431
     432
     433<RaceCheckPoint name="checkpoint4"  yaw=90 pitch=90 position="8000,-150,150" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="40" checkpointindex="3" islast="false" nextcheckpoints="5,-1,-1">
     434        <attached>
     435            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     436        </attached>
     437        <collisionShapes>
     438
     439
     440             <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
     441            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
     442            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
     443            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
     444
     445
     446        </collisionShapes>
     447
     448    </RaceCheckPoint>
     449
     450
     451<RaceCheckPoint name="checkpoint5"  yaw=90 pitch=90 position="10000,-200,200" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="40" checkpointindex="4" islast="false" nextcheckpoints="6,-1,-1">
     452        <attached>
     453            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     454        </attached>
     455       <collisionShapes>
     456
     457
     458     <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
     459            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
     460            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
     461            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
     462
     463
     464        </collisionShapes>
     465    </RaceCheckPoint>
     466
     467
     468
     469<RaceCheckPoint name="checkpoint6" yaw=90 pitch=90 position="13000,100,100" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="40" checkpointindex="5" islast="false" nextcheckpoints="7,-1,-1">
     470        <attached>
     471            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     472        </attached>
     473      <collisionShapes>
     474
     475
     476            <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
     477            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
     478            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
     479            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
     480
     481
     482        </collisionShapes>
     483
     484    </RaceCheckPoint>
     485
     486
     487
     488<RaceCheckPoint name="checkpoint7" yaw=90 pitch=90 position="15000,0,0" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="40" checkpointindex="6" islast="false" nextcheckpoints="8,-1,-1">
     489        <attached>
     490            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     491        </attached>
     492       <collisionShapes>
     493
     494               <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
     495            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
     496            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
     497            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
     498
     499        </collisionShapes>
     500    </RaceCheckPoint>
     501
     502
     503<RaceCheckPoint name="checkpoint8" yaw=90 pitch=90 position="18000,150,-150" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="40" checkpointindex="7" islast="false" nextcheckpoints="9,-1,-1">
     504        <attached>
     505            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     506        </attached>
     507         <collisionShapes>
     508
     509    <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
     510            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
     511            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
     512            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
     513
     514
     515        </collisionShapes>
     516
     517    </RaceCheckPoint>
     518
     519
     520<RaceCheckPoint name="checkpoint9" yaw=90 pitch=90 position="21000,120,-120" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="40" checkpointindex="8" islast="false" nextcheckpoints="10,-1,-1">
     521        <attached>
     522            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     523        </attached>
     524       <collisionShapes>
     525
     526
     527         <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
     528            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
     529            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
     530            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
     531
     532
     533        </collisionShapes>
     534
     535    </RaceCheckPoint>
     536
     537<RaceCheckPoint name="checkpoint10" yaw=90 pitch=90 position="24000,-150,-80" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="40" checkpointindex="9" islast="false" nextcheckpoints="11,-1,-1">
     538        <attached>
     539            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     540        </attached>
     541       <collisionShapes>
     542
     543
     544           <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
     545            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
     546            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
     547            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
     548
     549
     550        </collisionShapes>
     551
     552    </RaceCheckPoint>
     553
     554<RaceCheckPoint name="checkpoint11" yaw=90 pitch=90 position="27000,-200,0" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="40" checkpointindex="10" islast="false" nextcheckpoints="12,-1,-1">
     555        <attached>
     556            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     557        </attached>
     558      <collisionShapes>
     559
     560    <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
     561            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
     562            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
     563            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
     564
     565        </collisionShapes>
     566
     567    </RaceCheckPoint>
     568
     569
     570
     571<RaceCheckPoint name="checkpoint12" yaw=90 pitch=90 position="30000,-50,50" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="40" checkpointindex="11" islast="false" nextcheckpoints="13,-1,-1">
     572        <attached>
     573            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     574        </attached>
     575       <collisionShapes>
     576    <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
     577            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
     578            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
     579            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
     580
     581        </collisionShapes>
     582    </RaceCheckPoint>
     583
     584
     585<RaceCheckPoint name="checkpoint13" yaw=90 pitch=90 position="33000,80,60" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="40" checkpointindex="12" islast="true" >
     586        <attached>
     587            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     588        </attached>
     589       <collisionShapes>
     590
     591           <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
     592            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
     593            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
     594            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
     595
     596        </collisionShapes>
     597    </RaceCheckPoint>
     598
     599
     600
     601<RaceCheckPoint name="checkpoint14" yaw=90 pitch=90 position="35000,120,20" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="40" checkpointindex="13" islast="true" >
     602        <attached>
     603            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     604        </attached>
     605       <collisionShapes>
     606
     607           <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
     608            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
     609            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
     610            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
     611
     612        </collisionShapes>
     613    </RaceCheckPoint>
     614
     615<RaceCheckPoint name="checkpoint15" yaw=90 pitch=90 position="38000,80,0" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="40" checkpointindex="14" islast="true" >
     616        <attached>
     617            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
     618        </attached>
     619       <collisionShapes>
     620
     621           <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
     622            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
     623            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
     624            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
     625
     626        </collisionShapes>
     627    </RaceCheckPoint>
     628
     629
     630</checkpoints>
     631</SpaceRaceManager>
     632
     633
    363634
    364635<!-- ---------------------PickUps---------------------- -->
  • code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc

    r11246 r11281  
    2929#include "SpaceRace.h"
    3030
     31#include "core/CoreIncludes.h"
     32#include "chat/ChatManager.h"
     33#include "util/Convert.h"
     34#include "util/Math.h"
     35#include "infos/Bot.h"
     36#include "items/Engine.h"
     37#include "controllers/HumanController.h"
     38
     39#include "core/CoreIncludes.h"
     40#include "chat/ChatManager.h"
     41#include "infos/PlayerInfo.h"
     42#include "worldentities/pawns/Pawn.h"
     43#include "core/config/ConfigValueIncludes.h"
     44#include "infos/Bot.h"
     45#include "SpaceRaceBot.h"
    3146#include "items/Engine.h"
    3247
     
    4964        this->cantMove_ = false;
    5065        this->bTimeIsUp_ = false;
    51         this->numberOfBots_ = 1; // quick fix: don't allow default-bots to enter the race
     66        this->setConfigValues();
     67
     68       // this->numberOfBots_ = 1; // quick fix: don't allow default-bots to enter the race
    5269                                 // remove this line, if a raceBot has been created.
    5370    }
    5471
    55 
    56 
     72  void SpaceRace::setConfigValues()
     73    {
     74       
     75   
     76    }
     77
     78    void SpaceRace::start()
     79    {
     80        Gametype::start();
     81
     82   if (true)
     83        {
     84            this->spawnPlayersIfRequested();
     85            this->cantMove_ = true;
     86
     87            for (Engine* engine : ObjectList<Engine>()){
     88                engine->setActive(false);
     89               
     90
     91            }
     92           
     93        }
     94
     95
     96
     97        std::string message("BE FAST BE FIRST");
     98        this->getGametypeInfo()->sendAnnounceMessage(message);
     99        ChatManager::message(message);
     100
     101Timer* countdownTimer = new Timer();
     102        countdownTimer->setTimer(11, false, createExecutor(createFunctor(&SpaceRace::countdownFinished, this)));
     103    }
    57104
    58105
     
    84131    }
    85132
    86    
    87 
    88 
    89 
    90 
    91     void SpaceRace::tick(float dt)
     133
     134void SpaceRace::tick(float dt)
    92135    {
    93136        SUPER(SpaceRace,tick,dt);
     137
     138
    94139
    95140        // spawns the players when the countdown starts, but deactivates their engines
     
    103148        }
    104149
     150
     151gtInfo_->setStartCountdown(10.0);
     152   
     153       
     154            /*this->spawnPlayersIfRequested();
     155            this->cantMove_ = true;
     156
     157            for (Engine* engine : ObjectList<Engine>()){
     158                engine->setActive(false);
     159                }
     160
     161           
     162           
     163         std::string message("BE FAST BE FIRST");
     164        this->getGametypeInfo()->sendAnnounceMessage(message);
     165        ChatManager::message(message);
     166
     167Timer* countdownTimer = new Timer();
     168        countdownTimer->setTimer(11, false, createExecutor(createFunctor(&SpaceRace::countdownFinished, this)));*/
     169
     170
     171
     172
     173
     174
     175
    105176        // activate the engines when the countdown ends
    106177        if (!this->isStartCountdownRunning() && this->cantMove_)
     
    113184
    114185
    115             std::string message = "Hello!";
     186            std::string message = "RACE STARTED!";
    116187            this->getGametypeInfo()->sendAnnounceMessage(message);
    117188            ChatManager::message(message);
    118189        }
    119     }
    120 
    121 
    122 
    123 
    124 
     190   
     191}
    125192
    126193    void SpaceRace::newCheckpointReached(RaceCheckPoint* checkpoint, PlayerInfo* player)
     
    138205    }
    139206
     207 void SpaceRace::countdownFinished()
     208    {
     209
     210        std::string message("RACE STARTED ");
     211        this->getGametypeInfo()->sendAnnounceMessage(message);
     212        ChatManager::message(message);
     213
     214
     215    for (Engine* engine : ObjectList<Engine>())
     216                engine->setActive(true);
     217   
     218}
     219
     220 void SpaceRace::playerEntered(PlayerInfo* player)
     221    {
     222        Gametype::playerEntered(player);
     223
     224        const std::string& message = player->getName() + " entered the game";
     225        ChatManager::message(message);
     226    }
     227
     228
     229 void SpaceRace::addBots(unsigned int amount)
     230    {
     231        for (unsigned int i = 0; i < amount; ++i)
     232            this->botclass_.fabricate(this->getContext());
     233    }
     234
     235
     236
     237
     238
     239
     240
    140241    bool SpaceRace::allowPawnHit(Pawn* victim, Pawn* originator)
    141242    {
  • code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.h

    r11246 r11281  
    5757            virtual ~SpaceRace() {}
    5858
     59             void setConfigValues();
    5960
    6061            virtual void tick(float dt) override;
     62            virtual void start() override;
     63            virtual void end() override;
     64 virtual void countdownFinished();
     65             virtual void addBots(unsigned int amount) override; //<! overwrite function in order to bypass the addbots command.
    6166
    62             virtual void end() override;
     67
     68
     69             virtual void playerEntered(PlayerInfo* player) override;
     70
     71            //virtual void newCheckpointReached();
    6372
    6473            void newCheckpointReached(RaceCheckPoint* checkpoint, PlayerInfo* player);
     74           
     75
     76
    6577            inline RaceCheckPoint* getCheckpointReached(PlayerInfo* player)
    6678                { return this->checkpointReached_[player]; }
  • code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc

    r11272 r11281  
    4141    SpaceRaceBot::SpaceRaceBot(Context* context) : Bot(context){
    4242        RegisterObject(SpaceRaceBot);
    43         this->defaultController_ = Class(AIController);// ClassByString("")
    44        
    45 
    46 
    47 
    48 
    49 
     43        this->defaultController_ = Class(SpaceRaceController);// ClassByString("")
    5044        this->createController();
    5145
  • code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceManager.cc

    r11279 r11281  
    4848        this->race_ = orxonox_cast<SpaceRace*>(this->getGametype());
    4949        assert(race_);
    50         amountOfPlayers=(race_->getPlayers()).size();
     50        //amountOfPlayers=(race_->getPlayers()).size();
    5151        this->firstcheckpointvisible_ = false;
    5252    }
  • code/branches/SpaceRace_HS16/src/orxonox/infos/GametypeInfo.h

    r9667 r11281  
    8383            inline bool isStartCountdownRunning() const
    8484                { return this->bStartCountdownRunning_; }
     85           
    8586            void changedStartCountdownRunning(void); // Is called when the start countdown has been either started or stopped.
    8687
Note: See TracChangeset for help on using the changeset viewer.