[Orxonox-commit 1004] r5725 - in code/branches/libraries2/src: modules modules/overlays/hud modules/pong orxonox orxonox/objects/controllers orxonox/objects/gametypes orxonox/objects/infos orxonox/objects/worldentities
landauf at orxonox.net
landauf at orxonox.net
Mon Aug 31 20:23:08 CEST 2009
Author: landauf
Date: 2009-08-31 20:23:07 +0200 (Mon, 31 Aug 2009)
New Revision: 5725
Added:
code/branches/libraries2/src/modules/pong/
code/branches/libraries2/src/modules/pong/CMakeLists.txt
code/branches/libraries2/src/modules/pong/Pong.cc
code/branches/libraries2/src/modules/pong/Pong.h
code/branches/libraries2/src/modules/pong/PongAI.cc
code/branches/libraries2/src/modules/pong/PongAI.h
code/branches/libraries2/src/modules/pong/PongBall.cc
code/branches/libraries2/src/modules/pong/PongBall.h
code/branches/libraries2/src/modules/pong/PongBat.cc
code/branches/libraries2/src/modules/pong/PongBat.h
code/branches/libraries2/src/modules/pong/PongBot.cc
code/branches/libraries2/src/modules/pong/PongBot.h
code/branches/libraries2/src/modules/pong/PongCenterpoint.cc
code/branches/libraries2/src/modules/pong/PongCenterpoint.h
code/branches/libraries2/src/modules/pong/PongPrereqs.h
code/branches/libraries2/src/modules/pong/PongScore.cc
code/branches/libraries2/src/modules/pong/PongScore.h
Removed:
code/branches/libraries2/src/modules/overlays/hud/PongScore.cc
code/branches/libraries2/src/modules/overlays/hud/PongScore.h
code/branches/libraries2/src/orxonox/objects/controllers/PongAI.cc
code/branches/libraries2/src/orxonox/objects/controllers/PongAI.h
code/branches/libraries2/src/orxonox/objects/gametypes/Pong.cc
code/branches/libraries2/src/orxonox/objects/gametypes/Pong.h
code/branches/libraries2/src/orxonox/objects/infos/PongBot.cc
code/branches/libraries2/src/orxonox/objects/infos/PongBot.h
code/branches/libraries2/src/orxonox/objects/worldentities/PongBall.cc
code/branches/libraries2/src/orxonox/objects/worldentities/PongBall.h
code/branches/libraries2/src/orxonox/objects/worldentities/PongBat.cc
code/branches/libraries2/src/orxonox/objects/worldentities/PongBat.h
code/branches/libraries2/src/orxonox/objects/worldentities/PongCenterpoint.cc
code/branches/libraries2/src/orxonox/objects/worldentities/PongCenterpoint.h
Modified:
code/branches/libraries2/src/modules/CMakeLists.txt
code/branches/libraries2/src/modules/overlays/hud/CMakeLists.txt
code/branches/libraries2/src/orxonox/OrxonoxPrereqs.h
code/branches/libraries2/src/orxonox/objects/controllers/CMakeLists.txt
code/branches/libraries2/src/orxonox/objects/gametypes/CMakeLists.txt
code/branches/libraries2/src/orxonox/objects/infos/CMakeLists.txt
code/branches/libraries2/src/orxonox/objects/worldentities/CMakeLists.txt
Log:
added a new module for the pong gametype and all related classes
Modified: code/branches/libraries2/src/modules/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/modules/CMakeLists.txt 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/modules/CMakeLists.txt 2009-08-31 18:23:07 UTC (rev 5725)
@@ -21,5 +21,6 @@
ADD_SUBDIRECTORY(gamestates)
ADD_SUBDIRECTORY(overlays)
+ADD_SUBDIRECTORY(pong)
ADD_SUBDIRECTORY(questsystem)
ADD_SUBDIRECTORY(weapons)
Modified: code/branches/libraries2/src/modules/overlays/hud/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/modules/overlays/hud/CMakeLists.txt 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/modules/overlays/hud/CMakeLists.txt 2009-08-31 18:23:07 UTC (rev 5725)
@@ -10,7 +10,6 @@
AnnounceMessage.cc
KillMessage.cc
DeathMessage.cc
- PongScore.cc
UnderAttackHealthBar.cc
TeamBaseMatchScore.cc
)
Deleted: code/branches/libraries2/src/modules/overlays/hud/PongScore.cc
===================================================================
--- code/branches/libraries2/src/modules/overlays/hud/PongScore.cc 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/modules/overlays/hud/PongScore.cc 2009-08-31 18:23:07 UTC (rev 5725)
@@ -1,139 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "PongScore.h"
-
-#include "util/Convert.h"
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "objects/gametypes/Pong.h"
-#include "objects/infos/PlayerInfo.h"
-
-namespace orxonox
-{
- CreateFactory(PongScore);
-
- PongScore::PongScore(BaseObject* creator) : OverlayText(creator)
- {
- RegisterObject(PongScore);
-
- this->owner_ = 0;
-
- this->bShowName_ = false;
- this->bShowScore_ = false;
- this->bShowLeftPlayer_ = false;
- this->bShowRightPlayer_ = false;
- }
-
- PongScore::~PongScore()
- {
- }
-
- void PongScore::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(PongScore, XMLPort, xmlelement, mode);
-
- XMLPortParam(PongScore, "showname", setShowName, getShowName, xmlelement, mode).defaultValues(false);
- XMLPortParam(PongScore, "showscore", setShowScore, getShowScore, xmlelement, mode).defaultValues(false);
- XMLPortParam(PongScore, "showleftplayer", setShowLeftPlayer, getShowLeftPlayer, xmlelement, mode).defaultValues(false);
- XMLPortParam(PongScore, "showrightplayer", setShowRightPlayer, getShowRightPlayer, xmlelement, mode).defaultValues(false);
- }
-
- void PongScore::tick(float dt)
- {
- SUPER(PongScore, tick, dt);
-
- if (this->owner_)
- {
- PlayerInfo* player1 = this->owner_->getLeftPlayer();
- PlayerInfo* player2 = this->owner_->getRightPlayer();
-
- std::string name1;
- std::string name2;
-
- std::string score1 = "0";
- std::string score2 = "0";
-
- if (player1)
- {
- name1 = player1->getName();
- score1 = multi_cast<std::string>(this->owner_->getScore(player1));
- }
-
- if (player2)
- {
- name2 = player2->getName();
- score2 = multi_cast<std::string>(this->owner_->getScore(player2));
- }
-
- std::string output1;
- if (this->bShowLeftPlayer_)
- {
- if (this->bShowName_ && this->bShowScore_ && player1)
- output1 = name1 + " - " + score1;
- else if (this->bShowScore_)
- output1 = score1;
- else if (this->bShowName_)
- output1 = name1;
- }
-
- std::string output2;
- if (this->bShowRightPlayer_)
- {
- if (this->bShowName_ && this->bShowScore_ && player2)
- output2 = score2 + " - " + name2;
- else if (this->bShowScore_)
- output2 = score2;
- else if (this->bShowName_)
- output2 = name2;
- }
-
- std::string output = "PONG";
- if (this->bShowName_ || this->bShowScore_)
- {
- if (this->bShowLeftPlayer_ && this->bShowRightPlayer_)
- output = output1 + ":" + output2;
- else if (this->bShowLeftPlayer_ || this->bShowRightPlayer_)
- output = output1 + output2;
- }
-
- this->setCaption(output);
- }
- }
-
-
- void PongScore::changedOwner()
- {
- SUPER(PongScore, changedOwner);
-
- if (this->getOwner() && this->getOwner()->getGametype())
- this->owner_ = orxonox_cast<Pong*>(this->getOwner()->getGametype());
- else
- this->owner_ = 0;
- }
-}
Deleted: code/branches/libraries2/src/modules/overlays/hud/PongScore.h
===================================================================
--- code/branches/libraries2/src/modules/overlays/hud/PongScore.h 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/modules/overlays/hud/PongScore.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -1,77 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _PongScore_H__
-#define _PongScore_H__
-
-#include "overlays/OverlaysPrereqs.h"
-
-#include "tools/interfaces/Tickable.h"
-#include "overlays/OverlayText.h"
-
-namespace orxonox
-{
- class _OverlaysExport PongScore : public OverlayText, public Tickable
- {
- public:
- PongScore(BaseObject* creator);
- virtual ~PongScore();
-
- virtual void tick(float dt);
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- virtual void changedOwner();
-
- inline void setShowName(bool value)
- { this->bShowName_ = value; }
- inline bool getShowName() const
- { return this->bShowName_; }
-
- inline void setShowScore(bool value)
- { this->bShowScore_ = value; }
- inline bool getShowScore() const
- { return this->bShowScore_; }
-
- inline void setShowLeftPlayer(bool value)
- { this->bShowLeftPlayer_ = value; }
- inline bool getShowLeftPlayer() const
- { return this->bShowLeftPlayer_; }
-
- inline void setShowRightPlayer(bool value)
- { this->bShowRightPlayer_ = value; }
- inline bool getShowRightPlayer() const
- { return this->bShowRightPlayer_; }
-
- private:
- Pong* owner_;
- bool bShowName_;
- bool bShowScore_;
- bool bShowLeftPlayer_;
- bool bShowRightPlayer_;
- };
-}
-#endif /* _PongScore_H__ */
Added: code/branches/libraries2/src/modules/pong/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/modules/pong/CMakeLists.txt (rev 0)
+++ code/branches/libraries2/src/modules/pong/CMakeLists.txt 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,19 @@
+SET_SOURCE_FILES(PONG_SRC_FILES
+ Pong.cc
+ PongAI.cc
+ PongBall.cc
+ PongBat.cc
+ PongBot.cc
+ PongCenterpoint.cc
+ PongScore.cc
+)
+
+ORXONOX_ADD_LIBRARY(pong
+ MODULE
+ DEFINE_SYMBOL
+ "PONG_SHARED_BUILD"
+ LINK_LIBRARIES
+ orxonox
+ overlays
+ SOURCE_FILES ${PONG_SRC_FILES}
+)
Property changes on: code/branches/libraries2/src/modules/pong/CMakeLists.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Copied: code/branches/libraries2/src/modules/pong/Pong.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/gametypes/Pong.cc)
===================================================================
--- code/branches/libraries2/src/modules/pong/Pong.cc (rev 0)
+++ code/branches/libraries2/src/modules/pong/Pong.cc 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,200 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "Pong.h"
+
+#include "core/CoreIncludes.h"
+#include "core/Executor.h"
+#include "PongCenterpoint.h"
+#include "PongBall.h"
+#include "PongBat.h"
+#include "PongBot.h"
+#include "PongAI.h"
+
+namespace orxonox
+{
+ CreateUnloadableFactory(Pong);
+
+ Pong::Pong(BaseObject* creator) : Deathmatch(creator)
+ {
+ RegisterObject(Pong);
+
+ this->center_ = 0;
+ this->ball_ = 0;
+ this->bat_[0] = 0;
+ this->bat_[1] = 0;
+
+ this->setHUDTemplate("PongHUD");
+
+ this->starttimer_.setTimer(1.0, false, this, createExecutor(createFunctor(&Pong::startBall)));
+ this->starttimer_.stopTimer();
+
+ this->botclass_ = Class(PongBot);
+ }
+
+ void Pong::start()
+ {
+ if (this->center_)
+ {
+ if (!this->ball_)
+ {
+ this->ball_ = new PongBall(this->center_);
+ this->ball_->addTemplate(this->center_->getBalltemplate());
+ }
+
+ this->center_->attach(this->ball_);
+ this->ball_->setPosition(0, 0, 0);
+ this->ball_->setFieldDimension(this->center_->getFieldDimension());
+ this->ball_->setSpeed(0);
+ this->ball_->setBatLength(this->center_->getBatLength());
+
+ if (!this->bat_[0])
+ {
+ this->bat_[0] = new PongBat(this->center_);
+ this->bat_[0]->addTemplate(this->center_->getBattemplate());
+ }
+ if (!this->bat_[1])
+ {
+ this->bat_[1] = new PongBat(this->center_);
+ this->bat_[1]->addTemplate(this->center_->getBattemplate());
+ }
+
+ this->center_->attach(this->bat_[0]);
+ this->center_->attach(this->bat_[1]);
+ this->bat_[0]->setPosition(-this->center_->getFieldDimension().x / 2, 0, 0);
+ this->bat_[1]->setPosition( this->center_->getFieldDimension().x / 2, 0, 0);
+ this->bat_[0]->yaw(Degree(-90));
+ this->bat_[1]->yaw(Degree(90));
+ this->bat_[0]->setSpeed(this->center_->getBatSpeed());
+ this->bat_[1]->setSpeed(this->center_->getBatSpeed());
+ this->bat_[0]->setFieldHeight(this->center_->getFieldDimension().y);
+ this->bat_[1]->setFieldHeight(this->center_->getFieldDimension().y);
+ this->bat_[0]->setLength(this->center_->getBatLength());
+ this->bat_[1]->setLength(this->center_->getBatLength());
+
+ this->ball_->setBats(this->bat_);
+ }
+ else
+ {
+ COUT(1) << "Error: No Centerpoint specified." << std::endl;
+ }
+
+ this->starttimer_.startTimer();
+
+
+ bool temp = this->bForceSpawn_;
+ this->bForceSpawn_ = true;
+
+ Deathmatch::start();
+
+ this->bForceSpawn_ = temp;
+ }
+
+ void Pong::end()
+ {
+ if (this->ball_)
+ {
+ delete this->ball_;
+ this->ball_ = 0;
+ }
+
+ Deathmatch::end();
+ }
+
+ void Pong::spawnPlayer(PlayerInfo* player)
+ {
+ if (!this->bat_[0]->getPlayer())
+ {
+ player->startControl(this->bat_[0]);
+ this->players_[player].state_ = PlayerState::Alive;
+ }
+ else if (!this->bat_[1]->getPlayer())
+ {
+ player->startControl(this->bat_[1]);
+ this->players_[player].state_ = PlayerState::Alive;
+ }
+ else
+ return;
+
+ if (player && player->getController() && player->getController()->isA(Class(PongAI)))
+ {
+ PongAI* ai = orxonox_cast<PongAI*>(player->getController());
+ ai->setPongBall(this->ball_);
+ }
+ }
+
+ void Pong::playerScored(PlayerInfo* player)
+ {
+ Deathmatch::playerScored(player);
+
+ if (this->center_)
+ {
+ this->center_->fireEvent();
+
+ if (player)
+ this->gtinfo_.sendAnnounceMessage(player->getName() + " scored");
+ }
+
+ if (this->ball_)
+ {
+ this->ball_->setPosition(Vector3::ZERO);
+ this->ball_->setVelocity(Vector3::ZERO);
+ this->ball_->setSpeed(0);
+ }
+
+ if (this->bat_[0] && this->bat_[1])
+ {
+ this->bat_[0]->setPosition(-this->center_->getFieldDimension().x / 2, 0, 0);
+ this->bat_[1]->setPosition( this->center_->getFieldDimension().x / 2, 0, 0);
+ }
+
+ this->starttimer_.startTimer();
+ }
+
+ void Pong::startBall()
+ {
+ if (this->ball_ && this->center_)
+ this->ball_->setSpeed(this->center_->getBallSpeed());
+ }
+
+ PlayerInfo* Pong::getLeftPlayer() const
+ {
+ if (this->bat_ && this->bat_[0])
+ return this->bat_[0]->getPlayer();
+ else
+ return 0;
+ }
+
+ PlayerInfo* Pong::getRightPlayer() const
+ {
+ if (this->bat_ && this->bat_[1])
+ return this->bat_[1]->getPlayer();
+ else
+ return 0;
+ }
+}
Copied: code/branches/libraries2/src/modules/pong/Pong.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/gametypes/Pong.h)
===================================================================
--- code/branches/libraries2/src/modules/pong/Pong.h (rev 0)
+++ code/branches/libraries2/src/modules/pong/Pong.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,68 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Pong_H__
+#define _Pong_H__
+
+#include "pong/PongPrereqs.h"
+
+#include "tools/Timer.h"
+#include "objects/gametypes/Deathmatch.h"
+
+namespace orxonox
+{
+ class _PongExport Pong : public Deathmatch
+ {
+ public:
+ Pong(BaseObject* creator);
+ virtual ~Pong() {}
+
+ virtual void start();
+ virtual void end();
+
+ virtual void spawnPlayer(PlayerInfo* player);
+
+ virtual void playerScored(PlayerInfo* player);
+
+ void setCenterpoint(PongCenterpoint* center)
+ { this->center_ = center; }
+
+ PlayerInfo* getLeftPlayer() const;
+ PlayerInfo* getRightPlayer() const;
+
+ protected:
+ void startBall();
+
+ PongCenterpoint* center_;
+ PongBall* ball_;
+ PongBat* bat_[2];
+ Timer<Pong> starttimer_;
+ };
+}
+
+#endif /* _Pong_H__ */
Copied: code/branches/libraries2/src/modules/pong/PongAI.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/controllers/PongAI.cc)
===================================================================
--- code/branches/libraries2/src/modules/pong/PongAI.cc (rev 0)
+++ code/branches/libraries2/src/modules/pong/PongAI.cc 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,253 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "PongAI.h"
+
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "tools/Timer.h"
+#include "objects/worldentities/ControllableEntity.h"
+#include "PongBall.h"
+
+namespace orxonox
+{
+ CreateUnloadableFactory(PongAI);
+
+ const static float MAX_REACTION_TIME = 0.4f;
+
+ PongAI::PongAI(BaseObject* creator) : Controller(creator)
+ {
+ RegisterObject(PongAI);
+
+ this->ball_ = 0;
+ this->ballDirection_ = Vector2::ZERO;
+ this->ballEndPosition_ = 0;
+ this->randomOffset_ = 0;
+ this->relHysteresisOffset_ = 0.02f;
+ this->strength_ = 0.5f;
+ this->movement_ = 0;
+ this->oldMove_ = 0;
+ this->bOscillationAvoidanceActive_ = false;
+
+ this->setConfigValues();
+ }
+
+ PongAI::~PongAI()
+ {
+ for (std::list<std::pair<Timer<PongAI>*, char> >::iterator it = this->reactionTimers_.begin(); it != this->reactionTimers_.end(); ++it)
+ delete (*it).first;
+ }
+
+ void PongAI::setConfigValues()
+ {
+ SetConfigValue(strength_, 0.5).description("A value from 0 to 1 where 0 is weak and 1 is strong.");
+ }
+
+ void PongAI::tick(float dt)
+ {
+ if (!this->ball_ || !this->getControllableEntity())
+ return;
+
+ Vector3 mypos = this->getControllableEntity()->getPosition();
+ Vector3 ballpos = this->ball_->getPosition();
+ Vector3 ballvel = this->ball_->getVelocity();
+ float hysteresisOffset = this->relHysteresisOffset_ * this->ball_->getFieldDimension().y;
+
+ char move = 0;
+ bool delay = false;
+
+ // Check in which direction the ball is flying
+ if ((mypos.x > 0 && ballvel.x < 0) || (mypos.x < 0 && ballvel.x > 0))
+ {
+ // The ball is flying away
+ this->ballDirection_.x = -1;
+ this->ballDirection_.y = 0;
+ this->bOscillationAvoidanceActive_ = false;
+
+ // Move to the middle
+ if (mypos.z > hysteresisOffset)
+ move = 1;
+ else if (mypos.z < -hysteresisOffset)
+ move = -1;
+ }
+ else if (ballvel.x == 0)
+ {
+ // The ball is standing still
+ this->ballDirection_.x = 0;
+ this->ballDirection_.y = 0;
+ this->bOscillationAvoidanceActive_ = false;
+ }
+ else
+ {
+ // The ball is approaching
+ if (this->ballDirection_.x != 1)
+ {
+ // The ball just startet to approach, initialize all values
+ this->ballDirection_.x = 1;
+ this->ballDirection_.y = sgn(ballvel.z);
+ this->ballEndPosition_ = 0;
+ this->randomOffset_ = 0;
+
+ this->calculateRandomOffset();
+ this->calculateBallEndPosition();
+ delay = true;
+ this->bOscillationAvoidanceActive_ = false;
+ }
+
+ if (this->ballDirection_.y != sgn(ballvel.z))
+ {
+ // The ball just bounced from a bound, recalculate the predicted end position
+ this->ballDirection_.y = sgn(ballvel.z);
+
+ this->calculateBallEndPosition();
+ delay = true;
+ this->bOscillationAvoidanceActive_ = false;
+ }
+
+ // Move to the predicted end position with an additional offset (to hit the ball with the side of the bat)
+ if (!this->bOscillationAvoidanceActive_)
+ {
+ float desiredZValue = this->ballEndPosition_ + this->randomOffset_;
+
+ if (mypos.z > desiredZValue + hysteresisOffset * (this->randomOffset_ < 0))
+ move = 1;
+ else if (mypos.z < desiredZValue - hysteresisOffset * (this->randomOffset_ > 0))
+ move = -1;
+ }
+
+ if (move != 0 && this->oldMove_ != 0 && move != this->oldMove_ && !delay)
+ {
+ // We had to correct our position because we moved too far
+ // (and delay ist false, so we're not in the wrong place because of a new end-position prediction)
+ if (fabs(mypos.z - this->ballEndPosition_) < 0.5 * this->ball_->getBatLength() * this->ball_->getFieldDimension().y)
+ {
+ // We're not at the right position, but we still hit the ball, so just stay there to avoid oscillation
+ move = 0;
+ this->bOscillationAvoidanceActive_ = true;
+ }
+ }
+ }
+
+ this->oldMove_ = move;
+ this->move(move, delay);
+ this->getControllableEntity()->moveFrontBack(this->movement_);
+ }
+
+ void PongAI::calculateRandomOffset()
+ {
+ // Calculate the exponent for the position-formula
+ float exp = pow(10, 1 - 2*this->strength_); // strength: 0 -> exp = 10
+ // strength: 0.5 -> exp = 1
+ // strength: 1 -> exp = 0.1
+
+ // Calculate the relative position where to hit the ball with the bat
+ float position = pow(rnd(), exp); // exp > 1 -> position is more likely a small number
+ // exp < 1 -> position is more likely a large number
+
+ // The position shouln't be larger than 0.5 (50% of the bat-length from the middle is the end)
+ position *= 0.48f;
+
+ // Both sides are equally probable
+ position *= rndsgn();
+
+ // Calculate the offset in world units
+ this->randomOffset_ = position * this->ball_->getBatLength() * this->ball_->getFieldDimension().y;
+ }
+
+ void PongAI::calculateBallEndPosition()
+ {
+ Vector3 position = this->ball_->getPosition();
+ Vector3 velocity = this->ball_->getVelocity();
+ Vector2 dimension = this->ball_->getFieldDimension();
+
+ // calculate end-height: current height + slope * distance
+ this->ballEndPosition_ = position.z + velocity.z / velocity.x * (-position.x + dimension.x / 2 * sgn(velocity.x));
+
+ // Calculate bounces
+ for (float limit = 0.35f; limit < this->strength_ || this->strength_ > 0.99f; limit += 0.4f)
+ {
+ // Calculate a random prediction error, based on the vertical speed of the ball and the strength of the AI
+ float randomError = rnd(-1, 1) * dimension.y * (velocity.z / velocity.x / PongBall::MAX_REL_Z_VELOCITY) * (1 - this->strength_);
+
+ // Bounce from the lower bound
+ if (this->ballEndPosition_ > dimension.y / 2)
+ {
+ // Mirror the predicted position at the upper bound and add some random error
+ this->ballEndPosition_ = dimension.y - this->ballEndPosition_ + randomError;
+ continue;
+ }
+ // Bounce from the upper bound
+ if (this->ballEndPosition_ < -dimension.y / 2)
+ {
+ // Mirror the predicted position at the lower bound and add some random error
+ this->ballEndPosition_ = -dimension.y - this->ballEndPosition_ + randomError;
+ continue;
+ }
+ // No bounce - break
+ break;
+ }
+ }
+
+ void PongAI::move(char direction, bool bUseDelay)
+ {
+ // The current direction is either what we're doing right now (movement_) or what is last in the queue
+ char currentDirection = this->movement_;
+ if (this->reactionTimers_.size() > 0)
+ currentDirection = this->reactionTimers_.back().second;
+
+ // Only add changes of direction
+ if (direction == currentDirection)
+ return;
+
+ if (bUseDelay)
+ {
+ // Calculate delay
+ float delay = MAX_REACTION_TIME * (1 - this->strength_);
+
+ // Add a new Timer
+ Timer<PongAI>* timer = new Timer<PongAI>(delay, false, this, createExecutor(createFunctor(&PongAI::delayedMove)));
+ this->reactionTimers_.push_back(std::pair<Timer<PongAI>*, char>(timer, direction));
+ }
+ else
+ {
+ this->movement_ = direction;
+ }
+ }
+
+ void PongAI::delayedMove()
+ {
+ // Get the new movement direction from the timer list
+ this->movement_ = this->reactionTimers_.front().second;
+
+ // Destroy the timer and remove it from the list
+ Timer<PongAI>* timer = this->reactionTimers_.front().first;
+ delete timer;
+
+ this->reactionTimers_.pop_front();
+ }
+}
Copied: code/branches/libraries2/src/modules/pong/PongAI.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/controllers/PongAI.h)
===================================================================
--- code/branches/libraries2/src/modules/pong/PongAI.h (rev 0)
+++ code/branches/libraries2/src/modules/pong/PongAI.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,74 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _PongAI_H__
+#define _PongAI_H__
+
+#include "pong/PongPrereqs.h"
+
+#include <list>
+#include "util/Math.h"
+#include "tools/interfaces/Tickable.h"
+#include "objects/controllers/Controller.h"
+
+namespace orxonox
+{
+ class _PongExport PongAI : public Controller, public Tickable
+ {
+ public:
+ PongAI(BaseObject* creator);
+ virtual ~PongAI();
+
+ void setConfigValues();
+
+ virtual void tick(float dt);
+
+ void setPongBall(PongBall* ball)
+ { this->ball_ = ball; }
+
+ protected:
+ void calculateRandomOffset();
+ void calculateBallEndPosition();
+ void move(char direction, bool bUseDelay);
+ void delayedMove();
+
+ PongBall* ball_;
+ Vector2 ballDirection_;
+ float ballEndPosition_;
+ float randomOffset_;
+ float relHysteresisOffset_;
+ float strength_;
+
+ std::list<std::pair<Timer<PongAI>*, char> > reactionTimers_;
+ char movement_;
+ char oldMove_;
+ bool bOscillationAvoidanceActive_;
+ };
+}
+
+#endif /* _PongAI_H__ */
Copied: code/branches/libraries2/src/modules/pong/PongBall.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/worldentities/PongBall.cc)
===================================================================
--- code/branches/libraries2/src/modules/pong/PongBall.cc (rev 0)
+++ code/branches/libraries2/src/modules/pong/PongBall.cc 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,237 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "PongBall.h"
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "objects/gametypes/Gametype.h"
+#include "PongBat.h"
+#include "sound/SoundBase.h"
+
+namespace orxonox
+{
+ CreateFactory(PongBall);
+
+ const float PongBall::MAX_REL_Z_VELOCITY = 1.5;
+
+ PongBall::PongBall(BaseObject* creator) : MovableEntity(creator)
+ {
+ RegisterObject(PongBall);
+
+ this->speed_ = 0;
+ this->bat_ = 0;
+ this->batID_ = new unsigned int[2];
+ this->batID_[0] = OBJECTID_UNKNOWN;
+ this->batID_[1] = OBJECTID_UNKNOWN;
+ this->relMercyOffset_ = 0.05f;
+
+ this->registerVariables();
+
+ this->sidesound_ = new SoundBase(this);
+ this->sidesound_->loadFile("sounds/pong_side.wav");
+
+ this->batsound_ = new SoundBase(this);
+ this->batsound_->loadFile("sounds/pong_bat.wav");
+
+ this->scoresound_ = new SoundBase(this);
+ this->scoresound_->loadFile("sounds/pong_score.wav");
+ }
+
+ void PongBall::registerVariables()
+ {
+ registerVariable( this->fieldWidth_ );
+ registerVariable( this->fieldHeight_ );
+ registerVariable( this->batlength_ );
+ registerVariable( this->speed_ );
+ registerVariable( this->relMercyOffset_ );
+ registerVariable( this->batID_[0] );
+ registerVariable( this->batID_[1], VariableDirection::ToClient, new NetworkCallback<PongBall>( this, &PongBall::applyBats) );
+ }
+
+ void PongBall::tick(float dt)
+ {
+ SUPER(PongBall, tick, dt);
+
+ if (GameMode::isMaster())
+ {
+ Vector3 position = this->getPosition();
+ Vector3 velocity = this->getVelocity();
+
+ if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2)
+ {
+ velocity.z = -velocity.z;
+ this->sidesound_->play();
+
+ if (position.z > this->fieldHeight_ / 2)
+ position.z = this->fieldHeight_ / 2;
+ if (position.z < -this->fieldHeight_ / 2)
+ position.z = -this->fieldHeight_ / 2;
+ }
+
+ if (position.x > this->fieldWidth_ / 2 || position.x < -this->fieldWidth_ / 2)
+ {
+ float distance = 0;
+
+ if (this->bat_)
+ {
+ if (position.x > this->fieldWidth_ / 2 && this->bat_[1])
+ {
+ distance = (position.z - this->bat_[1]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
+ if (fabs(distance) <= 1)
+ {
+ position.x = this->fieldWidth_ / 2;
+ velocity.x = -velocity.x;
+ velocity.z = distance * distance * sgn(distance) * PongBall::MAX_REL_Z_VELOCITY * this->speed_;
+ this->batsound_->play();
+ }
+ else if (position.x > this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
+ {
+ if (this->getGametype() && this->bat_[0])
+ {
+ this->getGametype()->playerScored(this->bat_[0]->getPlayer());
+ this->scoresound_->play();
+ return;
+ }
+ }
+ }
+ if (position.x < -this->fieldWidth_ / 2 && this->bat_[0])
+ {
+ distance = (position.z - this->bat_[0]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
+ if (fabs(distance) <= 1)
+ {
+ position.x = -this->fieldWidth_ / 2;
+ velocity.x = -velocity.x;
+ velocity.z = distance * distance * sgn(distance) * PongBall::MAX_REL_Z_VELOCITY * this->speed_;
+ this->batsound_->play();
+ }
+ else if (position.x < -this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
+ {
+ if (this->getGametype() && this->bat_[1])
+ {
+ this->scoresound_->play();
+ this->getGametype()->playerScored(this->bat_[1]->getPlayer());
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ if (velocity != this->getVelocity())
+ this->setVelocity(velocity);
+ if (position != this->getPosition())
+ this->setPosition(position);
+ }
+ else
+ {
+ Vector3 position = this->getPosition();
+ Vector3 velocity = this->getVelocity();
+
+ if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2)
+ {
+ velocity.z = -velocity.z;
+ this->sidesound_->play();
+
+ if (position.z > this->fieldHeight_ / 2)
+ position.z = this->fieldHeight_ / 2;
+ if (position.z < -this->fieldHeight_ / 2)
+ position.z = -this->fieldHeight_ / 2;
+ }
+
+ if (position.x > this->fieldWidth_ / 2 || position.x < -this->fieldWidth_ / 2)
+ {
+ float distance = 0;
+
+ if (this->bat_)
+ {
+ if (position.x > this->fieldWidth_ / 2 && this->bat_[1])
+ {
+ distance = (position.z - this->bat_[1]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
+ if (fabs(distance) <= 1)
+ {
+ position.x = this->fieldWidth_ / 2;
+ velocity.x = -velocity.x;
+ this->batsound_->play();
+ velocity.z = distance * distance * sgn(distance) * PongBall::MAX_REL_Z_VELOCITY * this->speed_;
+ }
+ }
+ if (position.x < -this->fieldWidth_ / 2 && this->bat_[0])
+ {
+ distance = (position.z - this->bat_[0]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
+ if (fabs(distance) <= 1)
+ {
+ position.x = -this->fieldWidth_ / 2;
+ velocity.x = -velocity.x;
+ this->batsound_->play();
+ velocity.z = distance * distance * sgn(distance) * PongBall::MAX_REL_Z_VELOCITY * this->speed_;
+ }
+ }
+ }
+ }
+
+ if (velocity != this->getVelocity())
+ this->setVelocity(velocity);
+ if (position != this->getPosition())
+ this->setPosition(position);
+ }
+ }
+
+ void PongBall::setSpeed(float speed)
+ {
+ if (speed != this->speed_)
+ {
+ this->speed_ = speed;
+
+ Vector3 velocity = this->getVelocity();
+ if (velocity.x != 0)
+ velocity.x = sgn(velocity.x) * this->speed_;
+ else
+ velocity.x = this->speed_ * sgn(rnd(-1,1));
+
+ this->setVelocity(velocity);
+ }
+ }
+
+ void PongBall::setBats(PongBat** bats)
+ {
+ this->bat_ = bats;
+ this->batID_[0] = this->bat_[0]->getObjectID();
+ this->batID_[1] = this->bat_[1]->getObjectID();
+ }
+
+ void PongBall::applyBats()
+ {
+ if (!this->bat_)
+ this->bat_ = new PongBat*[2];
+ if (this->batID_[0] != OBJECTID_UNKNOWN)
+ this->bat_[0] = orxonox_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[0]));
+ if (this->batID_[1] != OBJECTID_UNKNOWN)
+ this->bat_[1] = orxonox_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[1]));
+ }
+}
Copied: code/branches/libraries2/src/modules/pong/PongBall.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/worldentities/PongBall.h)
===================================================================
--- code/branches/libraries2/src/modules/pong/PongBall.h (rev 0)
+++ code/branches/libraries2/src/modules/pong/PongBall.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,85 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _PongBall_H__
+#define _PongBall_H__
+
+#include "pong/PongPrereqs.h"
+
+#include "util/Math.h"
+#include "objects/worldentities/MovableEntity.h"
+
+namespace orxonox
+{
+ class _PongExport PongBall : public MovableEntity
+ {
+ public:
+ PongBall(BaseObject* creator);
+ virtual ~PongBall() {}
+
+ virtual void tick(float dt);
+
+ void registerVariables();
+
+ void setFieldDimension(float width, float height)
+ { this->fieldWidth_ = width; this->fieldHeight_ = height; }
+ void setFieldDimension(const Vector2& dimension)
+ { this->setFieldDimension(dimension.x, dimension.y); }
+ Vector2 getFieldDimension() const
+ { return Vector2(this->fieldWidth_, this->fieldHeight_); }
+
+ void setSpeed(float speed);
+ float getSpeed() const
+ { return this->speed_; }
+
+ void setBatLength(float batlength)
+ { this->batlength_ = batlength; }
+ float getBatLength() const
+ { return this->batlength_; }
+
+ void setBats(PongBat** bats);
+ void applyBats();
+
+ static const float MAX_REL_Z_VELOCITY;
+
+ private:
+ float fieldWidth_;
+ float fieldHeight_;
+ float speed_;
+ float batlength_;
+ PongBat** bat_;
+ unsigned int* batID_;
+ float relMercyOffset_;
+
+ SoundBase* sidesound_;
+ SoundBase* batsound_;
+ SoundBase* scoresound_;
+ };
+}
+
+#endif /* _PongBall_H__ */
Copied: code/branches/libraries2/src/modules/pong/PongBat.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/worldentities/PongBat.cc)
===================================================================
--- code/branches/libraries2/src/modules/pong/PongBat.cc (rev 0)
+++ code/branches/libraries2/src/modules/pong/PongBat.cc 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,114 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "PongBat.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ CreateFactory(PongBat);
+
+ PongBat::PongBat(BaseObject* creator) : ControllableEntity(creator)
+ {
+ RegisterObject(PongBat);
+
+ this->movement_ = 0;
+ this->bMoveLocal_ = false;
+ this->speed_ = 60;
+ this->length_ = 0.25;
+ this->fieldHeight_ = 100;
+ this->bSteadiedPosition_ = false;
+
+ this->registerVariables();
+ }
+
+ void PongBat::registerVariables()
+ {
+ registerVariable(this->speed_);
+ registerVariable(this->fieldHeight_);
+ registerVariable(this->length_);
+ }
+
+ void PongBat::tick(float dt)
+ {
+ if (this->hasLocalController())
+ {
+ if (this->movement_ != 0)
+ {
+ this->movement_ = clamp(this->movement_, -1.0f, 1.0f) * this->speed_;
+
+ if (this->bMoveLocal_)
+ this->setVelocity(this->getOrientation() * Vector3(this->movement_, 0, 0));
+ else
+ this->setVelocity(0, 0, this->movement_);
+
+ this->movement_ = 0;
+ this->bSteadiedPosition_ = false;
+ }
+ else if (!this->bSteadiedPosition_)
+ {
+ // To ensure network synchronicity
+ this->setVelocity(0, 0, 0);
+ this->setPosition(this->getPosition());
+ this->bSteadiedPosition_ = true;
+ }
+ }
+
+ SUPER(PongBat, tick, dt);
+
+ Vector3 position = this->getPosition();
+ if (position.z > this->fieldHeight_ / 2 - this->fieldHeight_ * this->length_ / 2)
+ position.z = this->fieldHeight_ / 2 - this->fieldHeight_ * this->length_ / 2;
+ if (position.z < -this->fieldHeight_ / 2 + this->fieldHeight_ * this->length_ / 2)
+ position.z = -this->fieldHeight_ / 2 + this->fieldHeight_ * this->length_ / 2;
+ if (position != this->getPosition())
+ {
+ this->setPosition(position);
+ this->setVelocity( Vector3::ZERO );
+ }
+ }
+
+ void PongBat::moveFrontBack(const Vector2& value)
+ {
+ this->bMoveLocal_ = false;
+ this->movement_ = -value.x;
+ }
+
+ void PongBat::moveRightLeft(const Vector2& value)
+ {
+ this->bMoveLocal_ = true;
+ this->movement_ = value.x;
+ }
+
+ void PongBat::changedPlayer()
+ {
+ this->setVelocity(0, 0, 0);
+ }
+}
Copied: code/branches/libraries2/src/modules/pong/PongBat.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/worldentities/PongBat.h)
===================================================================
--- code/branches/libraries2/src/modules/pong/PongBat.h (rev 0)
+++ code/branches/libraries2/src/modules/pong/PongBat.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,76 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _PongBat_H__
+#define _PongBat_H__
+
+#include "pong/PongPrereqs.h"
+#include "objects/worldentities/ControllableEntity.h"
+
+namespace orxonox
+{
+ class _PongExport PongBat : public ControllableEntity
+ {
+ public:
+ PongBat(BaseObject* creator);
+ virtual ~PongBat() {}
+
+ void registerVariables();
+ virtual void tick(float dt);
+
+ virtual void moveFrontBack(const Vector2& value);
+ virtual void moveRightLeft(const Vector2& value);
+
+ virtual void changedPlayer();
+
+ void setSpeed(float speed)
+ { this->speed_ = speed; }
+ float getSpeed() const
+ { return this->speed_; }
+
+ void setFieldHeight(float height)
+ { this->fieldHeight_ = height; }
+ float getFieldHeight() const
+ { return this->fieldHeight_; }
+
+ void setLength(float length)
+ { this->length_ = length; }
+ float getLength() const
+ { return this->length_; }
+
+ private:
+ float movement_;
+ bool bMoveLocal_;
+ float speed_;
+ float length_;
+ float fieldHeight_;
+ bool bSteadiedPosition_;
+ };
+}
+
+#endif /* _PongBat_H__ */
Copied: code/branches/libraries2/src/modules/pong/PongBot.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/infos/PongBot.cc)
===================================================================
--- code/branches/libraries2/src/modules/pong/PongBot.cc (rev 0)
+++ code/branches/libraries2/src/modules/pong/PongBot.cc 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,45 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "PongBot.h"
+
+#include "core/CoreIncludes.h"
+#include "PongAI.h"
+
+namespace orxonox
+{
+ CreateFactory(PongBot);
+
+ PongBot::PongBot(BaseObject* creator) : Bot(creator)
+ {
+ RegisterObject(PongBot);
+
+ this->defaultController_ = Class(PongAI);
+ this->createController();
+ }
+}
Copied: code/branches/libraries2/src/modules/pong/PongBot.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/infos/PongBot.h)
===================================================================
--- code/branches/libraries2/src/modules/pong/PongBot.h (rev 0)
+++ code/branches/libraries2/src/modules/pong/PongBot.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,45 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _PongBot_H__
+#define _PongBot_H__
+
+#include "pong/PongPrereqs.h"
+#include "objects/infos/Bot.h"
+
+namespace orxonox
+{
+ class _PongExport PongBot : public Bot
+ {
+ public:
+ PongBot(BaseObject* creator);
+ virtual ~PongBot() {}
+ };
+}
+
+#endif /* _PongBot_H__ */
Copied: code/branches/libraries2/src/modules/pong/PongCenterpoint.cc (from rev 5722, code/branches/libraries2/src/orxonox/objects/worldentities/PongCenterpoint.cc)
===================================================================
--- code/branches/libraries2/src/modules/pong/PongCenterpoint.cc (rev 0)
+++ code/branches/libraries2/src/modules/pong/PongCenterpoint.cc 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,79 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "PongCenterpoint.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "Pong.h"
+
+namespace orxonox
+{
+ CreateFactory(PongCenterpoint);
+
+ PongCenterpoint::PongCenterpoint(BaseObject* creator) : StaticEntity(creator)
+ {
+ RegisterObject(PongCenterpoint);
+
+ this->width_ = 200;
+ this->height_ = 120;
+ this->ballspeed_ = 100;
+ this->batspeed_ = 60;
+ this->batlength_ = 0.25;
+
+ this->checkGametype();
+ }
+
+ void PongCenterpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(PongCenterpoint, XMLPort, xmlelement, mode);
+
+ XMLPortParam(PongCenterpoint, "dimension", setFieldDimension, getFieldDimension, xmlelement, mode);
+ XMLPortParam(PongCenterpoint, "balltemplate", setBalltemplate, getBalltemplate, xmlelement, mode);
+ XMLPortParam(PongCenterpoint, "battemplate", setBattemplate, getBattemplate, xmlelement, mode);
+ XMLPortParam(PongCenterpoint, "ballspeed", setBallSpeed, getBallSpeed, xmlelement, mode);
+ XMLPortParam(PongCenterpoint, "batspeed", setBatSpeed, getBatSpeed, xmlelement, mode);
+ XMLPortParam(PongCenterpoint, "batlength", setBatLength, getBatLength, xmlelement, mode);
+ }
+
+ void PongCenterpoint::changedGametype()
+ {
+ SUPER(PongCenterpoint, changedGametype);
+
+ this->checkGametype();
+ }
+
+ void PongCenterpoint::checkGametype()
+ {
+ if (this->getGametype() && this->getGametype()->isA(Class(Pong)))
+ {
+ Pong* pong_gametype = orxonox_cast<Pong*>(this->getGametype());
+ pong_gametype->setCenterpoint(this);
+ }
+ }
+}
Copied: code/branches/libraries2/src/modules/pong/PongCenterpoint.h (from rev 5722, code/branches/libraries2/src/orxonox/objects/worldentities/PongCenterpoint.h)
===================================================================
--- code/branches/libraries2/src/modules/pong/PongCenterpoint.h (rev 0)
+++ code/branches/libraries2/src/modules/pong/PongCenterpoint.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,95 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _PongCenterpoint_H__
+#define _PongCenterpoint_H__
+
+#include "pong/PongPrereqs.h"
+
+#include <string>
+#include <util/Math.h>
+#include "objects/worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+ class _PongExport PongCenterpoint : public StaticEntity
+ {
+ public:
+ PongCenterpoint(BaseObject* creator);
+ virtual ~PongCenterpoint() {}
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ virtual void changedGametype();
+
+ void setBalltemplate(const std::string& balltemplate)
+ { this->balltemplate_ = balltemplate; }
+ const std::string& getBalltemplate() const
+ { return this->balltemplate_; }
+
+ void setBattemplate(const std::string& battemplate)
+ { this->battemplate_ = battemplate; }
+ const std::string& getBattemplate() const
+ { return this->battemplate_; }
+
+ void setFieldDimension(const Vector2& dimension)
+ { this->width_ = dimension.x; this->height_ = dimension.y; }
+ Vector2 getFieldDimension() const
+ { return Vector2(this->width_, this->height_); }
+
+ void setBallSpeed(float ballspeed)
+ { this->ballspeed_ = ballspeed; }
+ float getBallSpeed() const
+ { return this->ballspeed_; }
+
+ void setBatSpeed(float batspeed)
+ { this->batspeed_ = batspeed; }
+ float getBatSpeed() const
+ { return this->batspeed_; }
+
+ void setBatLength(float batlength)
+ { this->batlength_ = batlength; }
+ float getBatLength() const
+ { return this->batlength_; }
+
+ private:
+ void checkGametype();
+
+ std::string balltemplate_;
+ std::string battemplate_;
+
+ float ballspeed_;
+ float batspeed_;
+ float batlength_;
+
+ float width_;
+ float height_;
+ };
+}
+
+#endif /* _PongCenterpoint_H__ */
Added: code/branches/libraries2/src/modules/pong/PongPrereqs.h
===================================================================
--- code/branches/libraries2/src/modules/pong/PongPrereqs.h (rev 0)
+++ code/branches/libraries2/src/modules/pong/PongPrereqs.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,75 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @brief Contains all the necessary forward declarations for all classes and structs.
+*/
+
+#ifndef _PongPrereqs_H__
+#define _PongPrereqs_H__
+
+#include "OrxonoxConfig.h"
+
+#include "pong/PongPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD)
+# ifdef PONG_SHARED_BUILD
+# define _PongExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _PongExport
+# else
+# define _PongExport __declspec(dllimport)
+# endif
+# endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+# define _PongExport __attribute__ ((visibility("default")))
+#else
+# define _PongExport
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+ class Pong;
+ class PongAI;
+ class PongBall;
+ class PongBat;
+ class PongBot;
+ class PongCenterpoint;
+ class PongScore;
+}
+
+#endif /* _PongPrereqs_H__ */
Property changes on: code/branches/libraries2/src/modules/pong/PongPrereqs.h
___________________________________________________________________
Added: svn:eol-style
+ native
Copied: code/branches/libraries2/src/modules/pong/PongScore.cc (from rev 5722, code/branches/libraries2/src/modules/overlays/hud/PongScore.cc)
===================================================================
--- code/branches/libraries2/src/modules/pong/PongScore.cc (rev 0)
+++ code/branches/libraries2/src/modules/pong/PongScore.cc 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,139 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "PongScore.h"
+
+#include "util/Convert.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "Pong.h"
+#include "objects/infos/PlayerInfo.h"
+
+namespace orxonox
+{
+ CreateFactory(PongScore);
+
+ PongScore::PongScore(BaseObject* creator) : OverlayText(creator)
+ {
+ RegisterObject(PongScore);
+
+ this->owner_ = 0;
+
+ this->bShowName_ = false;
+ this->bShowScore_ = false;
+ this->bShowLeftPlayer_ = false;
+ this->bShowRightPlayer_ = false;
+ }
+
+ PongScore::~PongScore()
+ {
+ }
+
+ void PongScore::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(PongScore, XMLPort, xmlelement, mode);
+
+ XMLPortParam(PongScore, "showname", setShowName, getShowName, xmlelement, mode).defaultValues(false);
+ XMLPortParam(PongScore, "showscore", setShowScore, getShowScore, xmlelement, mode).defaultValues(false);
+ XMLPortParam(PongScore, "showleftplayer", setShowLeftPlayer, getShowLeftPlayer, xmlelement, mode).defaultValues(false);
+ XMLPortParam(PongScore, "showrightplayer", setShowRightPlayer, getShowRightPlayer, xmlelement, mode).defaultValues(false);
+ }
+
+ void PongScore::tick(float dt)
+ {
+ SUPER(PongScore, tick, dt);
+
+ if (this->owner_)
+ {
+ PlayerInfo* player1 = this->owner_->getLeftPlayer();
+ PlayerInfo* player2 = this->owner_->getRightPlayer();
+
+ std::string name1;
+ std::string name2;
+
+ std::string score1 = "0";
+ std::string score2 = "0";
+
+ if (player1)
+ {
+ name1 = player1->getName();
+ score1 = multi_cast<std::string>(this->owner_->getScore(player1));
+ }
+
+ if (player2)
+ {
+ name2 = player2->getName();
+ score2 = multi_cast<std::string>(this->owner_->getScore(player2));
+ }
+
+ std::string output1;
+ if (this->bShowLeftPlayer_)
+ {
+ if (this->bShowName_ && this->bShowScore_ && player1)
+ output1 = name1 + " - " + score1;
+ else if (this->bShowScore_)
+ output1 = score1;
+ else if (this->bShowName_)
+ output1 = name1;
+ }
+
+ std::string output2;
+ if (this->bShowRightPlayer_)
+ {
+ if (this->bShowName_ && this->bShowScore_ && player2)
+ output2 = score2 + " - " + name2;
+ else if (this->bShowScore_)
+ output2 = score2;
+ else if (this->bShowName_)
+ output2 = name2;
+ }
+
+ std::string output = "PONG";
+ if (this->bShowName_ || this->bShowScore_)
+ {
+ if (this->bShowLeftPlayer_ && this->bShowRightPlayer_)
+ output = output1 + ":" + output2;
+ else if (this->bShowLeftPlayer_ || this->bShowRightPlayer_)
+ output = output1 + output2;
+ }
+
+ this->setCaption(output);
+ }
+ }
+
+
+ void PongScore::changedOwner()
+ {
+ SUPER(PongScore, changedOwner);
+
+ if (this->getOwner() && this->getOwner()->getGametype())
+ this->owner_ = orxonox_cast<Pong*>(this->getOwner()->getGametype());
+ else
+ this->owner_ = 0;
+ }
+}
Copied: code/branches/libraries2/src/modules/pong/PongScore.h (from rev 5722, code/branches/libraries2/src/modules/overlays/hud/PongScore.h)
===================================================================
--- code/branches/libraries2/src/modules/pong/PongScore.h (rev 0)
+++ code/branches/libraries2/src/modules/pong/PongScore.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -0,0 +1,77 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _PongScore_H__
+#define _PongScore_H__
+
+#include "pong/PongPrereqs.h"
+
+#include "tools/interfaces/Tickable.h"
+#include "overlays/OverlayText.h"
+
+namespace orxonox
+{
+ class _PongExport PongScore : public OverlayText, public Tickable
+ {
+ public:
+ PongScore(BaseObject* creator);
+ virtual ~PongScore();
+
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void changedOwner();
+
+ inline void setShowName(bool value)
+ { this->bShowName_ = value; }
+ inline bool getShowName() const
+ { return this->bShowName_; }
+
+ inline void setShowScore(bool value)
+ { this->bShowScore_ = value; }
+ inline bool getShowScore() const
+ { return this->bShowScore_; }
+
+ inline void setShowLeftPlayer(bool value)
+ { this->bShowLeftPlayer_ = value; }
+ inline bool getShowLeftPlayer() const
+ { return this->bShowLeftPlayer_; }
+
+ inline void setShowRightPlayer(bool value)
+ { this->bShowRightPlayer_ = value; }
+ inline bool getShowRightPlayer() const
+ { return this->bShowRightPlayer_; }
+
+ private:
+ Pong* owner_;
+ bool bShowName_;
+ bool bShowScore_;
+ bool bShowLeftPlayer_;
+ bool bShowRightPlayer_;
+ };
+}
+#endif /* _PongScore_H__ */
Modified: code/branches/libraries2/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/libraries2/src/orxonox/OrxonoxPrereqs.h 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/OrxonoxPrereqs.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -105,10 +105,6 @@
class Camera;
// mixed
- class PongCenterpoint;
- class PongBall;
- class PongBat;
-
class EventListener;
class EventDispatcher;
class EventTarget;
@@ -138,7 +134,6 @@
class Asteroids;
class TeamBaseMatch;
class UnderAttack;
- class Pong;
// pickups
class BaseItem;
@@ -186,14 +181,12 @@
class ScriptController;
class WaypointController;
class WaypointPatrolController;
- class PongAI;
// infos
class Info;
class PlayerInfo;
class HumanPlayer;
class Bot;
- class PongBot;
class GametypeInfo;
// collision
Modified: code/branches/libraries2/src/orxonox/objects/controllers/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/orxonox/objects/controllers/CMakeLists.txt 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/controllers/CMakeLists.txt 2009-08-31 18:23:07 UTC (rev 5725)
@@ -6,5 +6,4 @@
ScriptController.cc
WaypointController.cc
WaypointPatrolController.cc
- PongAI.cc
)
Deleted: code/branches/libraries2/src/orxonox/objects/controllers/PongAI.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/controllers/PongAI.cc 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/controllers/PongAI.cc 2009-08-31 18:23:07 UTC (rev 5725)
@@ -1,253 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "PongAI.h"
-
-#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
-#include "tools/Timer.h"
-#include "objects/worldentities/ControllableEntity.h"
-#include "objects/worldentities/PongBall.h"
-
-namespace orxonox
-{
- CreateUnloadableFactory(PongAI);
-
- const static float MAX_REACTION_TIME = 0.4f;
-
- PongAI::PongAI(BaseObject* creator) : Controller(creator)
- {
- RegisterObject(PongAI);
-
- this->ball_ = 0;
- this->ballDirection_ = Vector2::ZERO;
- this->ballEndPosition_ = 0;
- this->randomOffset_ = 0;
- this->relHysteresisOffset_ = 0.02f;
- this->strength_ = 0.5f;
- this->movement_ = 0;
- this->oldMove_ = 0;
- this->bOscillationAvoidanceActive_ = false;
-
- this->setConfigValues();
- }
-
- PongAI::~PongAI()
- {
- for (std::list<std::pair<Timer<PongAI>*, char> >::iterator it = this->reactionTimers_.begin(); it != this->reactionTimers_.end(); ++it)
- delete (*it).first;
- }
-
- void PongAI::setConfigValues()
- {
- SetConfigValue(strength_, 0.5).description("A value from 0 to 1 where 0 is weak and 1 is strong.");
- }
-
- void PongAI::tick(float dt)
- {
- if (!this->ball_ || !this->getControllableEntity())
- return;
-
- Vector3 mypos = this->getControllableEntity()->getPosition();
- Vector3 ballpos = this->ball_->getPosition();
- Vector3 ballvel = this->ball_->getVelocity();
- float hysteresisOffset = this->relHysteresisOffset_ * this->ball_->getFieldDimension().y;
-
- char move = 0;
- bool delay = false;
-
- // Check in which direction the ball is flying
- if ((mypos.x > 0 && ballvel.x < 0) || (mypos.x < 0 && ballvel.x > 0))
- {
- // The ball is flying away
- this->ballDirection_.x = -1;
- this->ballDirection_.y = 0;
- this->bOscillationAvoidanceActive_ = false;
-
- // Move to the middle
- if (mypos.z > hysteresisOffset)
- move = 1;
- else if (mypos.z < -hysteresisOffset)
- move = -1;
- }
- else if (ballvel.x == 0)
- {
- // The ball is standing still
- this->ballDirection_.x = 0;
- this->ballDirection_.y = 0;
- this->bOscillationAvoidanceActive_ = false;
- }
- else
- {
- // The ball is approaching
- if (this->ballDirection_.x != 1)
- {
- // The ball just startet to approach, initialize all values
- this->ballDirection_.x = 1;
- this->ballDirection_.y = sgn(ballvel.z);
- this->ballEndPosition_ = 0;
- this->randomOffset_ = 0;
-
- this->calculateRandomOffset();
- this->calculateBallEndPosition();
- delay = true;
- this->bOscillationAvoidanceActive_ = false;
- }
-
- if (this->ballDirection_.y != sgn(ballvel.z))
- {
- // The ball just bounced from a bound, recalculate the predicted end position
- this->ballDirection_.y = sgn(ballvel.z);
-
- this->calculateBallEndPosition();
- delay = true;
- this->bOscillationAvoidanceActive_ = false;
- }
-
- // Move to the predicted end position with an additional offset (to hit the ball with the side of the bat)
- if (!this->bOscillationAvoidanceActive_)
- {
- float desiredZValue = this->ballEndPosition_ + this->randomOffset_;
-
- if (mypos.z > desiredZValue + hysteresisOffset * (this->randomOffset_ < 0))
- move = 1;
- else if (mypos.z < desiredZValue - hysteresisOffset * (this->randomOffset_ > 0))
- move = -1;
- }
-
- if (move != 0 && this->oldMove_ != 0 && move != this->oldMove_ && !delay)
- {
- // We had to correct our position because we moved too far
- // (and delay ist false, so we're not in the wrong place because of a new end-position prediction)
- if (fabs(mypos.z - this->ballEndPosition_) < 0.5 * this->ball_->getBatLength() * this->ball_->getFieldDimension().y)
- {
- // We're not at the right position, but we still hit the ball, so just stay there to avoid oscillation
- move = 0;
- this->bOscillationAvoidanceActive_ = true;
- }
- }
- }
-
- this->oldMove_ = move;
- this->move(move, delay);
- this->getControllableEntity()->moveFrontBack(this->movement_);
- }
-
- void PongAI::calculateRandomOffset()
- {
- // Calculate the exponent for the position-formula
- float exp = pow(10, 1 - 2*this->strength_); // strength: 0 -> exp = 10
- // strength: 0.5 -> exp = 1
- // strength: 1 -> exp = 0.1
-
- // Calculate the relative position where to hit the ball with the bat
- float position = pow(rnd(), exp); // exp > 1 -> position is more likely a small number
- // exp < 1 -> position is more likely a large number
-
- // The position shouln't be larger than 0.5 (50% of the bat-length from the middle is the end)
- position *= 0.48f;
-
- // Both sides are equally probable
- position *= rndsgn();
-
- // Calculate the offset in world units
- this->randomOffset_ = position * this->ball_->getBatLength() * this->ball_->getFieldDimension().y;
- }
-
- void PongAI::calculateBallEndPosition()
- {
- Vector3 position = this->ball_->getPosition();
- Vector3 velocity = this->ball_->getVelocity();
- Vector2 dimension = this->ball_->getFieldDimension();
-
- // calculate end-height: current height + slope * distance
- this->ballEndPosition_ = position.z + velocity.z / velocity.x * (-position.x + dimension.x / 2 * sgn(velocity.x));
-
- // Calculate bounces
- for (float limit = 0.35f; limit < this->strength_ || this->strength_ > 0.99f; limit += 0.4f)
- {
- // Calculate a random prediction error, based on the vertical speed of the ball and the strength of the AI
- float randomError = rnd(-1, 1) * dimension.y * (velocity.z / velocity.x / PongBall::MAX_REL_Z_VELOCITY) * (1 - this->strength_);
-
- // Bounce from the lower bound
- if (this->ballEndPosition_ > dimension.y / 2)
- {
- // Mirror the predicted position at the upper bound and add some random error
- this->ballEndPosition_ = dimension.y - this->ballEndPosition_ + randomError;
- continue;
- }
- // Bounce from the upper bound
- if (this->ballEndPosition_ < -dimension.y / 2)
- {
- // Mirror the predicted position at the lower bound and add some random error
- this->ballEndPosition_ = -dimension.y - this->ballEndPosition_ + randomError;
- continue;
- }
- // No bounce - break
- break;
- }
- }
-
- void PongAI::move(char direction, bool bUseDelay)
- {
- // The current direction is either what we're doing right now (movement_) or what is last in the queue
- char currentDirection = this->movement_;
- if (this->reactionTimers_.size() > 0)
- currentDirection = this->reactionTimers_.back().second;
-
- // Only add changes of direction
- if (direction == currentDirection)
- return;
-
- if (bUseDelay)
- {
- // Calculate delay
- float delay = MAX_REACTION_TIME * (1 - this->strength_);
-
- // Add a new Timer
- Timer<PongAI>* timer = new Timer<PongAI>(delay, false, this, createExecutor(createFunctor(&PongAI::delayedMove)));
- this->reactionTimers_.push_back(std::pair<Timer<PongAI>*, char>(timer, direction));
- }
- else
- {
- this->movement_ = direction;
- }
- }
-
- void PongAI::delayedMove()
- {
- // Get the new movement direction from the timer list
- this->movement_ = this->reactionTimers_.front().second;
-
- // Destroy the timer and remove it from the list
- Timer<PongAI>* timer = this->reactionTimers_.front().first;
- delete timer;
-
- this->reactionTimers_.pop_front();
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/controllers/PongAI.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/controllers/PongAI.h 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/controllers/PongAI.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -1,74 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _PongAI_H__
-#define _PongAI_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <list>
-#include "util/Math.h"
-#include "tools/interfaces/Tickable.h"
-#include "Controller.h"
-
-namespace orxonox
-{
- class _OrxonoxExport PongAI : public Controller, public Tickable
- {
- public:
- PongAI(BaseObject* creator);
- virtual ~PongAI();
-
- void setConfigValues();
-
- virtual void tick(float dt);
-
- void setPongBall(PongBall* ball)
- { this->ball_ = ball; }
-
- protected:
- void calculateRandomOffset();
- void calculateBallEndPosition();
- void move(char direction, bool bUseDelay);
- void delayedMove();
-
- PongBall* ball_;
- Vector2 ballDirection_;
- float ballEndPosition_;
- float randomOffset_;
- float relHysteresisOffset_;
- float strength_;
-
- std::list<std::pair<Timer<PongAI>*, char> > reactionTimers_;
- char movement_;
- char oldMove_;
- bool bOscillationAvoidanceActive_;
- };
-}
-
-#endif /* _PongAI_H__ */
Modified: code/branches/libraries2/src/orxonox/objects/gametypes/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/orxonox/objects/gametypes/CMakeLists.txt 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/gametypes/CMakeLists.txt 2009-08-31 18:23:07 UTC (rev 5725)
@@ -3,7 +3,6 @@
Deathmatch.cc
TeamDeathmatch.cc
TeamBaseMatch.cc
- Pong.cc
UnderAttack.cc
Asteroids.cc
)
Deleted: code/branches/libraries2/src/orxonox/objects/gametypes/Pong.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/gametypes/Pong.cc 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/gametypes/Pong.cc 2009-08-31 18:23:07 UTC (rev 5725)
@@ -1,200 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "Pong.h"
-
-#include "core/CoreIncludes.h"
-#include "core/Executor.h"
-#include "objects/worldentities/PongCenterpoint.h"
-#include "objects/worldentities/PongBall.h"
-#include "objects/worldentities/PongBat.h"
-#include "objects/infos/PongBot.h"
-#include "objects/controllers/PongAI.h"
-
-namespace orxonox
-{
- CreateUnloadableFactory(Pong);
-
- Pong::Pong(BaseObject* creator) : Deathmatch(creator)
- {
- RegisterObject(Pong);
-
- this->center_ = 0;
- this->ball_ = 0;
- this->bat_[0] = 0;
- this->bat_[1] = 0;
-
- this->setHUDTemplate("PongHUD");
-
- this->starttimer_.setTimer(1.0, false, this, createExecutor(createFunctor(&Pong::startBall)));
- this->starttimer_.stopTimer();
-
- this->botclass_ = Class(PongBot);
- }
-
- void Pong::start()
- {
- if (this->center_)
- {
- if (!this->ball_)
- {
- this->ball_ = new PongBall(this->center_);
- this->ball_->addTemplate(this->center_->getBalltemplate());
- }
-
- this->center_->attach(this->ball_);
- this->ball_->setPosition(0, 0, 0);
- this->ball_->setFieldDimension(this->center_->getFieldDimension());
- this->ball_->setSpeed(0);
- this->ball_->setBatLength(this->center_->getBatLength());
-
- if (!this->bat_[0])
- {
- this->bat_[0] = new PongBat(this->center_);
- this->bat_[0]->addTemplate(this->center_->getBattemplate());
- }
- if (!this->bat_[1])
- {
- this->bat_[1] = new PongBat(this->center_);
- this->bat_[1]->addTemplate(this->center_->getBattemplate());
- }
-
- this->center_->attach(this->bat_[0]);
- this->center_->attach(this->bat_[1]);
- this->bat_[0]->setPosition(-this->center_->getFieldDimension().x / 2, 0, 0);
- this->bat_[1]->setPosition( this->center_->getFieldDimension().x / 2, 0, 0);
- this->bat_[0]->yaw(Degree(-90));
- this->bat_[1]->yaw(Degree(90));
- this->bat_[0]->setSpeed(this->center_->getBatSpeed());
- this->bat_[1]->setSpeed(this->center_->getBatSpeed());
- this->bat_[0]->setFieldHeight(this->center_->getFieldDimension().y);
- this->bat_[1]->setFieldHeight(this->center_->getFieldDimension().y);
- this->bat_[0]->setLength(this->center_->getBatLength());
- this->bat_[1]->setLength(this->center_->getBatLength());
-
- this->ball_->setBats(this->bat_);
- }
- else
- {
- COUT(1) << "Error: No Centerpoint specified." << std::endl;
- }
-
- this->starttimer_.startTimer();
-
-
- bool temp = this->bForceSpawn_;
- this->bForceSpawn_ = true;
-
- Deathmatch::start();
-
- this->bForceSpawn_ = temp;
- }
-
- void Pong::end()
- {
- if (this->ball_)
- {
- delete this->ball_;
- this->ball_ = 0;
- }
-
- Deathmatch::end();
- }
-
- void Pong::spawnPlayer(PlayerInfo* player)
- {
- if (!this->bat_[0]->getPlayer())
- {
- player->startControl(this->bat_[0]);
- this->players_[player].state_ = PlayerState::Alive;
- }
- else if (!this->bat_[1]->getPlayer())
- {
- player->startControl(this->bat_[1]);
- this->players_[player].state_ = PlayerState::Alive;
- }
- else
- return;
-
- if (player && player->getController() && player->getController()->isA(Class(PongAI)))
- {
- PongAI* ai = orxonox_cast<PongAI*>(player->getController());
- ai->setPongBall(this->ball_);
- }
- }
-
- void Pong::playerScored(PlayerInfo* player)
- {
- Deathmatch::playerScored(player);
-
- if (this->center_)
- {
- this->center_->fireEvent();
-
- if (player)
- this->gtinfo_.sendAnnounceMessage(player->getName() + " scored");
- }
-
- if (this->ball_)
- {
- this->ball_->setPosition(Vector3::ZERO);
- this->ball_->setVelocity(Vector3::ZERO);
- this->ball_->setSpeed(0);
- }
-
- if (this->bat_[0] && this->bat_[1])
- {
- this->bat_[0]->setPosition(-this->center_->getFieldDimension().x / 2, 0, 0);
- this->bat_[1]->setPosition( this->center_->getFieldDimension().x / 2, 0, 0);
- }
-
- this->starttimer_.startTimer();
- }
-
- void Pong::startBall()
- {
- if (this->ball_ && this->center_)
- this->ball_->setSpeed(this->center_->getBallSpeed());
- }
-
- PlayerInfo* Pong::getLeftPlayer() const
- {
- if (this->bat_ && this->bat_[0])
- return this->bat_[0]->getPlayer();
- else
- return 0;
- }
-
- PlayerInfo* Pong::getRightPlayer() const
- {
- if (this->bat_ && this->bat_[1])
- return this->bat_[1]->getPlayer();
- else
- return 0;
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/gametypes/Pong.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/gametypes/Pong.h 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/gametypes/Pong.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -1,68 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _Pong_H__
-#define _Pong_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "tools/Timer.h"
-#include "Deathmatch.h"
-
-namespace orxonox
-{
- class _OrxonoxExport Pong : public Deathmatch
- {
- public:
- Pong(BaseObject* creator);
- virtual ~Pong() {}
-
- virtual void start();
- virtual void end();
-
- virtual void spawnPlayer(PlayerInfo* player);
-
- virtual void playerScored(PlayerInfo* player);
-
- void setCenterpoint(PongCenterpoint* center)
- { this->center_ = center; }
-
- PlayerInfo* getLeftPlayer() const;
- PlayerInfo* getRightPlayer() const;
-
- protected:
- void startBall();
-
- PongCenterpoint* center_;
- PongBall* ball_;
- PongBat* bat_[2];
- Timer<Pong> starttimer_;
- };
-}
-
-#endif /* _Pong_H__ */
Modified: code/branches/libraries2/src/orxonox/objects/infos/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/orxonox/objects/infos/CMakeLists.txt 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/infos/CMakeLists.txt 2009-08-31 18:23:07 UTC (rev 5725)
@@ -1,6 +1,5 @@
ADD_SOURCE_FILES(ORXONOX_SRC_FILES
Bot.cc
- PongBot.cc
Info.cc
PlayerInfo.cc
HumanPlayer.cc
Deleted: code/branches/libraries2/src/orxonox/objects/infos/PongBot.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/infos/PongBot.cc 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/infos/PongBot.cc 2009-08-31 18:23:07 UTC (rev 5725)
@@ -1,45 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "PongBot.h"
-
-#include "core/CoreIncludes.h"
-#include "objects/controllers/PongAI.h"
-
-namespace orxonox
-{
- CreateFactory(PongBot);
-
- PongBot::PongBot(BaseObject* creator) : Bot(creator)
- {
- RegisterObject(PongBot);
-
- this->defaultController_ = Class(PongAI);
- this->createController();
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/infos/PongBot.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/infos/PongBot.h 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/infos/PongBot.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -1,45 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _PongBot_H__
-#define _PongBot_H__
-
-#include "OrxonoxPrereqs.h"
-#include "Bot.h"
-
-namespace orxonox
-{
- class _OrxonoxExport PongBot : public Bot
- {
- public:
- PongBot(BaseObject* creator);
- virtual ~PongBot() {}
- };
-}
-
-#endif /* _PongBot_H__ */
Modified: code/branches/libraries2/src/orxonox/objects/worldentities/CMakeLists.txt
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/CMakeLists.txt 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/worldentities/CMakeLists.txt 2009-08-31 18:23:07 UTC (rev 5725)
@@ -21,9 +21,6 @@
Planet.cc
SpawnPoint.cc
TeamSpawnPoint.cc
- PongCenterpoint.cc
- PongBall.cc
- PongBat.cc
ForceField.cc
)
Deleted: code/branches/libraries2/src/orxonox/objects/worldentities/PongBall.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/PongBall.cc 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/worldentities/PongBall.cc 2009-08-31 18:23:07 UTC (rev 5725)
@@ -1,237 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "PongBall.h"
-
-#include "core/CoreIncludes.h"
-#include "core/GameMode.h"
-#include "objects/gametypes/Gametype.h"
-#include "objects/worldentities/PongBat.h"
-#include "sound/SoundBase.h"
-
-namespace orxonox
-{
- CreateFactory(PongBall);
-
- const float PongBall::MAX_REL_Z_VELOCITY = 1.5;
-
- PongBall::PongBall(BaseObject* creator) : MovableEntity(creator)
- {
- RegisterObject(PongBall);
-
- this->speed_ = 0;
- this->bat_ = 0;
- this->batID_ = new unsigned int[2];
- this->batID_[0] = OBJECTID_UNKNOWN;
- this->batID_[1] = OBJECTID_UNKNOWN;
- this->relMercyOffset_ = 0.05f;
-
- this->registerVariables();
-
- this->sidesound_ = new SoundBase(this);
- this->sidesound_->loadFile("sounds/pong_side.wav");
-
- this->batsound_ = new SoundBase(this);
- this->batsound_->loadFile("sounds/pong_bat.wav");
-
- this->scoresound_ = new SoundBase(this);
- this->scoresound_->loadFile("sounds/pong_score.wav");
- }
-
- void PongBall::registerVariables()
- {
- registerVariable( this->fieldWidth_ );
- registerVariable( this->fieldHeight_ );
- registerVariable( this->batlength_ );
- registerVariable( this->speed_ );
- registerVariable( this->relMercyOffset_ );
- registerVariable( this->batID_[0] );
- registerVariable( this->batID_[1], VariableDirection::ToClient, new NetworkCallback<PongBall>( this, &PongBall::applyBats) );
- }
-
- void PongBall::tick(float dt)
- {
- SUPER(PongBall, tick, dt);
-
- if (GameMode::isMaster())
- {
- Vector3 position = this->getPosition();
- Vector3 velocity = this->getVelocity();
-
- if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2)
- {
- velocity.z = -velocity.z;
- this->sidesound_->play();
-
- if (position.z > this->fieldHeight_ / 2)
- position.z = this->fieldHeight_ / 2;
- if (position.z < -this->fieldHeight_ / 2)
- position.z = -this->fieldHeight_ / 2;
- }
-
- if (position.x > this->fieldWidth_ / 2 || position.x < -this->fieldWidth_ / 2)
- {
- float distance = 0;
-
- if (this->bat_)
- {
- if (position.x > this->fieldWidth_ / 2 && this->bat_[1])
- {
- distance = (position.z - this->bat_[1]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
- if (fabs(distance) <= 1)
- {
- position.x = this->fieldWidth_ / 2;
- velocity.x = -velocity.x;
- velocity.z = distance * distance * sgn(distance) * PongBall::MAX_REL_Z_VELOCITY * this->speed_;
- this->batsound_->play();
- }
- else if (position.x > this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
- {
- if (this->getGametype() && this->bat_[0])
- {
- this->getGametype()->playerScored(this->bat_[0]->getPlayer());
- this->scoresound_->play();
- return;
- }
- }
- }
- if (position.x < -this->fieldWidth_ / 2 && this->bat_[0])
- {
- distance = (position.z - this->bat_[0]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
- if (fabs(distance) <= 1)
- {
- position.x = -this->fieldWidth_ / 2;
- velocity.x = -velocity.x;
- velocity.z = distance * distance * sgn(distance) * PongBall::MAX_REL_Z_VELOCITY * this->speed_;
- this->batsound_->play();
- }
- else if (position.x < -this->fieldWidth_ / 2 * (1 + this->relMercyOffset_))
- {
- if (this->getGametype() && this->bat_[1])
- {
- this->scoresound_->play();
- this->getGametype()->playerScored(this->bat_[1]->getPlayer());
- return;
- }
- }
- }
- }
- }
-
- if (velocity != this->getVelocity())
- this->setVelocity(velocity);
- if (position != this->getPosition())
- this->setPosition(position);
- }
- else
- {
- Vector3 position = this->getPosition();
- Vector3 velocity = this->getVelocity();
-
- if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2)
- {
- velocity.z = -velocity.z;
- this->sidesound_->play();
-
- if (position.z > this->fieldHeight_ / 2)
- position.z = this->fieldHeight_ / 2;
- if (position.z < -this->fieldHeight_ / 2)
- position.z = -this->fieldHeight_ / 2;
- }
-
- if (position.x > this->fieldWidth_ / 2 || position.x < -this->fieldWidth_ / 2)
- {
- float distance = 0;
-
- if (this->bat_)
- {
- if (position.x > this->fieldWidth_ / 2 && this->bat_[1])
- {
- distance = (position.z - this->bat_[1]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
- if (fabs(distance) <= 1)
- {
- position.x = this->fieldWidth_ / 2;
- velocity.x = -velocity.x;
- this->batsound_->play();
- velocity.z = distance * distance * sgn(distance) * PongBall::MAX_REL_Z_VELOCITY * this->speed_;
- }
- }
- if (position.x < -this->fieldWidth_ / 2 && this->bat_[0])
- {
- distance = (position.z - this->bat_[0]->getPosition().z) / (this->fieldHeight_ * (this->batlength_ * 1.10f) / 2);
- if (fabs(distance) <= 1)
- {
- position.x = -this->fieldWidth_ / 2;
- velocity.x = -velocity.x;
- this->batsound_->play();
- velocity.z = distance * distance * sgn(distance) * PongBall::MAX_REL_Z_VELOCITY * this->speed_;
- }
- }
- }
- }
-
- if (velocity != this->getVelocity())
- this->setVelocity(velocity);
- if (position != this->getPosition())
- this->setPosition(position);
- }
- }
-
- void PongBall::setSpeed(float speed)
- {
- if (speed != this->speed_)
- {
- this->speed_ = speed;
-
- Vector3 velocity = this->getVelocity();
- if (velocity.x != 0)
- velocity.x = sgn(velocity.x) * this->speed_;
- else
- velocity.x = this->speed_ * sgn(rnd(-1,1));
-
- this->setVelocity(velocity);
- }
- }
-
- void PongBall::setBats(PongBat** bats)
- {
- this->bat_ = bats;
- this->batID_[0] = this->bat_[0]->getObjectID();
- this->batID_[1] = this->bat_[1]->getObjectID();
- }
-
- void PongBall::applyBats()
- {
- if (!this->bat_)
- this->bat_ = new PongBat*[2];
- if (this->batID_[0] != OBJECTID_UNKNOWN)
- this->bat_[0] = orxonox_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[0]));
- if (this->batID_[1] != OBJECTID_UNKNOWN)
- this->bat_[1] = orxonox_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[1]));
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/worldentities/PongBall.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/PongBall.h 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/worldentities/PongBall.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -1,85 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _PongBall_H__
-#define _PongBall_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "util/Math.h"
-#include "objects/worldentities/MovableEntity.h"
-
-namespace orxonox
-{
- class _OrxonoxExport PongBall : public MovableEntity
- {
- public:
- PongBall(BaseObject* creator);
- virtual ~PongBall() {}
-
- virtual void tick(float dt);
-
- void registerVariables();
-
- void setFieldDimension(float width, float height)
- { this->fieldWidth_ = width; this->fieldHeight_ = height; }
- void setFieldDimension(const Vector2& dimension)
- { this->setFieldDimension(dimension.x, dimension.y); }
- Vector2 getFieldDimension() const
- { return Vector2(this->fieldWidth_, this->fieldHeight_); }
-
- void setSpeed(float speed);
- float getSpeed() const
- { return this->speed_; }
-
- void setBatLength(float batlength)
- { this->batlength_ = batlength; }
- float getBatLength() const
- { return this->batlength_; }
-
- void setBats(PongBat** bats);
- void applyBats();
-
- static const float MAX_REL_Z_VELOCITY;
-
- private:
- float fieldWidth_;
- float fieldHeight_;
- float speed_;
- float batlength_;
- PongBat** bat_;
- unsigned int* batID_;
- float relMercyOffset_;
-
- SoundBase* sidesound_;
- SoundBase* batsound_;
- SoundBase* scoresound_;
- };
-}
-
-#endif /* _PongBall_H__ */
Deleted: code/branches/libraries2/src/orxonox/objects/worldentities/PongBat.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/PongBat.cc 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/worldentities/PongBat.cc 2009-08-31 18:23:07 UTC (rev 5725)
@@ -1,114 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "PongBat.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-namespace orxonox
-{
- CreateFactory(PongBat);
-
- PongBat::PongBat(BaseObject* creator) : ControllableEntity(creator)
- {
- RegisterObject(PongBat);
-
- this->movement_ = 0;
- this->bMoveLocal_ = false;
- this->speed_ = 60;
- this->length_ = 0.25;
- this->fieldHeight_ = 100;
- this->bSteadiedPosition_ = false;
-
- this->registerVariables();
- }
-
- void PongBat::registerVariables()
- {
- registerVariable(this->speed_);
- registerVariable(this->fieldHeight_);
- registerVariable(this->length_);
- }
-
- void PongBat::tick(float dt)
- {
- if (this->hasLocalController())
- {
- if (this->movement_ != 0)
- {
- this->movement_ = clamp(this->movement_, -1.0f, 1.0f) * this->speed_;
-
- if (this->bMoveLocal_)
- this->setVelocity(this->getOrientation() * Vector3(this->movement_, 0, 0));
- else
- this->setVelocity(0, 0, this->movement_);
-
- this->movement_ = 0;
- this->bSteadiedPosition_ = false;
- }
- else if (!this->bSteadiedPosition_)
- {
- // To ensure network synchronicity
- this->setVelocity(0, 0, 0);
- this->setPosition(this->getPosition());
- this->bSteadiedPosition_ = true;
- }
- }
-
- SUPER(PongBat, tick, dt);
-
- Vector3 position = this->getPosition();
- if (position.z > this->fieldHeight_ / 2 - this->fieldHeight_ * this->length_ / 2)
- position.z = this->fieldHeight_ / 2 - this->fieldHeight_ * this->length_ / 2;
- if (position.z < -this->fieldHeight_ / 2 + this->fieldHeight_ * this->length_ / 2)
- position.z = -this->fieldHeight_ / 2 + this->fieldHeight_ * this->length_ / 2;
- if (position != this->getPosition())
- {
- this->setPosition(position);
- this->setVelocity( Vector3::ZERO );
- }
- }
-
- void PongBat::moveFrontBack(const Vector2& value)
- {
- this->bMoveLocal_ = false;
- this->movement_ = -value.x;
- }
-
- void PongBat::moveRightLeft(const Vector2& value)
- {
- this->bMoveLocal_ = true;
- this->movement_ = value.x;
- }
-
- void PongBat::changedPlayer()
- {
- this->setVelocity(0, 0, 0);
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/worldentities/PongBat.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/PongBat.h 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/worldentities/PongBat.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -1,76 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _PongBat_H__
-#define _PongBat_H__
-
-#include "OrxonoxPrereqs.h"
-#include "objects/worldentities/ControllableEntity.h"
-
-namespace orxonox
-{
- class _OrxonoxExport PongBat : public ControllableEntity
- {
- public:
- PongBat(BaseObject* creator);
- virtual ~PongBat() {}
-
- void registerVariables();
- virtual void tick(float dt);
-
- virtual void moveFrontBack(const Vector2& value);
- virtual void moveRightLeft(const Vector2& value);
-
- virtual void changedPlayer();
-
- void setSpeed(float speed)
- { this->speed_ = speed; }
- float getSpeed() const
- { return this->speed_; }
-
- void setFieldHeight(float height)
- { this->fieldHeight_ = height; }
- float getFieldHeight() const
- { return this->fieldHeight_; }
-
- void setLength(float length)
- { this->length_ = length; }
- float getLength() const
- { return this->length_; }
-
- private:
- float movement_;
- bool bMoveLocal_;
- float speed_;
- float length_;
- float fieldHeight_;
- bool bSteadiedPosition_;
- };
-}
-
-#endif /* _PongBat_H__ */
Deleted: code/branches/libraries2/src/orxonox/objects/worldentities/PongCenterpoint.cc
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/PongCenterpoint.cc 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/worldentities/PongCenterpoint.cc 2009-08-31 18:23:07 UTC (rev 5725)
@@ -1,79 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "PongCenterpoint.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "objects/gametypes/Pong.h"
-
-namespace orxonox
-{
- CreateFactory(PongCenterpoint);
-
- PongCenterpoint::PongCenterpoint(BaseObject* creator) : StaticEntity(creator)
- {
- RegisterObject(PongCenterpoint);
-
- this->width_ = 200;
- this->height_ = 120;
- this->ballspeed_ = 100;
- this->batspeed_ = 60;
- this->batlength_ = 0.25;
-
- this->checkGametype();
- }
-
- void PongCenterpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(PongCenterpoint, XMLPort, xmlelement, mode);
-
- XMLPortParam(PongCenterpoint, "dimension", setFieldDimension, getFieldDimension, xmlelement, mode);
- XMLPortParam(PongCenterpoint, "balltemplate", setBalltemplate, getBalltemplate, xmlelement, mode);
- XMLPortParam(PongCenterpoint, "battemplate", setBattemplate, getBattemplate, xmlelement, mode);
- XMLPortParam(PongCenterpoint, "ballspeed", setBallSpeed, getBallSpeed, xmlelement, mode);
- XMLPortParam(PongCenterpoint, "batspeed", setBatSpeed, getBatSpeed, xmlelement, mode);
- XMLPortParam(PongCenterpoint, "batlength", setBatLength, getBatLength, xmlelement, mode);
- }
-
- void PongCenterpoint::changedGametype()
- {
- SUPER(PongCenterpoint, changedGametype);
-
- this->checkGametype();
- }
-
- void PongCenterpoint::checkGametype()
- {
- if (this->getGametype() && this->getGametype()->isA(Class(Pong)))
- {
- Pong* pong_gametype = orxonox_cast<Pong*>(this->getGametype());
- pong_gametype->setCenterpoint(this);
- }
- }
-}
Deleted: code/branches/libraries2/src/orxonox/objects/worldentities/PongCenterpoint.h
===================================================================
--- code/branches/libraries2/src/orxonox/objects/worldentities/PongCenterpoint.h 2009-08-31 16:08:26 UTC (rev 5724)
+++ code/branches/libraries2/src/orxonox/objects/worldentities/PongCenterpoint.h 2009-08-31 18:23:07 UTC (rev 5725)
@@ -1,95 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _PongCenterpoint_H__
-#define _PongCenterpoint_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <string>
-#include <util/Math.h>
-#include "objects/worldentities/StaticEntity.h"
-
-namespace orxonox
-{
- class _OrxonoxExport PongCenterpoint : public StaticEntity
- {
- public:
- PongCenterpoint(BaseObject* creator);
- virtual ~PongCenterpoint() {}
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- virtual void changedGametype();
-
- void setBalltemplate(const std::string& balltemplate)
- { this->balltemplate_ = balltemplate; }
- const std::string& getBalltemplate() const
- { return this->balltemplate_; }
-
- void setBattemplate(const std::string& battemplate)
- { this->battemplate_ = battemplate; }
- const std::string& getBattemplate() const
- { return this->battemplate_; }
-
- void setFieldDimension(const Vector2& dimension)
- { this->width_ = dimension.x; this->height_ = dimension.y; }
- Vector2 getFieldDimension() const
- { return Vector2(this->width_, this->height_); }
-
- void setBallSpeed(float ballspeed)
- { this->ballspeed_ = ballspeed; }
- float getBallSpeed() const
- { return this->ballspeed_; }
-
- void setBatSpeed(float batspeed)
- { this->batspeed_ = batspeed; }
- float getBatSpeed() const
- { return this->batspeed_; }
-
- void setBatLength(float batlength)
- { this->batlength_ = batlength; }
- float getBatLength() const
- { return this->batlength_; }
-
- private:
- void checkGametype();
-
- std::string balltemplate_;
- std::string battemplate_;
-
- float ballspeed_;
- float batspeed_;
- float batlength_;
-
- float width_;
- float height_;
- };
-}
-
-#endif /* _PongCenterpoint_H__ */
More information about the Orxonox-commit
mailing list