[Orxonox-commit 6643] r11281 - in code/branches/SpaceRace_HS16: data/levels src/modules/gametypes src/orxonox/infos

bberabi at orxonox.net bberabi at orxonox.net
Mon Nov 14 13:37:01 CET 2016


Author: bberabi
Date: 2016-11-14 13:37:01 +0100 (Mon, 14 Nov 2016)
New Revision: 11281

Modified:
   code/branches/SpaceRace_HS16/data/levels/newnewnewspacerace.oxw
   code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc
   code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.h
   code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc
   code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceManager.cc
   code/branches/SpaceRace_HS16/src/orxonox/infos/GametypeInfo.h
Log:
bots addiert checkpoint problem gelost

Modified: code/branches/SpaceRace_HS16/data/levels/newnewnewspacerace.oxw
===================================================================
--- code/branches/SpaceRace_HS16/data/levels/newnewnewspacerace.oxw	2016-11-14 12:10:57 UTC (rev 11280)
+++ code/branches/SpaceRace_HS16/data/levels/newnewnewspacerace.oxw	2016-11-14 12:37:01 UTC (rev 11281)
@@ -1,3 +1,10 @@
+
+  <!-- Authors:
+Louis ...? :D
+Berkay Berabi
+ at 2016
+-->
+
 <LevelInfo
  name = "New Old Space Race 2"
  description = "Under maintenance..."
@@ -4,7 +11,7 @@
  tags = "gametype"
  screenshot = "spacerace.png"
 />
-
+   
 <?lua
   include("stats.oxo")
   include("HUDTemplates3.oxo")
@@ -16,7 +23,7 @@
 
 <Level
  plugins = "gametypes"
- gametype = "OldSpaceRace"
+ gametype = "SpaceRace"
 >
   <templates>
     <Template link=lodtemplate_default />
@@ -180,7 +187,7 @@
     ?>
     <?lua end ?>
 
-   <!-- ------------------CheckPoints----------------- -->
+   <!-- ------------------CheckPoints----------------- 
    <OldRaceCheckPoint name="checkpoint1" yaw=90 pitch=90 position="1000,30,0" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="0" islast="false">
         <attached>
             <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
@@ -359,8 +366,272 @@
             <BoxCollisionShape position="55,0,0"      halfExtents="10, 10, 55" />
             <BoxCollisionShape position="-55,0,0"     halfExtents="10, 10, 55" />
         </collisionShapes>
-    </OldRaceCheckPoint> 
+    </OldRaceCheckPoint> -->
 
+
+
+<!-- ---------------------Trying to solve checkpoint problem---------------------- -->
+
+<SpaceRaceManager>
+ <checkpoints>
+    
+
+    <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">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+
+
+           <collisionShapes>
+
+            <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
+            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
+            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
+
+        </collisionShapes>
+    </RaceCheckPoint>
+
+
+
+<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">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+       <collisionShapes>
+
+
+           <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
+            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
+            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
+
+
+        </collisionShapes>
+
+    </RaceCheckPoint>
+
+
+<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">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+        <collisionShapes>
+
+
+        <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
+            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
+            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
+
+
+        </collisionShapes>
+
+    </RaceCheckPoint>
+
+
+<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">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+        <collisionShapes>
+
+
+             <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
+            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
+            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
+
+
+        </collisionShapes>
+
+    </RaceCheckPoint>
+
+
+<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">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+       <collisionShapes>
+
+
+     <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
+            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
+            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
+
+
+        </collisionShapes>
+    </RaceCheckPoint>
+
+
+
+<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">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+      <collisionShapes>
+
+
+            <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
+            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
+            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
+
+
+        </collisionShapes>
+
+    </RaceCheckPoint>
+
+
+
+<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">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+       <collisionShapes>
+
+               <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
+            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
+            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
+
+        </collisionShapes>
+    </RaceCheckPoint>
+
+
+<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">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+         <collisionShapes>
+
+    <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
+            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
+            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
+
+
+        </collisionShapes>
+
+    </RaceCheckPoint>
+
+
+<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">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+       <collisionShapes>
+
+
+         <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
+            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
+            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
+
+
+        </collisionShapes>
+
+    </RaceCheckPoint>
+
+<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">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+       <collisionShapes>
+
+
+           <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
+            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
+            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
+
+
+        </collisionShapes>
+
+    </RaceCheckPoint>
+
+<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">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+      <collisionShapes>
+
+    <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
+            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
+            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
+
+        </collisionShapes>
+
+    </RaceCheckPoint>
+
+
+
+<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">
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+       <collisionShapes>
+    <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
+            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
+            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
+
+        </collisionShapes>
+    </RaceCheckPoint>
+
+
+<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" >
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+       <collisionShapes>
+
+           <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
+            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
+            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
+
+        </collisionShapes>
+    </RaceCheckPoint>
+
+
+
+<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" >
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+       <collisionShapes>
+
+           <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
+            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
+            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
+
+        </collisionShapes>
+    </RaceCheckPoint>
+
+<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" >
+        <attached>
+            <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+        </attached>
+       <collisionShapes>
+
+           <BoxCollisionShape position="0,0,55"     halfExtents="55,10,10" />
+            <BoxCollisionShape position="0,0,-55"      halfExtents="55,10,10" />
+            <BoxCollisionShape position="55,0,0"      halfExtents="10,10,55" />
+            <BoxCollisionShape position="-55,0,0"       halfExtents="10,10,55" />
+
+        </collisionShapes>
+    </RaceCheckPoint>
+
+
+</checkpoints>
+</SpaceRaceManager>
+
+
+
 <!-- ---------------------PickUps---------------------- -->
 
     <!--at checkpoint3-->

Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc	2016-11-14 12:10:57 UTC (rev 11280)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc	2016-11-14 12:37:01 UTC (rev 11281)
@@ -28,10 +28,25 @@
 
 #include "SpaceRace.h"
 
