[Orxonox-commit 6633] r11272 - in code/branches/SpaceRace_HS16: data/levels src/modules/gametypes src/orxonox/gametypes
bberabi at orxonox.net
bberabi at orxonox.net
Mon Nov 7 16:00:25 CET 2016
Author: bberabi
Date: 2016-11-07 16:00:25 +0100 (Mon, 07 Nov 2016)
New Revision: 11272
Modified:
code/branches/SpaceRace_HS16/data/levels/newnewnewspacerace.oxw
code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.cc
code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.h
code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc
code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.h
code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceManager.cc
code/branches/SpaceRace_HS16/src/orxonox/gametypes/Gametype.cc
Log:
bots are finally added; controller has to be implemented
Modified: code/branches/SpaceRace_HS16/data/levels/newnewnewspacerace.oxw
===================================================================
--- code/branches/SpaceRace_HS16/data/levels/newnewnewspacerace.oxw 2016-11-07 15:00:21 UTC (rev 11271)
+++ code/branches/SpaceRace_HS16/data/levels/newnewnewspacerace.oxw 2016-11-07 15:00:25 UTC (rev 11272)
@@ -219,7 +219,7 @@
<ForceField position="0,0,0" direction="0,-1,0" diameter=500 velocity=2000 length=1200/>
<!-- ------------------CheckPoints----------------- -->
- <OldRaceCheckPoint name="checkpoint1" direction="0,2,0" position="800,20,0" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="0" islast="false">
+ <OldRaceCheckPoint name="checkpoint1" direction="0,2,0" position="800,20,0" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="0" islast="false">
<attached>
<Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
</attached>
@@ -303,5 +303,65 @@
</collisionShapes>
</OldRaceCheckPoint>
+
+
+ <!-- <SpaceRaceManager>
+ <checkpoints>
+ <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">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+
+
+ <Model position="0,0,55" mesh="testcube.mesh" scale3D="110,20,20" />
+ <Model position="0,0,-55" mesh="testcube.mesh" scale3D="110,20,20" />
+ <Model position="55,0,0" mesh="testcube.mesh" scale3D="20,20,110" />
+ <Model position="-55,0,0" mesh="testcube.mesh" scale3D="20,20,110" />
+
+
+
+
+ </attached>
+
+
+
+ <collisionShapes>
+
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+
+ </collisionShapes>
+
+
+
+
+ </RaceCheckPoint>
+
+<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">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+
+
+ <collisionShapes>
+
+ <BoxCollisionShape position="0,0,220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="0,0,-220" halfExtents="220, 40, 40" />
+ <BoxCollisionShape position="220,0,0" halfExtents="40, 40, 220" />
+ <BoxCollisionShape position="-220,0,0" halfExtents="40, 40, 220" />
+
+ </collisionShapes>
+ </RaceCheckPoint>
+
+
+</checkpoints>
+</SpaceRaceManager> -->
+
+
+
</Scene>
</Level>
+
\ No newline at end of file
Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.cc
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.cc 2016-11-07 15:00:21 UTC (rev 11271)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.cc 2016-11-07 15:00:25 UTC (rev 11272)
@@ -35,13 +35,14 @@
#include "infos/Bot.h"
#include "items/Engine.h"
#include "controllers/HumanController.h"
-#include "SpaceRaceBot.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"
@@ -55,6 +56,7 @@
RegisterObject(OldSpaceRace);
//this->botclass_ = Class();
+ this->botclass_ = Class(SpaceRaceBot);//ClassByString("")
this->checkpointsReached_ = 0;
this->bTimeIsUp_ = false;
@@ -167,5 +169,27 @@
ChatManager::message(message);
}
+ /*void playerEntered(PlayerInfo* player) {
+
+ Gametype::playerEntered(player);
+
+ const std::string& message = player->getName() + " entered the game";
+ ChatManager::message(message);
+
+ }*/
+
+
+
+
+ void OldSpaceRace::addBots(unsigned int amount)
+ {
+ for (unsigned int i = 0; i < amount; ++i)
+ this->botclass_.fabricate(this->getContext());
+ }
+
+
+
+
+
}
Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.h
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.h 2016-11-07 15:00:21 UTC (rev 11271)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.h 2016-11-07 15:00:25 UTC (rev 11272)
@@ -37,6 +37,7 @@
#include <util/Clock.h>
#include "gametypes/Gametype.h"
+#include "SpaceRaceManager.h"
#include "OldRaceCheckPoint.h"
@@ -62,7 +63,7 @@
virtual void playerEntered(PlayerInfo* player) override;
virtual void newCheckpointReached();
- virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command.
+ virtual void addBots(unsigned int amount) override; //<! overwrite function in order to bypass the addbots command.
//<! This is only a temporary solution. Better: create racingBots.
Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc 2016-11-07 15:00:21 UTC (rev 11271)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc 2016-11-07 15:00:25 UTC (rev 11272)
@@ -22,23 +22,53 @@
* Created on: Oct 8, 2012
* Author: purgham
*/
+#include <vector>
#include "SpaceRaceBot.h"
+#include "core/GameMode.h"
#include "core/CoreIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
+#include "gametypes/Gametype.h"
+#include "controllers/AIController.h"
+#include "gametypes/SpaceRaceController.h"
+
+
namespace orxonox
{
RegisterClass(SpaceRaceBot);
SpaceRaceBot::SpaceRaceBot(Context* context) : Bot(context){
RegisterObject(SpaceRaceBot);
- this->defaultController_ = Class(SpaceRaceController);// ClassByString("")
+ this->defaultController_ = Class(AIController);// ClassByString("")
+
+
+
+
+
+
this->createController();
+
}
+SpaceRaceBot::~SpaceRaceBot(){
+}
+void SpaceRaceBot::setConfigValues()
+ {
+ static const std::string names[] =
+ {
+ "Dr. Julius No",
+ "Berkay Berabi",
+ "Louis Meile"
+
+ "Dominic Greene"
+ };
+ static std::vector<std::string> defaultnames(names, names + sizeof(names) / sizeof(std::string));
+ SetConfigValue(names_, defaultnames);
+ }
Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.h
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.h 2016-11-07 15:00:21 UTC (rev 11271)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.h 2016-11-07 15:00:25 UTC (rev 11272)
@@ -29,19 +29,34 @@
#include "infos/Bot.h"
#include "gametypes/GametypesPrereqs.h"
#include "gametypes/SpaceRaceController.h"
+#include <vector>
namespace orxonox
{
- /**
-/sdaasdasdasdasdas
- */
class _GametypesExport SpaceRaceBot: public Bot
{
public:
- SpaceRaceBot(Context* context);
- virtual ~SpaceRaceBot() {}
+ SpaceRaceBot(Context* context);
+ virtual ~SpaceRaceBot();
+
+ void setConfigValues();
+
+
+
+ virtual inline bool isInitialized() const override
+ { return true; }
+ virtual inline float getPing() const override
+ { return 0; }
+ virtual inline float getPacketLossRatio() const override
+ { return 0; }
+
+
+ private:
+ std::vector<std::string> names_;
+
+
};
}
Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceManager.cc
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceManager.cc 2016-11-07 15:00:21 UTC (rev 11271)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceManager.cc 2016-11-07 15:00:25 UTC (rev 11272)
@@ -46,7 +46,7 @@
{
RegisterObject(SpaceRaceManager);
this->race_ = orxonox_cast<SpaceRace*>(this->getGametype());
- assert(race_);
+ //assert(race_);
//amountOfPlayers=(race_->getPlayers()).size();
this->firstcheckpointvisible_ = false;
}
Modified: code/branches/SpaceRace_HS16/src/orxonox/gametypes/Gametype.cc
===================================================================
--- code/branches/SpaceRace_HS16/src/orxonox/gametypes/Gametype.cc 2016-11-07 15:00:21 UTC (rev 11271)
+++ code/branches/SpaceRace_HS16/src/orxonox/gametypes/Gametype.cc 2016-11-07 15:00:25 UTC (rev 11272)
@@ -95,7 +95,7 @@
ModifyConsoleCommand(__CC_killBots_name).setObject(nullptr);
}
}
-
+
/**
* @brief Initializes sub-objects of the Gametype. This must be called after the constructor.
* At this point, the context is expected to have the current gametype. This allows to pass the current gametype to the sub-objects via constructor.
More information about the Orxonox-commit
mailing list