[Orxonox-commit 6705] r11334 - in code/branches/SpaceRace_HS16/src: modules/gametypes orxonox/infos
meilel at orxonox.net
meilel at orxonox.net
Mon Dec 12 15:45:36 CET 2016
Author: meilel
Date: 2016-12-12 15:45:36 +0100 (Mon, 12 Dec 2016)
New Revision: 11334
Modified:
code/branches/SpaceRace_HS16/src/modules/gametypes/CMakeLists.txt
code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc
code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc
code/branches/SpaceRace_HS16/src/orxonox/infos/Bot.cc
Log:
final changes
Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/CMakeLists.txt
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/CMakeLists.txt 2016-12-12 14:28:37 UTC (rev 11333)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/CMakeLists.txt 2016-12-12 14:45:36 UTC (rev 11334)
@@ -2,8 +2,7 @@
SpaceRace.cc
RaceCheckPoint.cc
SpaceRaceManager.cc
- OldSpaceRace.cc
- OldRaceCheckPoint.cc
+
SpaceRaceBot.cc
SpaceRaceController.cc
)
Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc 2016-12-12 14:28:37 UTC (rev 11333)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc 2016-12-12 14:45:36 UTC (rev 11334)
@@ -23,9 +23,22 @@
* Mauro Salomon
* Co-authors:
* Celine Egger
+ Berkay Berabi
+ Louis Meile
*
*/
+/*
+Todo:
+- improve AI (SpaceRaceController):
+i) so far bots arent able to evade obstacles. fix that!
+ii) bots should be able to use pickups
+- game crashes when bot wins the game
+- bots rotate while waiting for the countdown to end. make it stop!
+- add elements to level file to make it even more fun to play. be creative!
+*/
+
+
#include "SpaceRace.h"
#include "core/CoreIncludes.h"
@@ -62,13 +75,12 @@
{
RegisterObject(SpaceRace);
- this->botclass_ = Class(SpaceRaceBot);//ClassByString("")
+ this->botclass_ = Class(SpaceRaceBot); //ClassByString("")
this->cantMove_ = false;
this->bTimeIsUp_ = false;
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.
+ this->numberOfBots_ = 5; // quick fix: don't allow default-bots to enter the race
}
void SpaceRace::setConfigValues()
@@ -77,32 +89,10 @@
}
+ // define spawn positions of the 5 bots
void SpaceRace::start()
{
-
- /* std::vector<int> spawnpositions;
-
- spawnpositions.push_back(200);
- spawnpositions.push_back(0);
- spawnpositions.push_back(100);
-
- spawnpositions.push_back(200);
- spawnpositions.push_back(200);
- spawnpositions.push_back(0);
-
- spawnpositions.push_back(200);
- spawnpositions.push_back(0);
- spawnpositions.push_back(0);
-
- spawnpositions.push_back(100);
- spawnpositions.push_back(0);
- spawnpositions.push_back(0);
-
- spawnpositions.push_back(0);
- spawnpositions.push_back(100);
- spawnpositions.push_back(0);
-*/
int startpos[15];
startpos[0] =100;
@@ -125,12 +115,6 @@
startpos[13] =-40;
startpos[14] =80;
- /*startpos[15] =
- startpos[0] =
- startpos[0] =
- startpos[0] =
- startpos[0] =
- startpos[0] =*/
@@ -139,13 +123,13 @@
{
this->spawnPlayersIfRequested();
this->cantMove_ = true;
-
+ //bots unable to move while countdown is running
for (Engine* engine : ObjectList<Engine>()){
engine->setActive(false);
}
-
+ //append spawn positions to bots
int a,b,c;
a=0;
b=1;
@@ -162,10 +146,11 @@
- std::string message("BE FAST BE FIRST");
+ std::string message("Use headphones to hear the countdown!");
this->getGametypeInfo()->sendAnnounceMessage(message);
ChatManager::message(message);
+//after 11 s, countdownFinished is called to activate bots` engines
Timer* countdownTimer = new Timer();
countdownTimer->setTimer(11, false, createExecutor(createFunctor(&SpaceRace::countdownFinished, this)));
}
@@ -183,7 +168,7 @@
if (this->bTimeIsUp_)
{
message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
- + "You didn't reach the check point before the time limit. You lose!";
+ + "You lose!";
}
else
{
@@ -202,45 +187,6 @@
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_)
- {
- this->spawnPlayersIfRequested();
- this->cantMove_ = true;
-
- for (Engine* engine : ObjectList<Engine>())
- engine->setActive(false);
- }*/
-
-
-//gtinfo_->setStartCountdown(50.0);
-
-
-
-
-
-
-
-
-
- // activate the engines when the countdown ends
- /* if (!this->isStartCountdownRunning() && this->cantMove_)
- {
- for (Engine* engine : ObjectList<Engine>())
- engine->setActive(true);
-
- this->cantMove_= false;
-
-
-
- std::string message = "RACE STARTED!";
- this->getGametypeInfo()->sendAnnounceMessage(message);
- ChatManager::message(message);
- }*/
-
}
void SpaceRace::newCheckpointReached(RaceCheckPoint* checkpoint, PlayerInfo* player)
@@ -288,20 +234,11 @@
{
for (unsigned int i = 1; i <= amount; ++i){
this->botclass_.fabricate(this->getContext());
- //SpaceRaceBot* bot = new SpaceRaceBot(this->getContext());
- //bot->setPosition(-i*150,0,-i*100);
}
-
-
-
-
}
-
-
-
-
+//set bot configurations
bool SpaceRace::allowPawnHit(Pawn* victim, Pawn* originator)
{
return true;
Modified: code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc
===================================================================
--- code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc 2016-12-12 14:28:37 UTC (rev 11333)
+++ code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc 2016-12-12 14:45:36 UTC (rev 11334)
@@ -56,9 +56,8 @@
{
"Dr. Julius No",
"Berkay Berabi",
- "Louis Meile"
-
- "Abradolf Lincler"
+ "Louis Meile"
+ "Yo mama"
};
static std::vector<std::string> defaultnames(names, names + sizeof(names) / sizeof(std::string));
Modified: code/branches/SpaceRace_HS16/src/orxonox/infos/Bot.cc
===================================================================
--- code/branches/SpaceRace_HS16/src/orxonox/infos/Bot.cc 2016-12-12 14:28:37 UTC (rev 11333)
+++ code/branches/SpaceRace_HS16/src/orxonox/infos/Bot.cc 2016-12-12 14:45:36 UTC (rev 11334)
@@ -69,24 +69,17 @@
{
"Berkay Berabi",
"Louis Meile"
- "Dr. Julius No 3",
- "Rosa Klebb",
"Muten Roshi",
"Abradolf Lincler",
- "Dr. Kananga",
- "Francisco Scaramanga",
- "Karl Stromberg",
- "Sir Hugo Drax",
+ "Lionel Messi",
"Kamal Khan",
- "General Orlov",
- "General Georgi Koskov",
"Karl the Llama",
- "Alec Trevelyan",
"Thomas the Tankengine",
"Rick",
"Morty",
"Charlie the Unicorn",
"Kung Fury",
+ "Postman Pat"
};
static std::vector<std::string> defaultnames(names, names + sizeof(names) / sizeof(std::string));
More information about the Orxonox-commit
mailing list