+#include "core/CoreIncludes.h"
+#include "chat/ChatManager.h"
+#include "util/Convert.h"
+#include "util/Math.h"
+#include "infos/Bot.h"
 #include "items/Engine.h"
+#include "controllers/HumanController.h"
 
 #include "core/CoreIncludes.h"
 #include "chat/ChatManager.h"
+#include "infos/PlayerInfo.h"
+#include "worldentities/pawns/Pawn.h"
+#include "core/config/ConfigValueIncludes.h"
+#include "infos/Bot.h"
+#include "SpaceRaceBot.h"
+#include "items/Engine.h"
+
+#include "core/CoreIncludes.h"
+#include "chat/ChatManager.h"
 #include "util/Convert.h"
 #include "util/Math.h"
 #include "SpaceRaceBot.h"
@@ -48,16 +63,48 @@
         this->botclass_ = Class(SpaceRaceBot);//ClassByString("")
         this->cantMove_ = false;
         this->bTimeIsUp_ = false;
-        this->numberOfBots_ = 1; // quick fix: don't allow default-bots to enter the race
+        this->setConfigValues();
+
+       // this->numberOfBots_ = 1; // quick fix: don't allow default-bots to enter the race
                                  // remove this line, if a raceBot has been created.
     }
 
+  void SpaceRace::setConfigValues()
+    {
+       
+    
+    }
 
+    void SpaceRace::start()
+    {
+        Gametype::start();
 
+   if (true)
+        {
+            this->spawnPlayersIfRequested();
+            this->cantMove_ = true;
 
+            for (Engine* engine : ObjectList<Engine>()){
+                engine->setActive(false);
+                
 
+            }
+            
+        }
 
 
+
+        std::string message("BE FAST BE FIRST");
+        this->getGametypeInfo()->sendAnnounceMessage(message);
+        ChatManager::message(message);
+
+Timer* countdownTimer = new Timer();
+        countdownTimer->setTimer(11, false, createExecutor(createFunctor(&SpaceRace::countdownFinished, this)));
+    }
+
+
+
+
     void SpaceRace::end()
     {
         this->clock_.capture();
@@ -83,15 +130,13 @@
         this->Gametype::end();
     }
 
-    
 
+void SpaceRace::tick(float dt)
+    {
+        SUPER(SpaceRace,tick,dt);
 
 
 
-    void SpaceRace::tick(float dt)
-    {
-        SUPER(SpaceRace,tick,dt);
-
         // spawns the players when the countdown starts, but deactivates their engines
         if (this->isStartCountdownRunning() && !this->cantMove_)
         {
@@ -102,6 +147,32 @@
                 engine->setActive(false);
         }
 
+
+gtInfo_->setStartCountdown(10.0);
+   
+        
+            /*this->spawnPlayersIfRequested();
+            this->cantMove_ = true;
+
+            for (Engine* engine : ObjectList<Engine>()){
+                engine->setActive(false);
+                }
+
+            
+            
+         std::string message("BE FAST BE FIRST");
+        this->getGametypeInfo()->sendAnnounceMessage(message);
+        ChatManager::message(message);
+
+Timer* countdownTimer = new Timer();
+        countdownTimer->setTimer(11, false, createExecutor(createFunctor(&SpaceRace::countdownFinished, this)));*/
+
+
+
+
+
+
+
         // activate the engines when the countdown ends
         if (!this->isStartCountdownRunning() && this->cantMove_)
         {
@@ -112,17 +183,13 @@
 
 
 
-            std::string message = "Hello!";
+            std::string message = "RACE STARTED!";
             this->getGametypeInfo()->sendAnnounceMessage(message);
             ChatManager::message(message);
         }
-    }
+    
+}
 
-
-
-
-
-
     void SpaceRace::newCheckpointReached(RaceCheckPoint* checkpoint, PlayerInfo* player)
     {
         this->checkpointReached_[player] = checkpoint;
@@ -137,6 +204,40 @@
         ChatManager::message(message);
     }
 
+ void SpaceRace::countdownFinished()
+    {
+
+        std::string message("RACE STARTED ");
+        this->getGametypeInfo()->sendAnnounceMessage(message);
+        ChatManager::message(message);
+
+
+    for (Engine* engine : ObjectList<Engine>())
+                engine->setActive(true);
+    
+}
+
+ void SpaceRace::playerEntered(PlayerInfo* player)
+    {
+        Gametype::playerEntered(player);
+
+        const std::string& message = player->getName() + " entered the game";
+        ChatManager::message(message);
+    }
+
+
+ void SpaceRace::addBots(unsigned int amount)
+    {
+        for (unsigned int i = 0; i < amount; ++i)
+            this->botclass_.fabricate(this->getContext());
+    }
+
+
+
+
+
+
+
     bool SpaceRace::allowPawnHit(Pawn* victim, Pawn* originator)
     {
         return true;

Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.h
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.h	2016-11-14 12:10:57 UTC (rev 11280)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.h	2016-11-14 12:37:01 UTC (rev 11281)
@@ -56,12 +56,24 @@
             SpaceRace(Context* context);
             virtual ~SpaceRace() {}
 
+             void setConfigValues();
 
             virtual void tick(float dt) override;
-
+            virtual void start() override;
             virtual void end() override;
+ virtual void countdownFinished();
+             virtual void addBots(unsigned int amount) override; //<! overwrite function in order to bypass the addbots command.
 
+
+
+             virtual void playerEntered(PlayerInfo* player) override;
+
+            //virtual void newCheckpointReached();
+
             void newCheckpointReached(RaceCheckPoint* checkpoint, PlayerInfo* player);
+            
+
+
             inline RaceCheckPoint* getCheckpointReached(PlayerInfo* player)
                 { return this->checkpointReached_[player]; }
 

Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc	2016-11-14 12:10:57 UTC (rev 11280)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc	2016-11-14 12:37:01 UTC (rev 11281)
@@ -40,13 +40,7 @@
 
     SpaceRaceBot::SpaceRaceBot(Context* context) : Bot(context){
         RegisterObject(SpaceRaceBot);
-        this->defaultController_ = Class(AIController);// ClassByString("")
-        
-
-
-
-
-
+        this->defaultController_ = Class(SpaceRaceController);// ClassByString("")
         this->createController();
 
     }

Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceManager.cc
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceManager.cc	2016-11-14 12:10:57 UTC (rev 11280)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceManager.cc	2016-11-14 12:37:01 UTC (rev 11281)
@@ -47,7 +47,7 @@
         RegisterObject(SpaceRaceManager);
         this->race_ = orxonox_cast<SpaceRace*>(this->getGametype());
         assert(race_);
-        amountOfPlayers=(race_->getPlayers()).size();
+        //amountOfPlayers=(race_->getPlayers()).size();
         this->firstcheckpointvisible_ = false;
     }
 

Modified: code/branches/SpaceRace_HS16/src/orxonox/infos/GametypeInfo.h
===================================================================
--- code/branches/SpaceRace_HS16/src/orxonox/infos/GametypeInfo.h	2016-11-14 12:10:57 UTC (rev 11280)
+++ code/branches/SpaceRace_HS16/src/orxonox/infos/GametypeInfo.h	2016-11-14 12:37:01 UTC (rev 11281)
@@ -82,6 +82,7 @@
             */
             inline bool isStartCountdownRunning() const
                 { return this->bStartCountdownRunning_; }
+            
             void changedStartCountdownRunning(void); // Is called when the start countdown has been either started or stopped.
 
             /**




More information about the Orxonox-commit mailing list