Index: code/branches/presentationHS15/src/libraries/util/Math.cc
===================================================================
--- code/branches/presentationHS15/src/libraries/util/Math.cc	(revision 10963)
+++ code/branches/presentationHS15/src/libraries/util/Math.cc	(revision 10970)
@@ -161,5 +161,5 @@
          - If the other object is exactly above me, the function returns <tt>Vector2(0, 0.5)</tt>.
     */
-    orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition)
+    orxonox::Vector2 get2DViewCoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition)
     {
         orxonox::Vector3 distance = otherposition - myposition;
Index: code/branches/presentationHS15/src/libraries/util/Math.h
===================================================================
--- code/branches/presentationHS15/src/libraries/util/Math.h	(revision 10963)
+++ code/branches/presentationHS15/src/libraries/util/Math.h	(revision 10970)
@@ -91,5 +91,5 @@
     _UtilExport float getAngle(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition);
     _UtilExport orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
-    _UtilExport orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
+    _UtilExport orxonox::Vector2 get2DViewCoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
     _UtilExport orxonox::Vector2 get3DProjection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle, const float detectionlimit);
     _UtilExport bool isObjectHigherThanShipOnMap(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle);
Index: code/branches/presentationHS15/src/modules/docking/DockingController.cc
===================================================================
--- code/branches/presentationHS15/src/modules/docking/DockingController.cc	(revision 10963)
+++ code/branches/presentationHS15/src/modules/docking/DockingController.cc	(revision 10970)
@@ -61,5 +61,5 @@
 
         float distance = (this->dock_->getWorldPosition() - entity->getPosition()).length();
-        Vector2 coord = get2DViewcoordinates(     // I don't understand this too
+        Vector2 coord = get2DViewCoordinates(     // I don't understand this too
             entity->getPosition(),
             entity->getOrientation() * WorldEntity::FRONT,
Index: code/branches/presentationHS15/src/modules/overlays/hud/HUDRadar.cc
===================================================================
--- code/branches/presentationHS15/src/modules/overlays/hud/HUDRadar.cc	(revision 10963)
+++ code/branches/presentationHS15/src/modules/overlays/hud/HUDRadar.cc	(revision 10970)
@@ -240,5 +240,5 @@
             }
             else
-                coord = get2DViewcoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition());
+                coord = get2DViewCoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition());
 
             coord *= math::pi / 3.5f; // small adjustment to make it fit the texture
Index: code/branches/presentationHS15/src/modules/weapons/weaponmodes/MineGun.cc
===================================================================
--- code/branches/presentationHS15/src/modules/weapons/weaponmodes/MineGun.cc	(revision 10963)
+++ code/branches/presentationHS15/src/modules/weapons/weaponmodes/MineGun.cc	(revision 10970)
@@ -58,4 +58,6 @@
         this->setMunitionName("MineMunition");
         this->setDefaultSound("sounds/mineactivate.ogg");
+
+        hudImageString_ = "Orxonox/WSHUD_WM_MineGun";
     }
 
Index: code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.cc	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.cc	(revision 10970)
@@ -0,0 +1,767 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "ActionpointController.h"
+
+#include "core/XMLPort.h"
+#include <algorithm>
+#include "worldentities/Actionpoint.h"
+namespace orxonox
+{
+
+    RegisterClass(ActionpointController);
+
+    ActionpointController::ActionpointController(Context* context) : FightingController(context)
+    {
+        this->ticks_ = 0;
+        this->bPatrolling_ = false;
+        this->bInLoop_ = false;
+        this->bLoop_ = false;
+        this->bEndLoop_ = false;
+        loopActionpoints_.clear();
+        parsedActionpoints_.clear();
+        actionpoints_.clear();
+        this->bTakenOver_ = false;
+        this->action_ = Action::NONE;
+        this->squaredaccuracy_ = 2500;
+        this->bStartedDodging_ = false;
+        this->bDefaultPatrol_ = true;
+        this->bDefaultFightAll_ = true;
+        this->stop_ = false;
+        RegisterObject(ActionpointController);
+
+    }
+    void ActionpointController::XMLPort( Element& xmlelement, XMLPort::Mode mode )
+    {
+        SUPER( ActionpointController, XMLPort, xmlelement, mode );
+
+        XMLPortObject(ActionpointController, WorldEntity, "actionpoints", addActionpoint, getActionpoint,  xmlelement, mode);
+        XMLPortParam(ActionpointController, "defaultFightAll", setDefaultFightAll, getDefaultFightAll, xmlelement, mode).defaultValues(true);
+        XMLPortParam(ActionpointController, "defaultPatrol", setDefaultPatrol, getDefaultPatrol, xmlelement, mode).defaultValues(true);
+    }
+
+    ActionpointController::~ActionpointController()
+    {
+        loopActionpoints_.clear();
+        parsedActionpoints_.clear();
+        actionpoints_.clear();
+
+    }
+    void ActionpointController::tick(float dt)
+    {
+        if (!this || !this->getControllableEntity() || !this->isActive() || this->stop_)
+            return;
+
+        //count ticks, ticks_ is unsigned, so overflow is not a problem
+        ++this->ticks_;
+        if (this->ticks_ == 1)
+        {
+            //those vectors are in reversed order after being set by XML.
+            std::reverse(parsedActionpoints_.begin(), parsedActionpoints_.end());
+            std::reverse(actionpoints_.begin(), actionpoints_.end());
+        }
+
+        if (!this || !this->getControllableEntity())
+            return;
+        //fly
+        if (this->bHasTargetPosition_)
+        {
+            this->moveToTargetPosition(dt);
+        }//or just rotate
+        else if (this->bLookAtTarget_)
+        {
+            this->lookAtTarget(dt);
+        }
+        
+
+        if (!this || !this->getControllableEntity())
+            return;
+        //don't fire rocket each tick
+        if (timeout_ <= 0)
+        {    
+            this->bFiredRocket_ = false;
+        }
+        else if (this->bFiredRocket_)
+        {
+            --this->timeout_;
+        }
+
+        if (!this || !this->getControllableEntity())
+            return;
+        //sometimes dodge, sometimes attack
+        if (this->ticks_ % 80 <= 10)
+        {
+            this->bDodge_ = false;
+        }
+        else
+        {
+            this->bDodge_ = true;
+        }
+
+        if (!this || !this->getControllableEntity())
+            return;
+        //fire if you can
+        if (this->bShooting_)
+        {
+            this->doFire();
+        }
+        SUPER(ActionpointController, tick, dt);
+    }
+     
+    /**
+    @brief
+        action() manages the state machine.
+    */
+
+    void ActionpointController::action()
+    {
+        if (!this || !this->getControllableEntity() || !this->isActive())
+            return;
+
+        //deltaHp is used to know if this got attacked
+        this->deltaHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth() - this->previousHp;
+        this->previousHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth();
+
+        //look out for enemies
+        if (this->bDefaultPatrol_ || (this->action_ != Action::FLY && this->action_ != Action::NONE))
+        {
+            this->startAttackingEnemiesThatAreClose();
+        }
+        if (!this || !this->getControllableEntity())
+            return;
+
+        //No action -> pop one from stack
+        if (this->action_ == Action::NONE || this->bTakenOver_)
+        {
+            //if default behaviour is fighting all, push it onto the stack
+            if (this->parsedActionpoints_.empty() && this->loopActionpoints_.empty() && this->bDefaultFightAll_)
+            {
+                if (!this || !this->getControllableEntity())
+                    return;
+                Point p = { Action::FIGHTALL, "", Vector3::ZERO, false };
+                this->parsedActionpoints_.push_back (p);
+            }
+            if (!this || !this->getControllableEntity())
+                return;
+            this->executeActionpoint();
+            if (!this || !this->getControllableEntity())
+                return;
+            this->bTakenOver_ = false;
+        }
+        if (!this || !this->getControllableEntity())
+            return;
+
+        //Action fightall -> fight till nobody alive
+        if (this->action_ == Action::FIGHTALL)
+        {
+
+            if (!this->hasTarget())
+            {
+                ControllableEntity* newTarget = this->closestTarget();    
+                if (newTarget)
+                {
+                    if (!this || !this->getControllableEntity())
+                        return;
+                    this->setAction (Action::FIGHTALL, newTarget);
+                }
+                else
+                {
+                    if (!this || !this->getControllableEntity())
+                        return;
+                    this->nextActionpoint();
+                    if (!this || !this->getControllableEntity())
+                        return;
+                    this->executeActionpoint();
+    
+                }
+            }
+        }
+        //Action fight -> fight as long as enemies in range
+        else if (this->action_ == Action::FIGHT)
+        {
+            if (!this->hasTarget() )
+            {
+                //----find a target----
+                ControllableEntity* newTarget = this->closestTarget();  
+                if (!this || !this->getControllableEntity())
+                    return;  
+                if (newTarget && 
+                        CommonController::distance (this->getControllableEntity(), newTarget) < this->attackRange_)
+                {
+                    if (!this || !this->getControllableEntity())
+                        return;
+                    this->setAction (Action::FIGHT, newTarget);
+                }
+                else
+                {
+                    if (!this || !this->getControllableEntity())
+                        return;
+                    this->nextActionpoint();
+                    if (!this || !this->getControllableEntity())
+                        return;
+                    this->executeActionpoint();
+                }
+            }
+            else if (this->hasTarget())
+            {
+                //----fly in formation if far enough----
+                Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition();         
+                    
+                if (diffVector.length() > this->attackRange_)
+                {
+                    ControllableEntity* newTarget = this->closestTarget();
+                    if (!this || !this->getControllableEntity())
+                        return;
+                    if (newTarget && 
+                        CommonController::distance (this->getControllableEntity(), newTarget) < this->attackRange_)
+                    {
+                        if (!this || !this->getControllableEntity())
+                            return;
+                        this->setAction (Action::FIGHT, newTarget);
+                    }
+                    else
+                    {
+                        if (!this || !this->getControllableEntity())
+                            return;
+                        this->nextActionpoint();
+                        if (!this || !this->getControllableEntity())
+                            return;
+                        this->executeActionpoint();
+                    }
+                }
+            }
+        }
+        else if (this->action_ == Action::FLY)
+        {
+            if (this->squaredDistanceToTarget() <= this->squaredaccuracy_)
+            {
+                if (!this || !this->getControllableEntity())
+                    return;
+                this->nextActionpoint();   
+                if (!this || !this->getControllableEntity())
+                    return;
+                this->executeActionpoint();
+            }
+        }
+        else if (this->action_ == Action::PROTECT)
+        {
+            if (!this->getProtect())
+            {
+                if (!this || !this->getControllableEntity())
+                    return;
+                this->nextActionpoint();
+                if (!this || !this->getControllableEntity())
+                    return;
+                this->executeActionpoint(); 
+            }
+            if (!this || !this->getControllableEntity())
+                return;
+            this->stayNearProtect();
+        }
+        else if (this->action_ == Action::ATTACK)
+        {   
+            if (!this || !this->getControllableEntity())
+                return;
+            if (!this->hasTarget())
+            {
+                if (!this || !this->getControllableEntity())
+                    return;
+                this->nextActionpoint();
+                if (!this || !this->getControllableEntity())
+                    return;
+                this->executeActionpoint();
+            }
+        }
+    }
+    /**
+    @brief
+        if action is protect, this follows protect_ and fights enemies that are close
+    */
+    void ActionpointController::setProtect (ControllableEntity* protect)
+    {
+        this->protect_ = protect;
+    }
+    ControllableEntity* ActionpointController::getProtect ()
+    {
+        return this->protect_;
+    }
+    //XML method
+    void ActionpointController::addActionpoint(WorldEntity* actionpoint)
+    {
+        std::string actionName;
+        Vector3 position;
+        std::string targetName;
+        bool inLoop = false;
+        Point p;
+        if (actionpoint->getIdentifier()->getName() == "Actionpoint")
+        {
+            Actionpoint* ap = orxonox_cast<Actionpoint*> (actionpoint);
+            actionName = ap->getActionXML();
+            targetName = ap->getName();
+            position = ap->getWorldPosition();
+
+            if (this->bEndLoop_)
+            {
+                this->bInLoop_ = false;
+            }
+            if (!this->bInLoop_ && ap->getLoopStart())
+            {
+                this->bInLoop_ = true;
+            }
+            if (this->bInLoop_ && ap->getLoopEnd())
+            {
+                this->bEndLoop_ = true;
+            }
+            inLoop = this->bInLoop_;
+
+            Action::Value value;
+            
+            if ( actionName == "FIGHT" )
+            { value = Action::FIGHT; }
+            else if ( actionName == "FLY" )
+            { value = Action::FLY; }
+            else if ( actionName == "PROTECT" )
+            { value = Action::PROTECT; }
+            else if ( actionName == "NONE" )
+            { value = Action::NONE; }
+            else if ( actionName == "FIGHTALL" )
+            { value = Action::FIGHTALL; }
+            else if ( actionName == "ATTACK" )
+            { value = Action::ATTACK; }
+            else
+                ThrowException( ParseError, std::string( "Attempting to set an unknown Action: '" )+ actionName + "'." );
+            p.action = value; p.name = targetName; p.position = position; p.inLoop = inLoop;
+        }
+        else
+        {
+            inLoop = true;
+            p.action = Action::FLY; p.name = ""; p.position = actionpoint->getWorldPosition(); p.inLoop = inLoop;
+        }
+            parsedActionpoints_.push_back(p);
+            this->actionpoints_.push_back(actionpoint);
+    }
+    //XML method
+    WorldEntity* ActionpointController::getActionpoint(unsigned int index) const
+    {
+        if (index < this->actionpoints_.size())
+            return this->actionpoints_[index];
+        else
+            return 0;
+    }
+    //XML method
+    Action::Value ActionpointController::getAction ()
+    {
+        return this->action_;
+    }
+    //XML method
+    std::string ActionpointController::getActionName()
+    {
+        switch ( this->action_ )
+        {
+            case Action::FIGHT:
+            { return "FIGHT"; }
+            case Action::FLY:
+            { return "FLY"; }
+            case Action::PROTECT:
+            { return "PROTECT"; }
+            case Action::NONE:
+            { return "NONE"; }
+            case Action::FIGHTALL:
+            { return "FIGHTALL"; }
+            case Action::ATTACK:
+            { return "ATTACK"; }
+            default:
+                return "NONE";
+                break;
+        }
+    }
+    //XML method
+    void ActionpointController::setAction (Action::Value action)
+    {
+        this->action_ = action;
+    }
+    //set action and target/protect
+    void ActionpointController::setAction (Action::Value action, ControllableEntity* target)
+    {
+        if (!this || !this->getControllableEntity())
+            return;
+        this->action_ = action;
+        if (action == Action::FIGHT || action == Action::FIGHTALL || action == Action::ATTACK)
+        {   
+            if (target)
+                this->setTarget (target);
+        }
+        else if (action == Action::PROTECT)
+        {
+            if (target)
+                this->setProtect (target);
+        }
+    }
+    //set action and target position
+    void ActionpointController::setAction (Action::Value action, const Vector3& target)
+    {
+        if (!this || !this->getControllableEntity())
+            return;
+        this->action_ = action;
+        if (action == Action::FLY)
+        {
+            this->setTargetPosition (target);
+        }
+    }
+    //set action and target position and orientation
+    void ActionpointController::setAction (Action::Value action, const Vector3& target,  const Quaternion& orient )
+    {
+        if (!this || !this->getControllableEntity())
+            return;
+        this->action_ = action;
+        if (action == Action::FLY)
+        {
+            this->setTargetPosition (target);
+            this->setTargetOrientation (orient);
+        }  
+    }
+    
+    //------------------------------------------------------------------------------
+    //------------------------------Actionpoint methods-----------------------------
+    //------------------------------------------------------------------------------
+
+    //POST: this starts doing what was asked by the last element of parsedActionpoints_,
+    //if last element was failed to be parsed, next element will be executed.
+    void ActionpointController::executeActionpoint()
+    {
+        if (!this || !this->getControllableEntity())
+            return;
+
+        Point p;
+        if (this->bLoop_ && !loopActionpoints_.empty())
+        {
+            p = loopActionpoints_.back();
+        }
+        else if (this->bLoop_)
+        {
+            this->bLoop_ = false;
+            return;
+        }
+        else if (!this->bLoop_ && !parsedActionpoints_.empty())
+        {
+            p = parsedActionpoints_.back();
+        }
+        else
+        {
+            if (!this || !this->getControllableEntity())
+                return;
+
+            this->setTarget(0);
+            this->setTargetPosition(this->getControllableEntity()->getWorldPosition());
+            this->action_ = Action::NONE;
+            return;
+        }
+        if (!this || !this->getControllableEntity())
+            return;
+        if (!this->bLoop_ && this->parsedActionpoints_.back().inLoop)
+        {
+            //MOVES all points that are in loop to a loop vector
+            this->fillLoop();
+            if (!this || !this->getControllableEntity())
+                return;
+            this->bLoop_ = true;
+            executeActionpoint();
+            return;
+        }
+        if (!this || !this->getControllableEntity())
+            return;
+        this->setAction (p.action);
+        if (!this || !this->getControllableEntity())
+            return;
+
+        switch (this->action_)
+        {
+            case Action::FIGHT:
+            {
+                std::string targetName = p.name;
+                if (targetName == "")
+                    break;
+                for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+                {
+                    if (!this || !this->getControllableEntity())
+                        return;
+                    if (CommonController::getName(*itP) == targetName)
+                    {
+                        this->setTarget (static_cast<ControllableEntity*>(*itP));
+                    }
+                }
+                break;
+            }
+            case Action::FLY:
+            {
+                this->setTargetPosition( p.position );
+                if (!this || !this->getControllableEntity())
+                    return;
+                if (this->squaredDistanceToTarget() <= this->squaredaccuracy_)
+                {
+                    if (!this || !this->getControllableEntity())
+                        return;
+                    this->nextActionpoint();
+                    if (!this || !this->getControllableEntity())
+                        return;
+                    this->executeActionpoint();
+                }
+                break;
+            }
+            case Action::PROTECT:
+            {
+                if (!this || !this->getControllableEntity())
+                    return;
+
+                std::string protectName = p.name;
+                if (protectName == "reservedKeyword:human")
+                {
+                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+                    {
+                        if (orxonox_cast<ControllableEntity*>(*itP) && ((*itP)->getController()) && ((*itP)->getController()->getIdentifier()->getName() == "NewHumanController"))
+                        {
+                            this->setProtect (static_cast<ControllableEntity*>(*itP));
+                        }
+                    }
+                }
+                else
+                {
+                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+                    {
+                        if (CommonController::getName(*itP) == protectName)
+                        {
+                            this->setProtect (static_cast<ControllableEntity*>(*itP));
+                        }
+                    }                            
+                }
+                if (!this->getProtect())
+                {
+                    this->nextActionpoint();
+                    this->executeActionpoint();
+                }
+                break;
+            }
+            case Action::NONE:
+            {
+                break;
+            }
+            case Action::FIGHTALL:
+            {
+                break;
+            }
+            case Action::ATTACK:
+            {
+                std::string targetName = p.name;
+
+                for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+                {
+                    if (CommonController::getName(*itP) == targetName)
+                    {
+                        if (!this || !this->getControllableEntity())
+                            return;
+                        this->setTarget (static_cast<ControllableEntity*>(*itP));
+                    }
+                }
+                if (!this->hasTarget())
+                {
+                    this->nextActionpoint();
+                    if (!this || !this->getControllableEntity())
+                        return;
+                    this->executeActionpoint();
+                }
+                break;
+            }
+            default:
+                break;
+        }   
+    }
+
+    //calculate where in world coordinates this ship has to be, so that it keeps distance to protect_, and fly there
+    void ActionpointController::stayNearProtect()
+    {
+        if (!this || !this->getControllableEntity())
+            return;
+
+        Vector3 targetRelativePosition(0, 300, 300);
+        if (!this->getProtect())
+        {
+            this->nextActionpoint();
+            return;
+        }  
+        Vector3 targetAbsolutePosition = ((this->getProtect()->getWorldPosition()) + 
+            (this->getProtect()->getWorldOrientation()* (targetRelativePosition)));
+        this->setTargetPosition(targetAbsolutePosition);
+        if (!this->getProtect())
+        {
+            this->nextActionpoint();
+            return;
+        }  
+        this->setTargetOrientation(this->getProtect()->getWorldOrientation());
+    }
+    //remove current point from the stack
+    void ActionpointController::nextActionpoint()
+    {
+        if (!this || !this->getControllableEntity())
+            return;
+        if (this->bLoop_)
+        {
+            if (this->bPatrolling_)
+            {
+                this->loopActionpoints_.pop_back();
+                this->bPatrolling_ = false;
+            }
+            else if (!this->loopActionpoints_.empty())
+            {
+                this->moveBackToTop();
+            }
+        }
+        else
+        {
+            if (!this->parsedActionpoints_.empty())
+            {
+                this->parsedActionpoints_.pop_back();
+            }            
+        }
+        this->setAction(Action::NONE);
+        this->bHasTargetPosition_ = false;
+    }
+    //if looping, instead of erasing point, move it to the top (back is what gets executed, so it's kinda reversed stack)
+    void ActionpointController::moveBackToTop()
+    {
+        if (!this || !this->getControllableEntity())
+            return;
+
+        Point temp = loopActionpoints_.back();
+        loopActionpoints_.pop_back();
+        std::reverse (loopActionpoints_.begin(), loopActionpoints_.end());
+        loopActionpoints_.push_back(temp);
+        std::reverse (loopActionpoints_.begin(), loopActionpoints_.end());
+    }
+    //POST: moves all consecutive points that are in loop to the loop stack
+    void ActionpointController::fillLoop()
+    {
+        loopActionpoints_.clear();
+        fillLoopReversed();
+        std::reverse (loopActionpoints_.begin(), loopActionpoints_.end());
+    }
+    void ActionpointController::fillLoopReversed()
+    {
+        if (parsedActionpoints_.back().inLoop)
+        {
+            loopActionpoints_.push_back(parsedActionpoints_.back());
+            parsedActionpoints_.pop_back();
+        }
+        if (parsedActionpoints_.back().inLoop)
+        {
+            fillLoopReversed();
+        }
+    }
+    //copy other ship's stacks so that if it dies, this can finish that ship's actions
+    void ActionpointController::takeActionpoints (const std::vector<Point>& vector, const std::vector<Point>& loop, bool b)
+    {
+        if (!this || !this->getControllableEntity())
+            return;
+        this->parsedActionpoints_ = vector;
+        if (!this || !this->getControllableEntity())
+            return;
+        this->loopActionpoints_ = loop;
+        this->bLoop_ = b;
+        this->bTakenOver_ = true;
+    }
+    //attack closest target
+    void ActionpointController::setClosestTarget()
+    {
+        this->setTarget (static_cast<ControllableEntity*>( closestTarget() ) ); 
+    }
+    //find closest target
+    Pawn* ActionpointController::closestTarget()
+    {
+        if (!this || !this->getControllableEntity())
+            return 0;
+
+        Pawn* closestTarget = 0;
+        float minDistance =  std::numeric_limits<float>::infinity();
+        Gametype* gt = this->getGametype();
+        for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+        {
+            if (!this || !this->getControllableEntity())
+                return 0;
+            if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP), gt) )
+                continue;
+
+            float distance = CommonController::distance (*itP, this->getControllableEntity());
+            if (distance < minDistance)
+            {
+                closestTarget = *itP;
+                minDistance = distance;
+            }
+        }
+        if (closestTarget)
+        {
+           return closestTarget;
+        } 
+        return 0;  
+    }
+    //push action FIGHT to the stack and set target to the closest enemy
+    void ActionpointController::startAttackingEnemiesThatAreClose()
+    {
+        if (!this || !this->getControllableEntity())
+            return;
+
+        //if (this->action_ != Action::FIGHT && this->action_ != Action::FIGHTALL)
+        {
+            if (!this->target_ || (this->target_ && CommonController::distance (this->getControllableEntity(), this->target_) > this->attackRange_))
+            {
+                if (!this || !this->getControllableEntity())
+                    return;
+                Pawn* newTarget = this->closestTarget();
+                if ( newTarget && 
+                    CommonController::distance (this->getControllableEntity(), static_cast<ControllableEntity*>(newTarget))
+                        <= this->attackRange_ )
+                {
+                    if (!this || !this->getControllableEntity())
+                        return;
+                    this->setTarget(newTarget);
+                    if (this->bLoop_ && !this->bPatrolling_)
+                    {
+                        Point p = { Action::FIGHT, "", Vector3::ZERO, true };
+                        this->loopActionpoints_.push_back(p);
+                    }
+                    else if (!this->bPatrolling_)
+                    {
+                        //orxout (internal_error) << "found new target " << CommonController::getName(newTarget) <<endl;
+                        Point p = { Action::FIGHT, "", Vector3::ZERO, false };
+                        this->parsedActionpoints_.push_back(p);
+                    }
+                    this->bPatrolling_ = true;
+                    this->executeActionpoint();
+                }
+            }
+        }
+    }
+}   
Index: code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.h	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.h	(revision 10970)
@@ -0,0 +1,262 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _ActionpointController_H__
+#define _ActionpointController_H__
+
+#include "controllers/FightingController.h"
+#include "tools/Timer.h"
+#include "tools/interfaces/Tickable.h"
+#include "../modules/pickup/PickupSpawner.h"
+#include <map>
+
+#include <boost/shared_ptr.hpp>
+
+
+namespace orxonox
+{
+    /**
+    @brief
+        ActionpointController is a state machine with states:
+            1) NONE
+            2) FLY: fly towards a point
+            3) FIGHT: fight enemies that are in attackRange_ (see FightingController)
+            4) PROTECT: follow this->protect_
+            5) FIGHTALL: fight all enemies on the map
+            6) ATTACK: fight a specific spaceship
+        This controller always executes an action that is in the back of the vector being used.
+        After current this->action_ is completed, next action becomes the top action (one that will
+        be returned by someVector.back()), and current action either will be removed (if not looping),
+        or moved to the top (if looping).
+
+        Every second action(), which is once in two seconds, this searches the area for enemies that are in attack range, if finds anyone,
+        pushes Action::FIGHT to the stack. That makes spaceship fight enemies inside of a sphere, and when all enemies in range are dead,
+        Action::FIGHT is removed from the stack, and spaceship resumes doing whatever action was being executed before.
+
+        In XML one has to attack Actionpoints in order to achieve any complex behaviour, but in Controller all actionpoints are effectively 
+        being stored in an array of type Point::Value.
+    @note
+        ActionpointController will not work, if there is no MasterController in the level!
+    */
+    namespace Action
+    {  
+        enum Value
+        {
+            NONE, FLY, FIGHT, PROTECT, FIGHTALL, ATTACK
+        };
+        
+    }
+    
+    struct Point {
+        Action::Value action;
+        std::string name;
+        Vector3 position;
+        bool inLoop;
+    } ;
+    namespace PickupType
+    {
+        enum Value
+        {  
+            NONE, DAMAGE, HEALTH, SPEED, PORTAL
+        };
+    }
+
+    class _OrxonoxExport ActionpointController : public FightingController, public Tickable
+    {
+        public:
+           
+            ActionpointController(Context* context);
+            virtual ~ActionpointController();
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);          
+               
+            /**
+            @brief
+                tick is called every tick by Game (?).
+                In tick ship flies and fires.
+            */
+            virtual void tick(float dt);   
+            /**
+            @brief
+                XML method, example XML usage:
+                <SpaceShip position="-2000, 1500, -1000" lookat="0,0,0" team=0 name="ss2">
+                  <templates>
+                    <Template link=spaceshipassff />
+                  </templates>
+                  <controller>
+                    <DivisionController team=0 formationMode="finger4">
+                      <actionpoints>
+                        <Actionpoint position="0,0,0" action="FLY" /> 
+                        <Actionpoint position="-1000,750,-500" action="ATTACK" attack="attack" />
+                        <Actionpoint position="-1000,750,-500" action="PROTECt" protectMe=true />
+                        <Actionpoint position="-1000,750,-500" action="PROTECt" protect="protect" /> 
+                        <Actionpoint position="-1000,750,-500" action="FIGHTALL" />
+                       </actionpoints>
+                    </DivisionController>
+                  </controller>
+                </SpaceShip>
+                
+                Full description:
+                Adds an Actionpoint to this->actionpoints_. Actionpoint can take arguments like action="attack" attack="name".
+                For documentation on Actionpoint XML arguments, check out Actionpoint.h class
+                If any WorldEntity that is not Actionpoint or its child being sent to actionpoints through XML,
+                action would be assumed to be Action::FLY and target position to be position of the entity. Also, if not Actionpoint
+                is passed, it is assumed to be in a loop. How it works is: in <actionpoints> first all Actionpoints between 
+                first Actionpoint with loopStart=true and first following Actionpoint with loopEnd=true are included in a single loop.
+                If they are adjacent (in the input array) with WorldEntity, then WorldEntity is also in a loop.
+                All the Worldentities are assumed to be in loop. 
+               
+                Loop example:
+                <SpaceShip position="-1500, 1500, -1000" lookat="0,0,0" team=0 name="ss1">
+                  <templates>
+                    <Template link=spaceshipassff />
+                  </templates>
+                  <controller>
+                    <DivisionController team=0 formationMode="wall">
+                      <actionpoints>
+                        <Actionpoint position="  0,2000,-600" action="FLY" loopStart=true/>
+                        <Actionpoint position="  0,2000,-1000" action="FLY"  />
+                        <Actionpoint position="400,2000,-1000" action="FLY" />
+                        <Actionpoint position="400,2000,-600" action="FLY" loopEnd=true />
+                      </actionpoints>
+                    </DivisionController>
+                  </controller>
+                </SpaceShip>
+               
+                other loop example:
+                <SpaceShip position="-1500, -1500, -1500" lookat="0,0,0" team=0 name="ss1">
+                  <templates>
+                    <Template link=spaceshipassff />
+                  </templates>
+                  <controller>
+                    <DivisionController team=0 formationMode="diamond">
+                      <actionpoints>
+                        <Model mesh="cube.mesh" scale=8 position="  0,2000,-600" />
+                        <Model mesh="cube.mesh" scale=8 position="  0,2000,-1000" />
+                        <Model mesh="cube.mesh" scale=8 position="400,2000,-1000" />
+                        <Model mesh="cube.mesh" scale=8 position="400,2000,-600" />
+                      </actionpoints>
+                    </DivisionController>
+                  </controller>
+                </SpaceShip> 
+
+            @note
+                Don't use several loops, and don't use WorldEntities as input to <actionpoints> as I didn't test it well, but you
+                can try if feeling lucky.  
+            */
+            void addActionpoint(WorldEntity* actionpoint); 
+            WorldEntity* getActionpoint(unsigned int index) const;    
+            void setDefaultFightAll(bool value)
+                { this->bDefaultFightAll_ = value; }
+            bool getDefaultFightAll ()
+                { return this->bDefaultFightAll_; }
+            void setDefaultPatrol(bool value)
+                { this->bDefaultPatrol_ = value; }
+            bool getDefaultPatrol ()
+                { return this->bDefaultPatrol_; }
+               
+
+            virtual void stayNearProtect();
+            virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour. Only gets called by MasterController
+            virtual void takeActionpoints (const std::vector<Point>& vector, const std::vector<Point>& loop, bool b);
+
+            virtual Action::Value getAction ();
+            virtual std::string getActionName();
+
+            void setAction (Action::Value action);
+            void setAction (Action::Value action, ControllableEntity* target);
+            void setAction (Action::Value action, const Vector3& target);
+            void setAction (Action::Value action, const Vector3& target,  const Quaternion& orient );
+
+            virtual bool setWingman(ActionpointController* wingman)
+                { return false; }
+            virtual bool hasWingman()
+                { return true; }
+            virtual bool setFollower(ActionpointController* myFollower)
+                { return false; }
+            virtual bool hasFollower()
+                { return true; }
+
+
+        protected:
+                void startAttackingEnemiesThatAreClose();
+                WeakPtr<ActionpointController> myWingman_;
+                WeakPtr<ActionpointController> myFollower_;
+                WeakPtr<ActionpointController> myDivisionLeader_;
+            //----[Actionpoint information]----
+                Action::Value action_;
+                std::string protectName_;
+                std::string targetName_;
+                std::vector<WeakPtr<WorldEntity> > actionpoints_;
+                float squaredaccuracy_;
+                std::vector<Point > parsedActionpoints_;//<! actionpoints as they are stored here after being parsed from XML
+                std::vector<Point > loopActionpoints_;  //<! actionpoints that are to be looped
+                bool bInLoop_;
+                bool bLoop_;                            //<! is state machine looping?
+                bool bEndLoop_;                    
+                bool bTakenOver_;                       //<! are actionpoints taken over from the leader when he died? if yes, top actionpoint 
+                                                        //<! is to be executed for the state machine to start working
+            //----[/Actionpoint information]----
+                void setProtect (ControllableEntity* protect);
+                ControllableEntity* getProtect (); 
+                WeakPtr<ControllableEntity> protect_;   //<! entity that is to be protected if this->action_ == Action::PROTECT
+                void fillLoop();                        //<! moves actionpoints that are should be in loop from parsedActionpoints_ to loopActionpoints_
+                void fillLoopReversed();
+                void moveBackToTop();                   //<! analog of removing back actionpoint for loopActionpoints_: instead of removing it, 
+                                                        //<! move it to the top, so that it will be executed later on.
+                void setClosestTarget();
+                Pawn* closestTarget();
+            //----[Actionpoint methods]----
+                /**
+                @brief
+                    Sets this->target_, this->targetPosition_, this->protect_ and this->action_ depending
+                    on the current actionpoint in the vector parsedActionpoints_ if not looping or
+                    loopActionpoints_ if looping.
+                @note
+                */
+                void executeActionpoint();  
+                /**
+                @brief
+                    If this->bLoop_, move back action to top (back is the current one, top is the last),
+                    otherwise remove back actionpoint.
+                @note
+                    actionpoints_ is only used for XML, real state stacks are parsedActionpoints_ and loopActionpoints_
+                */            
+                void nextActionpoint();                 
+            //----[Actionpoint methods]----          
+
+                bool bDefaultFightAll_;
+
+                bool bPatrolling_;
+                bool bDefaultPatrol_;
+                bool stop_;
+                unsigned int ticks_;     //<! local tick counter            
+
+    };
+}
+
+#endif /* _ActionpointController_H__ */
Index: code/branches/presentationHS15/src/orxonox/controllers/CMakeLists.txt
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/CMakeLists.txt	(revision 10963)
+++ code/branches/presentationHS15/src/orxonox/controllers/CMakeLists.txt	(revision 10970)
@@ -11,3 +11,11 @@
   FormationController.cc
   ControllerDirector.cc
+  DivisionController.cc
+  WingmanController.cc
+  SectionController.cc
+  CommonController.cc
+  ActionpointController.cc
+  FlyingController.cc
+  FightingController.cc
+  MasterController.cc
 )
Index: code/branches/presentationHS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/CommonController.cc	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/CommonController.cc	(revision 10970)
@@ -0,0 +1,218 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      Dominik Solenicki
+ *
+ */
+#include "controllers/CommonController.h"
+
+//here starts stuff for sameTeam function copied from FormationController
+#include "gametypes/TeamDeathmatch.h"
+#include "gametypes/Gametype.h"
+#include "controllers/DroneController.h"
+#include "gametypes/Dynamicmatch.h"
+
+#include "worldentities/pawns/TeamBaseMatchBase.h"
+
+namespace orxonox
+{
+
+    RegisterClass(CommonController);
+    CommonController::CommonController(Context* context): Controller(context)
+    {
+        RegisterObject(CommonController);
+    }
+    CommonController::~CommonController() 
+    {
+        //no member variables - nothing to destroy
+    }
+    /**
+    @brief
+      PRE: a < b.
+      returns random float between a and b.
+    */
+    float CommonController::randomInRange(float a, float b)
+    {
+        return a + rnd(1.0f) * (b - a);
+    }
+    /**
+    @brief
+      returns distance between two entities, if either is zero pointer, returns infinity
+    */    
+    float CommonController::distance (const ControllableEntity* entity1, const ControllableEntity* entity2)
+    {
+        if (!entity1 || !entity2)
+            return std::numeric_limits<float>::infinity();
+        return (entity1->getPosition() - entity2->getPosition()).length();
+    }
+    /**
+    @brief
+      bad function from FormationController that returns true if both entities have same team
+    */    
+    bool CommonController::sameTeam (ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gametype)
+    {
+        //uncomment following code if functions stops working due to being a hack
+        /*if (!entity1 || !entity2)
+            return false;
+        return entity1->getTeam() == entity2->getTeam();*/
+        if (!entity1 || !entity2)
+            return false;
+        if (entity1 == entity2)
+            return true;
+
+        int team1 = entity1->getTeam();
+        int team2 = entity2->getTeam();
+
+        Controller* controller = 0;
+        if (entity1->getController())
+            controller = entity1->getController();
+        else
+            controller = entity1->getXMLController();
+        if (controller)
+        {
+            if (controller->getIdentifier()->getName() == "MasterController")
+                return true;
+            CommonController* ac = orxonox_cast<CommonController*>(controller);
+            if (ac)
+                team1 = ac->getTeam();
+        }
+
+        if (entity2->getController())
+            controller = entity2->getController();
+        else
+            controller = entity2->getXMLController();
+        if (controller)
+        {
+            if (controller->getIdentifier()->getName() == "MasterController")
+                return true;
+            CommonController* ac = orxonox_cast<CommonController*>(controller);
+            if (ac)
+                team2 = ac->getTeam();
+        }
+
+        TeamGametype* tdm = orxonox_cast<TeamGametype*>(gametype);
+        if (tdm)
+        {
+            if (entity1->getPlayer())
+                team1 = tdm->getTeam(entity1->getPlayer());
+
+            if (entity2->getPlayer())
+                team2 = tdm->getTeam(entity2->getPlayer());
+        }
+
+        TeamBaseMatchBase* base = 0;
+        base = orxonox_cast<TeamBaseMatchBase*>(entity1);
+        if (base)
+        {
+            switch (base->getState())
+            {
+                case BaseState::ControlTeam1:
+                    team1 = 0;
+                    break;
+                case BaseState::ControlTeam2:
+                    team1 = 1;
+                    break;
+                case BaseState::Uncontrolled:
+                default:
+                    team1 = -1;
+            }
+        }
+        base = orxonox_cast<TeamBaseMatchBase*>(entity2);
+        if (base)
+        {
+            switch (base->getState())
+            {
+                case BaseState::ControlTeam1:
+                    team2 = 0;
+                    break;
+                case BaseState::ControlTeam2:
+                    team2 = 1;
+                    break;
+                case BaseState::Uncontrolled:
+                default:
+                    team2 = -1;
+            }
+        }
+
+        DroneController* droneController = 0;
+        droneController = orxonox_cast<DroneController*>(entity1->getController());
+        if (droneController && static_cast<ControllableEntity*>(droneController->getOwner()) == entity2)
+            return true;
+        droneController = orxonox_cast<DroneController*>(entity2->getController());
+        if (droneController && static_cast<ControllableEntity*>(droneController->getOwner()) == entity1)
+            return true;
+        DroneController* droneController1 = orxonox_cast<DroneController*>(entity1->getController());
+        DroneController* droneController2 = orxonox_cast<DroneController*>(entity2->getController());
+        if (droneController1 && droneController2 && droneController1->getOwner() == droneController2->getOwner())
+            return true;
+
+        Dynamicmatch* dynamic = orxonox_cast<Dynamicmatch*>(gametype);
+        if (dynamic)
+        {
+            if (dynamic->notEnoughPigs||dynamic->notEnoughKillers||dynamic->notEnoughChasers) {return false;}
+
+            if (entity1->getPlayer())
+                team1 = dynamic->getParty(entity1->getPlayer());
+
+            if (entity2->getPlayer())
+                team2 = dynamic->getParty(entity2->getPlayer());
+
+            if (team1 ==-1 ||team2 ==-1) {return false;}
+            else if (team1 == dynamic->chaser && team2 != dynamic->chaser) {return false;}
+            else if (team1 == dynamic->piggy && team2 == dynamic->chaser) {return false;}
+            else if (team1 == dynamic->killer && team2 == dynamic->chaser) {return false;}
+            else return true;
+        }
+
+        return (team1 == team2 && team1 != -1);
+    }
+    /**
+    @brief
+      returns true if entityThatLooks does look at entityBeingLookeAt with a tolerance of angle.
+    */    
+    bool CommonController::isLooking(const ControllableEntity* entityThatLooks, const ControllableEntity* entityBeingLookedAt, float angle)
+    {
+        if (!entityThatLooks || !entityBeingLookedAt)
+            return false;
+        return (getAngle(entityThatLooks ->getPosition() , 
+            entityThatLooks->getOrientation()  * WorldEntity::FRONT, 
+            entityBeingLookedAt->getWorldPosition()) < angle);
+    }
+    /**
+    @brief
+      returns a name of a Pawn entity, if no name set, returns string representing address of the Pawn.
+    */    
+    std::string CommonController::getName(const Pawn* entity)
+    {
+        std::string name = entity->getName();
+        if (name == "")
+        {
+            const void * address = static_cast<const void*>(entity);
+            std::stringstream ss;
+            ss << address;  
+            name = ss.str();            
+        }
+        return name;
+    }
+}
Index: code/branches/presentationHS15/src/orxonox/controllers/CommonController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/CommonController.h	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/CommonController.h	(revision 10970)
@@ -0,0 +1,59 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      Dominik Solenicki
+ *
+ */
+
+#ifndef _CommonController_H__
+#define _CommonController_H__
+
+
+#include "controllers/Controller.h"                 //that's what I inherit from
+
+#include <limits>                                   //I use limits pretty much in every class, so might as well include it in the parent class
+
+#include "worldentities/ControllableEntity.h"       //same for ControllableEntity
+#include "worldentities/pawns/Pawn.h"               //and Pawn
+
+
+namespace orxonox
+{
+    class _OrxonoxExport CommonController : public Controller
+    {
+
+        public:
+            static const float hardcoded_projectile_speed = 750;        //<! FightingController uses it to predict enemy position
+
+            CommonController(Context* context);
+            virtual ~CommonController();
+            static float randomInRange(float a, float b);
+            static float distance(const ControllableEntity* entity1, const ControllableEntity* entity2);
+            static bool sameTeam (ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gt);
+            static bool isLooking(const ControllableEntity* entityThatLooks, const ControllableEntity* entityBeingLookedAt, float angle ) ;
+            static std::string getName(const Pawn* entity ) ;           
+    };
+}
+
+#endif /* _CommonController_H__ */
Index: code/branches/presentationHS15/src/orxonox/controllers/DivisionController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/DivisionController.cc	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/DivisionController.cc	(revision 10970)
@@ -0,0 +1,147 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "DivisionController.h"
+#include "infos/PlayerInfo.h"
+
+namespace orxonox
+{
+
+    RegisterClass(DivisionController);
+
+    //Leaders share the fact that they have Wingmans
+    DivisionController::DivisionController(Context* context) : ActionpointController(context)
+    {
+        RegisterObject(DivisionController);
+        this->setFormationMode(FormationMode::DIAMOND);
+        this->target_ = 0;
+        this->myFollower_ = 0;
+        this->myWingman_ = 0;
+    }
+
+    DivisionController::~DivisionController()
+    {
+        for (size_t i = 0; i < this->actionpoints_.size(); ++i)
+        {
+            if(this->actionpoints_[i])
+                this->actionpoints_[i]->destroy();
+        }
+        this->parsedActionpoints_.clear();
+        this->actionpoints_.clear();
+    } 
+
+    void DivisionController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(DivisionController, XMLPort, xmlelement, mode);
+        
+    }
+    void DivisionController::tick(float dt)
+    {   
+        if (!this->isActive())
+            return;   
+        
+        SUPER(DivisionController, tick, dt);
+        
+    }
+    void DivisionController::action()
+    {   
+        if (!this || !this->getControllableEntity() || !this->isActive())
+            return;
+        
+        ActionpointController::action();
+        if (!this || !this->getControllableEntity())
+            return;
+        if (!(this->parsedActionpoints_.empty() && this->loopActionpoints_.empty()))
+        {
+            if (this->myFollower_)
+            {
+                this->myFollower_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
+            }
+            else if (this->myWingman_)
+            {
+                this->myWingman_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
+            }    
+        }
+
+        
+    }
+    //I wanted to do it different here, but at this point I think nothing will change if I delete that method
+    void DivisionController::stayNearProtect()
+    {
+        ActionpointController::stayNearProtect();
+    }
+    
+    bool DivisionController::setWingman(ActionpointController* newWingman)
+    {
+        if (!this->myWingman_)
+        {
+            this->myWingman_ = newWingman;
+            if (!this->hasFollower())
+                newWingman->takeActionpoints (this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+    bool DivisionController::setFollower(ActionpointController* newFollower)
+    {
+        if (!this->myFollower_)
+        {
+            this->myFollower_ = newFollower;
+            if (this->hasWingman())
+            {
+                this->myWingman_->takeActionpoints (std::vector<Point>(), std::vector<Point>(), false);
+            }
+
+            newFollower->takeActionpoints (this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
+            
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+    bool DivisionController::hasWingman()
+    {
+        if (this->myWingman_)
+            return true;
+        else
+            return false;
+    }
+    bool DivisionController::hasFollower()
+    {
+        if (this->myFollower_)
+            return true;
+        
+        return false;
+    }
+
+}
Index: code/branches/presentationHS15/src/orxonox/controllers/DivisionController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/DivisionController.h	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/DivisionController.h	(revision 10970)
@@ -0,0 +1,78 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _DivisionController_H__
+#define _DivisionController_H__
+
+#include "controllers/ActionpointController.h"
+
+
+
+namespace orxonox
+{
+    /**
+        @note
+        ActionpointController will not work, if there is no MasterController in the level!
+    */
+    class _OrxonoxExport DivisionController : public ActionpointController
+    {
+        public:
+            //----[language demanded functions]----            
+            	DivisionController(Context* context);
+
+            	virtual ~DivisionController();
+            //----[/language demanded functions]----            
+
+            //----[orxonox demanded functions]----
+                virtual void tick(float dt); 
+
+                virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);          
+            //----[orxonox demanded functions]----
+
+            //----[own functions]----
+                virtual bool setFollower(ActionpointController* newFollower);
+                virtual bool setWingman(ActionpointController* newWingman);
+                virtual bool hasWingman();
+                virtual bool hasFollower();
+                
+            //----[/own functions]----
+            virtual void stayNearProtect();
+
+        protected:
+            //----action must only be managed by this----
+            virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour.
+
+        private:
+            //----private variables-----
+            Timer actionTimer_; //<! Regularly calls action().
+   
+
+    };
+}
+
+#endif /* _DivisionController_H__ */
Index: code/branches/presentationHS15/src/orxonox/controllers/FightingController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/FightingController.cc	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/FightingController.cc	(revision 10970)
@@ -0,0 +1,377 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      Fabian 'x3n' Landau, Dominik Solenicki
+ *
+ */
+#include "controllers/FightingController.h"
+#include "core/XMLPort.h"
+#include "util/Math.h"
+
+
+#include "worldentities/pawns/SpaceShip.h"
+
+#include "weaponsystem/WeaponMode.h"
+#include "weaponsystem/WeaponPack.h"
+#include "weaponsystem/Weapon.h"
+#include "weaponsystem/WeaponSlot.h"
+#include "weaponsystem/WeaponSystem.h"
+#include "weaponsystem/Munition.h"
+
+namespace orxonox
+{
+
+    RegisterClass (FightingController);
+    
+    FightingController::FightingController( Context* context ): FlyingController( context )
+    {
+    	this->attackRange_ = 2500;
+        this->stopLookingAtTarget();
+        this->bSetupWorked = false;
+        this->timeout_ = 0;
+        RegisterObject( FightingController );
+    }
+    FightingController::~FightingController() 
+    {
+        
+    }
+    void FightingController::XMLPort( Element& xmlelement, XMLPort::Mode mode )
+    {
+        SUPER( FightingController, XMLPort, xmlelement, mode );
+    }
+    void FightingController::lookAtTarget(float dt)
+    {
+        if (!this || !this->getControllableEntity())
+            return;
+        ControllableEntity* entity = this->getControllableEntity();
+        if ( !entity )
+            return;
+        Vector2 coord = get2DViewCoordinates
+            ( entity->getPosition() , 
+            entity->getOrientation()  * WorldEntity::FRONT, 
+            entity->getOrientation()  * WorldEntity::UP, 
+            positionOfTarget_ );
+
+        //rotates should be in range [-1,+1], clamp cuts off all that is not
+        float rotateX = -clamp( coord.x * 10, -1.0f, 1.0f );
+        float rotateY = clamp( coord.y * 10, -1.0f, 1.0f ); 
+   
+        //Yaw and Pitch are enough to start facing the target
+        this->getControllableEntity() ->rotateYaw( ROTATEFACTOR * rotateX * dt );
+        this->getControllableEntity() ->rotatePitch( ROTATEFACTOR * rotateY * dt );
+    }
+    void FightingController::stopLookingAtTarget()
+    {
+        this->bLookAtTarget_ = false;
+    }
+    void FightingController::startLookingAtTarget()
+    {
+        this->bLookAtTarget_ = true;
+    }
+    bool FightingController::hasTarget() const
+    {
+        if ( this->target_ )
+            return true;
+        return false;
+    }
+
+    void FightingController::setTarget( ControllableEntity* target )
+    {
+        this->target_ = target;        
+        if ( this->target_ )
+        {
+            this->setPositionOfTarget( target_->getWorldPosition() );
+        }
+    }
+    void FightingController::setPositionOfTarget( const Vector3& target )
+    {
+        this->positionOfTarget_ = target;
+        this->bHasPositionOfTarget_ = true;
+    }
+    void FightingController::setOrientationOfTarget( const Quaternion& orient )
+    {
+        this->orientationOfTarget_=orient;
+        this->bHasOrientationOfTarget_=true;
+    }
+    
+    void FightingController::maneuver() 
+    {
+        if ( !this->target_ || !this->getControllableEntity())
+            return;
+
+
+        Vector3 thisPosition = this->getControllableEntity()->getWorldPosition();
+        this->setPositionOfTarget(this->target_->getWorldPosition());
+        //this->setOrientationOfTarget(this->target_->getOrientation());
+        Vector3 diffVector = this->positionOfTarget_ - thisPosition;
+        float diffLength = diffVector.length();
+        Vector3 diffUnit = diffVector/diffLength;
+
+        if (!this || !this->getControllableEntity())
+            return;
+
+        //too far? well, come closer then
+        if (diffLength > this->attackRange_)
+        {
+            this->spread_ = 400;
+            this->formationMode_ = FormationMode::DIAMOND;
+            this->bKeepFormation_ = true;
+            
+            this->setTargetPosition(this->positionOfTarget_ - diffUnit * 100.0f);
+        }
+        else
+        {   
+            bool bTargetIsLookingAtThis = CommonController::isLooking (this->target_, this->getControllableEntity(), math::pi/20.0f)
+                || this->deltaHp < 0;
+            this->bKeepFormation_ = false;
+
+            if (!this || !this->getControllableEntity())
+                return;
+            if (!this->bDodge_)
+            {
+                // orxout(internal_error) << "attacking" << endl;
+                this->bStartedDodging_ = false;
+
+                this->setTargetPosition(this->positionOfTarget_ - diffUnit * 50.0f);   
+                return;
+            }
+            else if (bTargetIsLookingAtThis || diffLength < 700.0f)
+            {
+                // orxout(internal_error) << "dodging" << endl;
+                if (!this->bStartedDodging_)
+                {
+                    this->bStartedDodging_ = true;
+                    dodge(thisPosition, diffLength, diffUnit);        
+                }
+            }
+            else
+            {
+                if (diffLength < 1000)
+                {
+                // orxout(internal_error) << "looking" << endl;                    
+                    this->stopMoving();
+                    this->startLookingAtTarget();
+
+                }
+                else
+                {
+                // orxout(internal_error) << "closing up" << endl;                    
+                    this->setTargetPosition(this->positionOfTarget_ - diffUnit * 300.0f);
+                }
+            }
+        }
+    }
+    
+    void FightingController::dodge(const Vector3& thisPosition, float diffLength, Vector3& diffUnit)
+    {
+        //d.x*x + d.y*y + d.z*z == 0
+        //z = 1/d.z * (-d.y*y - d.x * x)
+        float x = CommonController::randomInRange (300, 800) * (CommonController::randomInRange(0,1) <= 0.5 ? 1 : -1);
+        float y = CommonController::randomInRange (300, 800) * (CommonController::randomInRange(0,1) <= 0.5 ? 1 : -1);
+        float z = diffUnit.z == 0 ? 0 : (1/diffUnit.z) * (-x * diffUnit.x - y * diffUnit.y);
+        if (diffLength < 150.0f)
+        {
+            this->setTargetPosition(this->positionOfTarget_ + Vector3(z,x,y));
+        }
+        else
+        {
+        this->setTargetPosition(thisPosition + Vector3(x,y,z) + (this->deltaHp < 0 ? -diffUnit * 450.0f : 
+            (diffLength < 700.0f ? -diffUnit*700.0f : diffUnit * 50.0f)));
+
+        }
+        this->boostControl();
+
+    }
+    bool FightingController::canFire() 
+    {
+        //no target? why fire?
+        if (!this->target_ || !this->getControllableEntity())
+            return false;
+        Vector3 newPositionOfTarget = getPredictedPosition(this->getControllableEntity()->getWorldPosition(), 
+                                                           hardcoded_projectile_speed, this->target_->getWorldPosition(), 
+                                                           this->target_->getVelocity());
+        if (!this->target_ || !this->getControllableEntity())
+            return false;
+        //Vector3.isNaN() is what I used on my machine and it worked...
+        if (!(std::isnan(newPositionOfTarget.x) || std::isnan(newPositionOfTarget.y) || std::isnan(newPositionOfTarget.z)))
+        {
+            this->setPositionOfTarget(newPositionOfTarget);
+        }
+
+        return squaredDistanceToTarget() < this->attackRange_*this->attackRange_ && this->isLookingAtTarget(math::pi / 20.0f);
+    }
+
+
+    float FightingController::squaredDistanceToTarget()  const
+    {
+        if (!this || !this->getControllableEntity())
+            return 0;
+        if (!this->target_ || !this->getControllableEntity())
+            return (this->getControllableEntity()->getPosition().squaredDistance(this->targetPosition_));
+        else
+            return (this->getControllableEntity()->getPosition().squaredDistance(this->positionOfTarget_));
+    }
+    bool FightingController::isLookingAtTarget( float angle ) const
+    {
+        if ( !this->getControllableEntity()  || !this->target_ )
+            return false;
+        return CommonController::isLooking(this->getControllableEntity(), this->getTarget(), angle);
+    }
+    void FightingController::setClosestTarget()
+    {
+        this->setTarget (static_cast<ControllableEntity*>( closestTarget() ) ); 
+    }
+    
+    Pawn* FightingController::closestTarget() const
+    {
+        if (!this || !this->getControllableEntity())
+            return 0;
+
+        Pawn* closestTarget = 0;
+        float minDistance =  std::numeric_limits<float>::infinity();
+        Gametype* gt = this->getGametype();
+        for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+        {
+            if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP), gt) )
+                continue;
+
+            float distance = CommonController::distance (*itP, this->getControllableEntity());
+            if (distance < minDistance)
+            {
+                closestTarget = *itP;
+                minDistance = distance;
+            }
+        }
+        if (closestTarget)
+        {
+           return closestTarget;
+        } 
+        return 0;  
+    }
+    //I checked it out, rockets DO NOT cause any problems! this->getControllableEntity() is always a SpaceShip
+    void FightingController::doFire()
+    {
+        if (!this->bSetupWorked)
+        {
+            this->setupWeapons();
+        }
+        if (!this->target_ || !this->getControllableEntity())
+        {
+            return;
+        }
+
+        Pawn* pawn = orxonox_cast<Pawn*> (this->getControllableEntity());
+        if (pawn)
+            pawn->setAimPosition (this->positionOfTarget_);
+
+        int firemode;
+        float distance = CommonController::distance (this->getControllableEntity(), this->target_);
+
+
+       
+        if (distance < 1500)
+        {
+            if (this->rocketsLeft_ > 0 && !this->bFiredRocket_)
+            {
+                firemode = getFiremode ("RocketFire");
+            }
+            else
+            {
+                if (distance > 800)
+                    firemode = getFiremode ("HsW01");
+                else
+                    firemode = getFiremode ("LightningGun");
+            }
+
+        } 
+    
+
+        else if (distance < 2000)
+        {
+            firemode = getFiremode ("HsW01");
+        }
+        else
+        {
+            firemode = getFiremode ("LightningGun");
+        }
+        if (firemode < 0)
+        {
+            //assuming there is always some weapon with index 0
+            firemode = 0;
+        }
+        if (firemode == getFiremode("RocketFire"))
+        {
+            this->timeout_ = 5;
+            this->rocketsLeft_--;
+            this->bFiredRocket_ = true;
+        }
+        if (firemode == getFiremode("SimpleRocketFire"))
+        {
+            this->rocketsLeft_--;
+        }
+              
+        this->getControllableEntity()->fire(firemode);
+        
+    }
+    void FightingController::setupWeapons() //TODO: Make this function generic!! (at the moment is is based on conventions)
+    {
+        this->bSetupWorked = false;
+        if(this->getControllableEntity())
+        {
+            Pawn* pawn = orxonox_cast<Pawn*>(this->getControllableEntity());
+            if(pawn && pawn->isA(Class(SpaceShip))) //fix for First Person Mode: check for SpaceShip
+            {
+                this->weaponModes_.clear(); // reset previous weapon information
+                WeaponSlot* wSlot = 0;
+                for(int l=0; (wSlot = pawn->getWeaponSlot(l)) ; l++)
+                {
+                    WeaponMode* wMode = 0;
+                    for(int i=0; (wMode = wSlot->getWeapon()->getWeaponmode(i)) ; i++)
+                    {
+                        std::string wName = wMode->getIdentifier()->getName();
+                        // SubclassIdentifier<Munition> munition =  ClassByString(wName);
+                        if (wName == "RocketFire")
+                            this->rocketsLeft_ = 10;
+                            // this->rocketsLeft_ = orxonox_cast<Pawn*>(this->getControllableEntity())->getWeaponSystem()->getMunition(&munition)->getNumMunitionInCurrentMagazine(wMode);
+                        if(this->getFiremode(wName) == -1) //only add a weapon, if it is "new"
+                            weaponModes_[wName] = wMode->getMode();
+                    }
+                }
+                if(weaponModes_.size())//at least one weapon detected
+                    this->bSetupWorked = true;
+            }//pawn->weaponSystem_->getMunition(SubclassIdentifier< Munition > *identifier)->getNumMunition (WeaponMode *user);
+        }
+
+    }
+
+    int FightingController::getFiremode(std::string name)
+    {
+        for (std::map< std::string, int >::iterator it = this->weaponModes_.begin(); it != this->weaponModes_.end(); ++it)
+        {
+            if (it->first == name)
+                return it->second;
+        }
+        return -1;
+    }
+}
Index: code/branches/presentationHS15/src/orxonox/controllers/FightingController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/FightingController.h	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/FightingController.h	(revision 10970)
@@ -0,0 +1,106 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      Fabian 'x3n' Landau, Dominik Solenicki
+ *
+ */
+
+#ifndef _FightingController_H__
+#define _FightingController_H__
+
+
+#include "controllers/FlyingController.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        FightingController stores all the fighting methods and member variables of AI.
+        Main methods here are maneuver() and dodge().
+    
+    @note
+        ActionpointController will not work, if there is no MasterController in the level!
+    */
+    class _OrxonoxExport FightingController : public FlyingController
+    {
+
+        public:
+            FightingController(Context* context);
+            virtual ~FightingController();
+            
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+       
+            float squaredDistanceToTarget() const;
+            bool isLookingAtTarget(float angle) const;
+            bool hasTarget() const;
+            ControllableEntity* getTarget() const
+                { return this->target_; }
+            bool bKeepFormation_;   //even if action_ == FIGHT, you might still want to keep formation if far enough form the target
+            virtual void maneuver(); //<! sets this->targetPosition_, which is a Vector3 of where this ship flies. Decision is made based on
+                             //<! the distance to enemy, if being attacked, dodge() is called, otherwise ship just flies towards this->target_.
+            bool bShooting_;    //<! if true, ship shoots each tick
+            bool canFire(); //<! check if target_ is in radius and if this is looking at target_
+        protected:
+            void setTarget(ControllableEntity* target); //set a target to shoot at
+
+            void setPositionOfTarget(const Vector3& target);    //good to know where target is
+            void setOrientationOfTarget(const Quaternion& orient);  //I don't really use that
+            void stopLookingAtTarget();     //<! target dead -> you need to be able to fly
+            void startLookingAtTarget();    //<! if close to target, no need to fly, just rotate yourself
+            void lookAtTarget(float dt);    //<! rotate yourself towards target
+
+            void dodge(const Vector3& thisPosition, float diffLength,  Vector3& diffUnit); //<! choose a random Vector3 perpendicular to the difference vector between
+                                                                        //<! this and target_ plus or minus some amount in difference vector direction,
+                                                                        //<! depending on whether it is better to close up or survive.
+            void dodgeTowards (Vector3& position);  //fly towards position and awoid being hit
+            void doFire();  //<! choose weapon, set aim at target_ and fire
+            WeakPtr<ControllableEntity> target_;
+            void setClosestTarget();
+         
+            bool bHasPositionOfTarget_;
+            Vector3 positionOfTarget_;
+            bool bHasOrientationOfTarget_;
+            Quaternion orientationOfTarget_;
+            Pawn* closestTarget() const;
+
+            bool bDodge_;
+            int attackRange_;
+            bool bLookAtTarget_; 
+            float deltaHp;
+            float previousHp;
+            bool bStartedDodging_;
+            //WEAPONSYSTEM DATA
+            int rocketsLeft_;
+            int timeout_;
+            bool bFiredRocket_;
+            std::map<std::string, int> weaponModes_; //<! Links each "weapon" to it's weaponmode - managed by setupWeapons()
+            //std::vector<int> projectiles_; //<! Displays amount of projectiles of each weapon. - managed by setupWeapons()
+            void setupWeapons(); //<! Defines which weapons are available for a bot. Is recalled whenever a bot was killed.
+            bool bSetupWorked; //<! If false, setupWeapons() is called.
+            int getFiremode(std::string name);
+          
+    };
+}
+
+#endif /* _FightingController_H__ */
Index: code/branches/presentationHS15/src/orxonox/controllers/FlyingController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/FlyingController.cc	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/FlyingController.cc	(revision 10970)
@@ -0,0 +1,286 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+
+ *   Co-authors:
+ *   ...
+ *
+ */
+#include <OgreMatrix3.h>                        //for Quaternion manipulations
+
+#include "util/Math.h"                          
+#include "core/XMLPort.h"
+#include "controllers/FlyingController.h"
+
+#include "worldentities/pawns/SpaceShip.h"      //for boosting
+
+namespace orxonox
+{    
+    RegisterClass (FlyingController);
+    
+    FlyingController::FlyingController(Context* context): CommonController(context)
+    {
+        RegisterObject(FlyingController);        
+        this->rotationProgress_ = 0;
+        this->spread_ = 200;
+        this->tolerance_ = 80;
+        this->bCopyOrientation_ = true;
+    }
+    FlyingController::~FlyingController() 
+    {
+    }
+
+    void FlyingController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        XMLPortParam(FlyingController, "spread", setSpread, getSpread,  xmlelement, mode);
+        XMLPortParam(FlyingController, "formationMode", setFormationModeXML, getFormationModeXML,  xmlelement, mode);
+        SUPER(FlyingController, XMLPort, xmlelement, mode);
+    }
+   
+    void FlyingController::setFormationModeXML(std::string val)
+    {
+        const std::string valUpper = getUppercase(val);
+        FormationMode::Value value;
+        
+        if (valUpper == "WALL")
+            value = FormationMode::WALL;
+        else if (valUpper == "FINGER4")
+            value = FormationMode::FINGER4;
+        else if (valUpper == "DIAMOND")
+            value = FormationMode::DIAMOND;
+        else
+            ThrowException(ParseError, std::string("Attempting to set an unknown FormationMode: '")+ val + "'.");
+        this->setFormationMode(value);
+    }
+    std::string FlyingController::getFormationModeXML() const
+    {
+        switch (this->formationMode_)
+        {
+            case FormationMode::WALL:
+            { return "WALL"; }
+            case FormationMode::FINGER4:
+            { return "FINGER4"; }
+            case FormationMode::DIAMOND:
+            { return "DIAMOND"; }
+            default:
+                return "DIAMOND";
+        }
+    }
+    void FlyingController::stopMoving()
+    {
+        this->bHasTargetPosition_ = false;
+    }
+    /**
+    @brief
+      if distance to targetPosition is smaller than this->tolerance_, no moving should be made, otherwise
+      find amount of yaw and pitch that have to be applied, so that ship looks at targetPosition, then
+      ship is moved forward towards targetPosition. Also target orientation is being applied.
+    */
+    void FlyingController::moveToPosition(const Vector3& targetPosition, float dt)
+    {
+        if (!this->getControllableEntity())
+            return;
+        ControllableEntity* entity = this->getControllableEntity();
+
+        float distance = (targetPosition - entity->getPosition()).length();
+
+        if (distance >= this->tolerance_)
+        {
+            //function that calculates how much yaw and pitch are to be applied
+            Vector2 coord = get2DViewCoordinates
+                (entity->getPosition() , 
+                entity->getOrientation()  * WorldEntity::FRONT, 
+                entity->getOrientation()  * WorldEntity::UP, 
+                targetPosition);
+            //limit yaw and pitch by [-1,1]
+            float rotateX = -clamp(coord.x * 10, -1.0f, 1.0f);
+            float rotateY = clamp(coord.y * 10, -1.0f, 1.0f);
+
+            if (!entity)
+                return;
+
+            //apply yaw and pitch
+            entity->rotateYaw(ROTATEFACTOR * rotateX * dt);
+            entity->rotatePitch(ROTATEFACTOR * rotateY * dt);
+            
+            if (!entity)
+                return;
+           
+            //only move either if ship looks at target with a certain tolerance, or if ship is far enough for it to be ok to move in a curve.
+            if (distance > this->tolerance_*1.5f || (rotateX > -0.03 && rotateX < 0.03 && rotateY > -0.03 && rotateY < 0.03))
+                entity->moveFrontBack(SPEED * dt);
+            //roll
+            copyTargetOrientation(dt);
+        }
+        else
+        {      
+            bHasTargetPosition_ = false;
+        }
+    }
+    /**
+    @brief
+      fly towards a preset targetPosition_
+    */
+    void FlyingController::moveToTargetPosition(float dt)
+    {
+        this->moveToPosition (this->targetPosition_, dt);
+    }
+    /**
+    @brief
+      roll ship so that it has same roll as orient
+    */
+    void FlyingController::copyOrientation(const Quaternion& orient, float dt)
+    {
+        //copied from
+        //http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Quaternion+and+Rotation+Primer&structure=Tutorials#Q._How_can_I_make_my_objects_rotate_smoothly_You_mentioned_slerp_etc_
+        //how can I make my objects rotate smoothly?
+        if (!this->getControllableEntity())
+            return;
+        Quaternion myOrient = this->getControllableEntity()->getOrientation();
+        this->rotationProgress_ += dt;
+
+        if (this->rotationProgress_ > 1)
+        {
+            this->rotationProgress_ = 0;
+            this->bHasTargetOrientation_ = false;
+        }
+        else
+        {
+            Quaternion deltaOrientation = Quaternion::Slerp(rotationProgress_, myOrient, orient, true);
+            
+            Matrix3 deltaMatrix, myMatrix;
+
+            deltaOrientation.ToRotationMatrix(deltaMatrix);
+            myOrient.ToRotationMatrix (myMatrix);
+
+            Radian yawDelta, pitchDelta, rollDelta, yawMy, pitchMy, rollMy;
+            deltaMatrix.ToEulerAnglesYXZ(yawDelta, pitchDelta, rollDelta);
+            myMatrix.ToEulerAnglesYXZ (yawMy, pitchMy, rollMy);
+
+            if (!this->getControllableEntity())
+                return;
+            this->getControllableEntity()->rotateRoll ((rollDelta.valueRadians() - rollMy.valueRadians())*ROTATEFACTOR*dt);
+        }
+    }
+    /**
+    @brief
+      roll ship so that it has same roll as a preset targetOrientation_
+    */
+    void FlyingController::copyTargetOrientation(float dt)
+    {
+        if (bHasTargetOrientation_)
+        {   
+            this->copyOrientation(targetOrientation_, dt);
+        }
+    }
+    /**
+    @brief
+      set Vector to fly to
+    */
+    void FlyingController::setTargetPosition(const Vector3& target)
+    {
+        this->targetPosition_ = target;
+        this->bHasTargetPosition_ = true;
+    }
+    /**
+    @brief
+      set orientation to apply
+    */
+    void FlyingController::setTargetOrientation(const Quaternion& orient)
+    {
+        this->targetOrientation_=orient;
+        this->bHasTargetOrientation_=true;
+    }
+    /**
+    @brief
+      set orientation to apply
+    */
+    void FlyingController::setTargetOrientation(ControllableEntity* target)
+    {
+        if (target)
+            this->setTargetOrientation(target->getOrientation());
+    }
+    /**
+    @brief
+      boost if you can
+    */
+    void FlyingController::boostControl()
+    {
+        if (!this->getControllableEntity())
+            return;
+        SpaceShip* ship = orxonox_cast<SpaceShip*>(this->getControllableEntity());
+        if(ship == NULL) return;
+        if(ship->getBoostPower()*1.5f > ship->getInitialBoostPower()) //upper limit ->boost
+        {
+            this->getControllableEntity()->boost(true);
+        }
+        else if(ship->getBoostPower()*4.0f < ship->getInitialBoostPower()) //lower limit ->do not boost
+        {
+           this->getControllableEntity()->boost(false);
+        }
+    }
+    /**
+    @brief
+      keep this ship in a formation with its division
+    */
+    void FlyingController::keepFormation(const ControllableEntity* leaderEntity, Vector3& targetRelativePosition)
+    {
+        if (!this->getControllableEntity())
+            return;
+        ControllableEntity* myEntity = this->getControllableEntity();
+        Vector3 myPosition = myEntity->getWorldPosition();
+
+        if (!leaderEntity)
+        {
+            return;
+        }
+        Quaternion orient = leaderEntity->getWorldOrientation();
+        Vector3 leaderPosition = leaderEntity->getWorldPosition();
+
+        if (!leaderEntity)
+        {
+            return;
+        }
+        //calculate where in world coordinates this ship should fly
+        Vector3 targetAbsolutePosition = 
+            (leaderPosition + (orient*WorldEntity::FRONT) * (leaderEntity->getVelocity().length()/5)
+             + (orient* (targetRelativePosition)));
+        //let ship finish rotating. also don't call copyOrientation too often as it is a slow function. Don't know how to do it different
+        if (this->bCopyOrientation_)
+            this->setTargetOrientation (orient);
+        //set a position to fly to
+        this->setTargetPosition (targetAbsolutePosition);
+
+        //boost if too far
+        if ((targetAbsolutePosition - myPosition).length() > this->tolerance_ * 1.5f)
+        {
+            this->boostControl();
+        }
+        else
+        {
+            if (!this->getControllableEntity())
+                return;
+            this->getControllableEntity()->boost(false);
+        }
+    }
+}
Index: code/branches/presentationHS15/src/orxonox/controllers/FlyingController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/FlyingController.h	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/FlyingController.h	(revision 10970)
@@ -0,0 +1,105 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      Dominik Solenicki
+ *
+ */
+
+#ifndef _FlyingController_H__
+#define _FlyingController_H__
+
+
+#include "controllers/CommonController.h"
+
+namespace orxonox
+{   
+    /**
+    @brief
+        FlyingController stores all the flying methods and member variables of AI.
+    */
+
+    //Formation mode for the divisions
+    namespace FormationMode
+    {
+        enum Value
+        {
+            FINGER4, DIAMOND, WALL
+        };
+    }
+
+    class _OrxonoxExport FlyingController : public CommonController
+    {
+
+        public:
+            static const float SPEED = 0.9f/0.02f;              //<! ship's speed
+            static const float ROTATEFACTOR = 0.6f/0.02f;       //<! ship's rotation factor
+ 
+            FlyingController(Context* context);
+            virtual ~FlyingController();
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            void setSpread (int spread)                         //<! spread is a multiplier for formation flight, should be bigger than 100
+                { this->spread_ = spread; }
+            int getSpread () const                              
+                { return this->spread_; }
+
+            void setFormationModeXML(std::string val);
+            std::string getFormationModeXML() const;
+
+            void setFormationMode(FormationMode::Value val)
+                { this->formationMode_ = val; }
+            FormationMode::Value getFormationMode() const
+                { return this->formationMode_; }
+            bool bCopyOrientation_;                             //<! set to true by default, MasterController sets it in its tick(),
+                                                                //<! if true, this will set its leader orientation as target orientation in action()
+        protected:
+            void stopMoving();                                  //<! don't call moveToTargetPosition() in tick, call lookAtTarget() from FightingController instead
+
+            void moveToPosition(const Vector3& target, float dt);   //<! move towards a vector
+            void moveToTargetPosition(float dt);                    //<! move to the preset position. Don't mix with positionOfTarget!
+
+            void copyOrientation(const Quaternion& orient, float dt);   //<! roll to have same roll as orient
+            void copyTargetOrientation(float dt);                       //<! roll to have a preset orient
+
+            void setTargetPosition(const Vector3& target);              //<! preset a Vector to fly to
+            void setTargetOrientation(const Quaternion& orient);        //<! preset a desired orientation
+            void setTargetOrientation(ControllableEntity* target);      //<! preset a desired orientation
+            virtual void boostControl();                                //<! boost if you can
+            void keepFormation (const ControllableEntity* leaderEntity, 
+                                Vector3& targetRelativePosition);   //<! preset targetPosition, so that 
+                                                                    //<! this stays in a certain position relative to leader      
+            
+            FormationMode::Value formationMode_;
+          
+            float rotationProgress_;    //<! for slerping 
+            bool bHasTargetPosition_;
+            Vector3 targetPosition_;    //<! vector to fly to
+            bool bHasTargetOrientation_;
+            Quaternion targetOrientation_;  //<! orientation to take
+            int spread_;                //<! spread is a multiplier for formation flight, should be bigger than 100
+            int tolerance_;             //<! if this ship is tolerance_ away from targetPosition_, ship decides that it finished moving
+    };
+}
+
+#endif /* _FlyingController_H__ */
Index: code/branches/presentationHS15/src/orxonox/controllers/FormationController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/FormationController.cc	(revision 10963)
+++ code/branches/presentationHS15/src/orxonox/controllers/FormationController.cc	(revision 10970)
@@ -277,5 +277,5 @@
         }
 
-        Vector2 coord = get2DViewcoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
+        Vector2 coord = get2DViewCoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
         float distance = (target - this->getControllableEntity()->getPosition()).length();
         float rotateX = clamp(coord.x * 10, -1.0f, 1.0f);
@@ -970,4 +970,6 @@
         if (controller)
         {
+            if (controller->getIdentifier()->getName() == "MasterController")
+                return true;
             FormationController* ac = orxonox_cast<FormationController*>(controller);
             if (ac)
@@ -981,4 +983,6 @@
         if (controller)
         {
+            if (controller->getIdentifier()->getName() == "MasterController")
+                return true;
             FormationController* ac = orxonox_cast<FormationController*>(controller);
             if (ac)
@@ -1069,5 +1073,5 @@
             return;
 
-        Vector2 coord = get2DViewcoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
+        Vector2 coord = get2DViewCoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
         float distance = (target - this->getControllableEntity()->getPosition()).length();
 
Index: code/branches/presentationHS15/src/orxonox/controllers/MasterController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/MasterController.cc	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/MasterController.cc	(revision 10970)
@@ -0,0 +1,131 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "MasterController.h"
+#include "controllers/ActionpointController.h"
+namespace orxonox
+{
+
+    RegisterClass(MasterController);
+
+    //Leaders share the fact that they have Wingmans
+    MasterController::MasterController(Context* context) : Controller(context)
+    {
+        RegisterObject(MasterController);
+        // orxout(internal_error) << "MasterController was created" << endl;
+
+        this->controllers_.clear();
+        this->numberOfTicksPassedSinceLastActionCall_ = 0;
+        this->indexOfCurrentController_ = 0;
+        this->ticks_ = 0;
+    }
+
+    MasterController::~MasterController()
+    {
+        this->controllers_.clear();
+    } 
+    void MasterController::tick(float dt)
+    {   
+        if (!this->isActive())
+            return;  
+        ++this->ticks_;
+        //orxout(internal_error) << "Tick = " << this->ticks_ << endl;
+        if (this->ticks_ == 1)
+        {
+            //fill the vector in the first tick
+            for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>::begin(); it; ++it)
+            {
+                //----0ptr?----
+                if (!it)
+                    continue;
+                this->controllers_.push_back(*it);
+            }
+            //orxout(internal_error) << "I got " << this->controllers_.size() << " controllers" << endl;
+        }
+        else
+        {
+
+            if (this->controllers_.empty())
+                return;
+
+            //iterate over vecotr with the index, keep index in boundaries 
+            if (this->indexOfCurrentController_ >= this->controllers_.size())
+            {
+                this->indexOfCurrentController_ = 0;
+            }
+            //each 9 ticks index is incremented
+            if (this->numberOfTicksPassedSinceLastActionCall_ >= 9)
+            {
+                this->numberOfTicksPassedSinceLastActionCall_ = 0;
+            }
+
+            if (this->numberOfTicksPassedSinceLastActionCall_ > 0)
+            {
+                //call maneuver for current index
+                if (this->numberOfTicksPassedSinceLastActionCall_ == 3)
+                {
+                    if (!this->controllers_.at(this->indexOfCurrentController_))
+                    {
+                        this->controllers_.erase(this->controllers_.begin() + this->indexOfCurrentController_);
+                        return;
+                    }
+                    //orxout (internal_error) << "Executing maneuver of Controller # " << this->indexOfCurrentController_ << endl;
+                    this->controllers_.at(this->indexOfCurrentController_)->maneuver();
+                }
+                else if (this->numberOfTicksPassedSinceLastActionCall_ == 6)
+                {
+                    //call canFire for current index
+                    if (!this->controllers_.at(this->indexOfCurrentController_))
+                    {
+                        this->controllers_.erase(this->controllers_.begin() + this->indexOfCurrentController_);
+                        return;
+                    }
+                    //orxout (internal_error) << "Executing maneuver of Controller # " << this->indexOfCurrentController_ << endl;
+                    this->controllers_.at(this->indexOfCurrentController_)->bShooting_ = this->controllers_.at(this->indexOfCurrentController_)->canFire();   
+                }
+                ++this->numberOfTicksPassedSinceLastActionCall_;
+            }
+            else
+            {
+                //call action for current index
+                if (!this->controllers_.at(this->indexOfCurrentController_))
+                {
+                    this->controllers_.erase(this->controllers_.begin() + this->indexOfCurrentController_);
+                    return;
+                }
+                //orxout (internal_error) << "Executing action of Controller # " << this->indexOfCurrentController_ << endl;
+                this->controllers_.at(this->indexOfCurrentController_)->action();    
+                //bCopyOrientation makes ship oscillate like crazy if set to true all the time.s
+                this->controllers_.at(this->indexOfCurrentController_)->bCopyOrientation_ = this->ticks_ % 3 == 0;
+
+                ++this->numberOfTicksPassedSinceLastActionCall_;
+                ++this->indexOfCurrentController_;
+            }
+        }
+    }
+}
Index: code/branches/presentationHS15/src/orxonox/controllers/MasterController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/MasterController.h	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/MasterController.h	(revision 10970)
@@ -0,0 +1,78 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _MasterController_H__
+#define _MasterController_H__
+
+#include "controllers/Controller.h"
+#include "controllers/ActionpointController.h"
+#include "tools/interfaces/Tickable.h"
+
+
+
+namespace orxonox
+{
+    /**
+    @brief
+      calles action(), maneuver() and canFire() methods of all the ActionpointControllers in level.
+      Only one instance of MasterController is to be placed in level.
+      If no MasterController is initialized, none of ActionpointControllers will work.
+      Example:
+      <Pawn position = "100000, 100000, 100000">
+        <controller>
+          <MasterController>
+          </MasterController>
+        </controller>
+      </Pawn>
+    */
+    class _OrxonoxExport MasterController : public Controller, public Tickable
+    {
+        public:
+            //----[language demanded functions]----            
+                MasterController(Context* context);
+
+                virtual ~MasterController();
+            //----[/language demanded functions]----            
+
+            //----[orxonox demanded functions]----
+                virtual void tick(float dt); 
+
+            //----[orxonox demanded functions]----
+
+        protected:
+          
+        private:
+            std::vector<WeakPtr<ActionpointController> > controllers_;  //<! vector of controllers, which action(), canFire() and maneuver() methods are to be called
+            size_t indexOfCurrentController_;                        //<! index of current controller
+            unsigned int numberOfTicksPassedSinceLastActionCall_;
+            unsigned int ticks_;                                     //<! local tick counter            
+
+    };
+}
+
+#endif /* _MasterController_H__ */
Index: code/branches/presentationHS15/src/orxonox/controllers/SectionController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/SectionController.cc	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/SectionController.cc	(revision 10970)
@@ -0,0 +1,290 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "SectionController.h"
+
+namespace orxonox
+{
+
+    RegisterClass(SectionController);
+
+    //Leaders share the fact that they have Wingmans
+    SectionController::SectionController(Context* context) : ActionpointController(context)
+    {
+        RegisterObject(SectionController);
+        this->setFormationMode(FormationMode::FINGER4);
+
+        this->myWingman_ = 0;
+        this->myDivisionLeader_ = 0;
+        this->bFirstAction_ = true;
+
+    }
+   
+    SectionController::~SectionController()
+    {
+       for (size_t i = 0; i < this->actionpoints_.size(); ++i)
+        {
+            if(this->actionpoints_[i])
+                this->actionpoints_[i]->destroy();
+        }
+        this->parsedActionpoints_.clear();
+        this->actionpoints_.clear();
+    }
+    void SectionController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(SectionController, XMLPort, xmlelement, mode);
+    }
+
+    //----in tick, move (or look) and shoot----
+    void SectionController::tick(float dt)
+    {
+        if (!this->isActive())
+            return;
+   
+        SUPER(SectionController, tick, dt);
+        
+    }
+
+    void SectionController::action()
+    {
+        if (!this || !this->getControllableEntity() || !this->isActive())
+            return;
+
+        //----If no leader, find one----  
+        if (!myDivisionLeader_)
+        {
+            ActionpointController* newDivisionLeader = findNewDivisionLeader();
+            if (!this || !this->getControllableEntity())
+                return;
+
+            this->myDivisionLeader_ = newDivisionLeader;
+            //spread copyOrientation called equally among the division
+
+        }
+        //----If have leader----
+        else
+        {
+        }
+        if (!myDivisionLeader_)
+        {
+            ActionpointController::action();
+            if (!this || !this->getControllableEntity())
+                return;
+            if (!(this->parsedActionpoints_.empty() && this->loopActionpoints_.empty()))
+            {
+                if (this->myWingman_)
+                {
+                    this->myWingman_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
+                }    
+            }
+        }
+        else if (myDivisionLeader_)
+        {
+            if (this->myDivisionLeader_->bKeepFormation_ || !(this->myDivisionLeader_->getAction() == Action::FIGHT 
+                || this->myDivisionLeader_->getAction() == Action::FIGHTALL
+                || this->myDivisionLeader_->getAction() == Action::ATTACK))
+            {
+                this->keepFormation();
+                //orxout (internal_error) << "Keeping formation" << endl;
+
+            }
+            else if (!this->myDivisionLeader_->bKeepFormation_)
+            {
+                if (!this || !this->getControllableEntity())
+                    return;
+
+                if (!this->hasTarget())
+                {
+                    this->chooseTarget(); 
+                }
+
+            }
+        }
+
+    }
+
+    
+    //PRE: myDivisionLeader_ != 0 && myDivisionLeader_->action_ == Action::FIGHT
+    //POST: this->target_ is set unless division leader doesn't have one
+    void SectionController::chooseTarget()
+    {
+        //----If division leader fights, cover him by fighting emenies close to his target----
+        Action::Value action = this->myDivisionLeader_->getAction();
+
+        if (action == Action::FIGHT || action == Action::FIGHTALL || action == Action::ATTACK)
+        {
+            Pawn* target;
+            //----if he has a target----
+            if (this->myDivisionLeader_->hasTarget())
+            {
+                //----try to find a new target if division leader has wingman (doing fine) and no good target already set----
+                if ( this->myDivisionLeader_->hasWingman() && 
+                    !( this->hasTarget() && this->getTarget() != this->myDivisionLeader_->getTarget() ) )
+                {
+                    bool foundTarget = false;
+                    //----new target should be close to division's target----
+                    Vector3 divisionTargetPosition = this->myDivisionLeader_->getTarget()->getWorldPosition();
+                    Gametype* gt = this->getGametype();
+                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+                    {
+                        //----is enemy?----
+                        if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP), gt) )
+                            continue;           
+                        //----in range?----
+                        if (((*itP)->getWorldPosition() - divisionTargetPosition).length() < 3000 && 
+                            (*itP) != this->myDivisionLeader_->getTarget())
+                        {
+                            foundTarget = true;
+                            target =  (*itP);
+                            //orxout(internal_error) << "Found target" << endl;
+                            break; 
+                        }
+                    }
+                    //----no target? then attack same target as division leader----
+                    if (!foundTarget)
+                    {
+                        target = orxonox_cast<Pawn*>(this->myDivisionLeader_->getTarget());
+                    }
+                }
+                //----if division leader doesn't have a wingman, support his fire----
+                else
+                {
+                    target = orxonox_cast<Pawn*>(this->myDivisionLeader_->getTarget());
+                }
+            }
+            //----If he fights but doesn't have a target, wait for him to get one----
+            else
+            {
+
+            }
+            this->setTarget (orxonox_cast<ControllableEntity*>(target));
+        }
+        else
+        {
+        } 
+    }
+    Vector3 SectionController::getFormationPosition ()
+    {
+        this->setFormationMode( this->myDivisionLeader_->getFormationMode() );
+        this->spread_ = this->myDivisionLeader_->getSpread();
+        Vector3* targetRelativePosition;
+        switch (this->formationMode_){
+            case FormationMode::WALL:
+            {
+                targetRelativePosition = new Vector3 (-2*this->spread_, 0, 0);   
+                break;
+            }
+            case FormationMode::FINGER4: 
+            {
+                targetRelativePosition = new Vector3 (-2*this->spread_, 0, this->spread_);   
+                break;
+            }
+            
+            case FormationMode::DIAMOND: 
+            {
+                targetRelativePosition = new Vector3 (-2*this->spread_, 0, this->spread_);                   
+                break;
+            }
+        }
+        Vector3 result = *targetRelativePosition;
+        delete targetRelativePosition;
+        return result;
+    }
+
+    void SectionController::keepFormation()
+    {
+        this->bKeepFormation_ = true;
+        ControllableEntity* leaderEntity = this->myDivisionLeader_->getControllableEntity();
+        Vector3 targetRelativePosition = this->getFormationPosition();
+        if (!leaderEntity)
+            return;
+        FlyingController::keepFormation(leaderEntity, targetRelativePosition);
+    }
+
+    ActionpointController* SectionController::findNewDivisionLeader()
+    {
+
+        if (!this->getControllableEntity())
+            return 0;
+
+        ActionpointController* closestLeader = 0;
+        float minDistance =  std::numeric_limits<float>::infinity();
+        //go through all pawns
+        for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>::begin(); it; ++it)
+        {
+            //0ptr or not DivisionController?
+            if (!(it) || !((it)->getIdentifier()->getName() == "DivisionController") || !(it->getControllableEntity()))
+                continue;
+            //same team?
+            if ((this->getControllableEntity()->getTeam() != (it)->getControllableEntity()->getTeam()))
+                continue;
+
+            //is equal to this?
+            if (orxonox_cast<ControllableEntity*>(*it) == this->getControllableEntity())
+                continue;
+
+            float distance = CommonController::distance (it->getControllableEntity(), this->getControllableEntity());
+            
+            if (distance < minDistance && !(it->hasFollower()))
+            {
+                closestLeader = *it;
+                minDistance = distance;
+            }
+          
+        }
+        if (closestLeader)
+        {
+            if (closestLeader->setFollower(this))
+                return closestLeader;
+        }
+        return 0;
+    }
+
+    bool SectionController::setWingman(ActionpointController* newWingman)
+    {
+
+        if (!this->myWingman_)
+        {
+            this->myWingman_ = newWingman;
+            newWingman->takeActionpoints (this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+    
+    bool SectionController::hasWingman()
+    {
+        if (this->myWingman_)
+            return true;
+        else
+            return false;
+    }
+}
Index: code/branches/presentationHS15/src/orxonox/controllers/SectionController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/SectionController.h	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/SectionController.h	(revision 10970)
@@ -0,0 +1,78 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _SectionController_H__
+#define _SectionController_H__
+
+#include "controllers/ActionpointController.h"
+
+
+namespace orxonox
+{
+    /**
+        @note
+        ActionpointController will not work, if there is no MasterController in the level!
+    */
+    class _OrxonoxExport SectionController : public ActionpointController
+    {
+        public:
+            //----[language demanded functions]----            
+                SectionController(Context* context);
+
+                virtual ~SectionController();
+            //----[/language demanded functions]----
+            
+            //----[orxonox demanded functions]----
+                virtual void tick(float dt); 
+                
+                virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            //----[/orxonox demanded functions]----
+            
+            //----[own functions]----
+                ActionpointController* findNewDivisionLeader();
+
+                virtual bool setWingman(ActionpointController* newWingman);
+                virtual bool hasWingman();
+                virtual bool hasFollower()
+                    { return false; }
+                void chooseTarget();
+            //----[/own functions]----
+
+        protected:       
+            //----action must only be managed by this----     
+                virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour.
+                Vector3 getFormationPosition ();
+                void keepFormation();
+        private:
+            //----private variables-----
+                bool bFirstAction_;
+                
+    };
+}
+
+#endif /* _SectionController_H__ */
Index: code/branches/presentationHS15/src/orxonox/controllers/WingmanController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/WingmanController.cc	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/WingmanController.cc	(revision 10970)
@@ -0,0 +1,233 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "WingmanController.h"
+
+
+namespace orxonox
+{
+
+    RegisterClass(WingmanController);
+    
+    //ActionpointController contains all common functionality of AI Controllers
+    WingmanController::WingmanController(Context* context) : ActionpointController(context)
+    {
+        RegisterObject(WingmanController);
+        this->myLeader_ = 0;
+        this->bFirstAction_ = true;
+
+    }
+
+    WingmanController::~WingmanController()
+    {
+        for (size_t i = 0; i < this->actionpoints_.size(); ++i)
+        {
+            if(this->actionpoints_[i])
+                this->actionpoints_[i]->destroy();
+        }
+        this->parsedActionpoints_.clear();
+        this->actionpoints_.clear();
+    }
+  
+    void WingmanController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(WingmanController, XMLPort, xmlelement, mode);
+    }
+    
+    //----in tick, move (or look) and shoot----
+    void WingmanController::tick(float dt)
+    {   
+        if (!this->isActive())
+            return; 
+        
+        SUPER(WingmanController, tick, dt);
+
+    }
+    
+    //----action for hard calculations----
+    void WingmanController::action()
+    {
+        if (!this || !this->getControllableEntity() || !this->isActive())
+            return;
+        //----If no leader, find one----
+        if (!this->myLeader_)
+        {
+            ActionpointController* newLeader = (findNewLeader());
+            if (!this || !this->getControllableEntity())
+                return;
+
+            this->myLeader_ = newLeader;
+            if (this->myLeader_)
+            {
+               
+            }
+        }
+        //----If have leader, he will deal with logic----
+        else
+        {
+
+        }
+        if (!this->myLeader_)
+        {
+            ActionpointController::action();
+        }
+        else if (this->myLeader_)
+        {
+            if (this->myLeader_->bKeepFormation_ || !(this->myLeader_->getAction() == Action::FIGHT || this->myLeader_->getAction() == Action::FIGHTALL
+                || this->myLeader_->getAction() == Action::ATTACK))
+            {
+                this->keepFormation();
+            }
+            else if (!this->myLeader_->bKeepFormation_)
+            {
+                if (!this || !this->getControllableEntity())
+                    return;
+
+                if (!this->hasTarget())
+                {
+                    this->setTarget(this->myLeader_->getTarget());
+                }
+                
+            }
+        }
+    }
+     
+   
+    Vector3 WingmanController::getFormationPosition ()
+    {
+
+
+        this->setFormationMode( this->myLeader_->getFormationMode() );
+        Vector3* targetRelativePosition;
+        this->spread_ = this->myLeader_->getSpread();
+        if (this->myLeader_->getIdentifier()->getName() == "DivisionController")
+        {
+            switch (this->formationMode_){
+                case FormationMode::WALL:
+                {
+                    targetRelativePosition = new Vector3 (2*this->spread_, 0, 0 - this->tolerance_);  
+                    break;
+                }
+                case FormationMode::FINGER4: 
+                {
+                    targetRelativePosition = new Vector3 (2*this->spread_, 0, this->spread_ - this->tolerance_);  
+                    break;
+                }
+                case FormationMode::DIAMOND: 
+                {
+                    targetRelativePosition = new Vector3 (2*this->spread_, 0, this->spread_ - this->tolerance_);                  
+                    break;
+                }
+            }
+        }
+        else
+        {
+
+            switch (this->formationMode_){
+                case FormationMode::WALL:
+                {
+                    targetRelativePosition = new Vector3 (-2*this->spread_, 0, 0 - this->tolerance_);  
+                    break;
+                }
+                case FormationMode::FINGER4: 
+                {
+                    targetRelativePosition = new Vector3 (-2*this->spread_, 0, this->spread_ - this->tolerance_);  
+                    break;
+                }
+                case FormationMode::DIAMOND: 
+                {
+                    targetRelativePosition = new Vector3 (2*this->spread_, -this->spread_, 0 - this->tolerance_);                  
+                    break;
+                }
+            }
+        }
+        Vector3 result = *targetRelativePosition;
+        delete targetRelativePosition;
+        return result;
+    }
+    void WingmanController::keepFormation()
+    {
+        this->bKeepFormation_ = true;
+        ControllableEntity* leaderEntity = this->myLeader_->getControllableEntity();
+        Vector3 targetRelativePosition = this->getFormationPosition();
+        if (!leaderEntity)
+            return;
+        FlyingController::keepFormation (leaderEntity, targetRelativePosition);
+    }
+    //----POST: closest leader that is ready to take a new wingman is returned----
+    ActionpointController* WingmanController::findNewLeader()
+    {
+
+        if (!this->getControllableEntity())
+            return 0;
+
+        //----vars for finding the closest leader----
+        ActionpointController* closestLeader = 0;
+        float minDistance =  std::numeric_limits<float>::infinity();
+        Gametype* gt = this->getGametype();
+
+        for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>::begin(); it; ++it)
+        {
+            //----0ptr or not a leader or dead?----
+            if (!it || 
+                (it->getIdentifier()->getName() != "SectionController" && it->getIdentifier()->getName() != "DivisionController") || 
+                !(it->getControllableEntity()))
+                continue;
+            
+            //----same team?----
+            if ( !CommonController::sameTeam (this->getControllableEntity(), (it)->getControllableEntity(), gt) )
+                continue;
+            
+            //----check distance----
+            float distance = CommonController::distance (it->getControllableEntity(), this->getControllableEntity());
+            if (distance < minDistance && !(it->hasWingman()))
+            {
+                closestLeader = *it;
+                minDistance = distance;
+            }
+        }
+        if (closestLeader)
+        {
+            //----Racing conditions----
+            if (closestLeader->setWingman(orxonox_cast<ActionpointController*>(this)))
+            {
+                if (closestLeader->getIdentifier()->getName() == "SectionController")
+                {
+                    this->actionTime_ = 1.6f;
+                }
+                else
+                {
+                    this->actionTime_ = 2.0f;
+                }
+                return closestLeader;
+            }
+        }
+        return 0;
+    }
+
+}
Index: code/branches/presentationHS15/src/orxonox/controllers/WingmanController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/WingmanController.h	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/controllers/WingmanController.h	(revision 10970)
@@ -0,0 +1,81 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _WingmanController_H__
+#define _WingmanController_H__
+
+
+#include "controllers/ActionpointController.h"
+
+
+namespace orxonox
+{
+    /**
+        @note
+        ActionpointController will not work, if there is no MasterController in the level!
+    */
+    class _OrxonoxExport WingmanController : public ActionpointController
+    {
+        public:
+            //----[language demanded functions]----
+                WingmanController(Context* context);
+
+                virtual ~WingmanController();
+            //----[/language demanded functions]----
+            
+            //----[orxonox demanded functions]----
+                virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+                virtual void tick(float dt); 
+                virtual bool hasWingman()
+                    { return false; }
+                virtual bool hasFollower()
+                    { return false; }
+            //----[/orxonox demanded functions]----
+
+            //----[own functions]----
+               ActionpointController* findNewLeader();
+            //----[/own functions]----
+
+        protected:
+            //----action must only be managed by this----
+                virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour.
+                Vector3 getFormationPosition ();
+                void keepFormation();
+                
+        private:
+            //----private variables-----
+                WeakPtr<ActionpointController> myLeader_;
+                bool bFirstAction_;
+                float actionTime_;
+
+
+    };
+}
+
+#endif /* _WingmanController_H__ */
Index: code/branches/presentationHS15/src/orxonox/worldentities/Actionpoint.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/worldentities/Actionpoint.cc	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/worldentities/Actionpoint.cc	(revision 10970)
@@ -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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "Actionpoint.h"
+
+namespace orxonox
+{
+    RegisterClass(Actionpoint);
+
+    Actionpoint::Actionpoint(Context* context) : StaticEntity(context)
+    {
+        RegisterObject(Actionpoint);
+        
+        this->actionName_ = "";
+        this->name_ = "";
+        
+        this->bLoopStart_ = false;
+        this->bLoopEnd_ = false;
+        this->bProtectMe_ = false;
+    }
+    
+    void Actionpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Actionpoint, XMLPort, xmlelement, mode);
+        
+        XMLPortParam(Actionpoint, "action", setActionXML, getActionXML,  xmlelement, mode);
+        XMLPortParam(Actionpoint, "protect", setProtectXML, getProtectXML,  xmlelement, mode);
+        XMLPortParam(Actionpoint, "attack", setAttackXML, getAttackXML,  xmlelement, mode);
+        XMLPortParam(Actionpoint, "protectMe", setProtectMeXML, getProtectMeXML,  xmlelement, mode).defaultValues(false);
+        XMLPortParam(Actionpoint, "loopStart", setLoopStart, getLoopStart,  xmlelement, mode).defaultValues(false);
+        XMLPortParam(Actionpoint, "loopEnd", setLoopEnd, getLoopEnd,  xmlelement, mode).defaultValues(false);
+    }
+    /**
+    @brief
+        action is ATTACK -> returns name of object to attack
+        action is PROTECT -> returns name of object to protect 
+        if asked to protect human, returns a special string.
+    @return
+        name of an object to interact with.
+    @note
+        never use more than one of following arguments for XMLPort:
+        attack, protect, protectMe or
+        loopStart and loopEnd.
+    */
+    std::string Actionpoint::getName() const
+    {
+        if (this->name_ != "")
+        {
+            return this->name_;
+        }
+        else if (this->bProtectMe_)
+        {
+            return "reservedKeyword:human";
+        }
+        else
+        {
+            return "";
+        }
+    }    
+}
Index: code/branches/presentationHS15/src/orxonox/worldentities/Actionpoint.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/worldentities/Actionpoint.h	(revision 10970)
+++ code/branches/presentationHS15/src/orxonox/worldentities/Actionpoint.h	(revision 10970)
@@ -0,0 +1,156 @@
+/*
+ *   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:
+ *      Gani Aliguzhinov
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Actionpoint_H__
+#define _Actionpoint_H__
+
+#include <string>                           //need string for XML input
+
+#include "core/XMLPort.h"                   //need XMLPort
+#include "worldentities/StaticEntity.h"     //this is a child of StaticEntity
+
+namespace orxonox
+{ 
+    /**
+    @brief
+        Actionpoints are used by ActionpointController and all derived classes.
+        Such classes will execute actions set in Actionpoints.
+
+        In XML file one can pass an array of Actionpoints to a controller. Each
+        Actionpoint can take action type, string and boolean or 
+        action and two booleans as an argument.
+        If action is set to fly, Actionpoint's position is assumed to be the desired
+        location.
+        Example XML code:
+
+        <SpaceShip position="-2000, 1500, -1000" lookat="0,0,0" team=0 name="thisShipName">
+          <templates>
+            <Template link=spaceshipassff />
+          </templates>
+          <controller>
+            <DivisionController team=0 formationMode="WALL">
+              <actionpoints>
+                <Actionpoint position="0,0,0" action="FLY" /> 
+                <Actionpoint position="-1000,750,-500" action="ATTACK" attack="someShipName" />
+                <Actionpoint position="-1000,750,-500" action="PROTECT" protectMe=true />
+                <Actionpoint position="-1000,750,-500" action="PROTECT" protect="otherShipName" /> 
+                <Actionpoint position="-1000,750,-500" action="FIGHTALL" />
+               </actionpoints>
+            </DivisionController>
+          </controller>
+        </SpaceShip>
+        
+        Example with loops:
+
+        <SpaceShip position="-1500, 1500, -1000" lookat="0,0,0" team=0 name="thisShipName">
+          <templates>
+            <Template link=spaceshipassff />
+          </templates>
+          <controller>
+            <DivisionController team=0 formationMode="finger4">
+              <actionpoints>
+                <Actionpoint position="  0,2000,-600" action="FLY" loopStart=true/>
+                <Actionpoint position="  0,2000,-700" action="FLY"  />
+                <Actionpoint position="100,2000,-700" action="FLY" />
+                <Actionpoint position="100,2000,-600" action="FLY" loopEnd=true />
+              </actionpoints>
+            </DivisionController>
+          </controller>
+        </SpaceShip>
+        
+        One can also use other Worldentities instead of Actionpoints just like Waypoints, but those points
+        will be included in loop.
+        For more information read descriptions of the methods.
+    */
+    class _OrxonoxExport Actionpoint : public StaticEntity
+    {
+        public:
+            Actionpoint(Context* context);
+            virtual ~Actionpoint() {}
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            /** @brief Decides what AI will do. @param val action to execute */
+            void setActionXML(std::string val)
+                { this->actionName_ = getUppercase (val); }
+            std::string getActionXML() const
+                { return this->actionName_; }
+
+            /** @brief Makes AI follow an entity. @param val name of entity to protect */
+            void setProtectXML(std::string val)
+                { this->name_ = val; }
+            std::string getProtectXML() const
+                { return this->name_; }
+
+            /** @brief Makes AI attack an entity. @param val name of entity to attack */
+            void setAttackXML(std::string val)
+                { this->name_ = val; }
+            std::string getAttackXML() const
+                { return this->name_; }
+
+            /** @brief Makes AI follow human player. @param c protect Human? */
+            void setProtectMeXML(bool c)
+                { this->bProtectMe_ = c; }
+            bool getProtectMeXML() const
+                { return this->bProtectMe_; }
+
+            /** @brief Starts a loop of Actionpoints. @param value start loop? */
+            void setLoopStart(bool value)
+                { this->bLoopStart_ = value; }
+            bool getLoopStart() const
+                { return this->bLoopStart_; }
+            /** @brief Ends a loop of Actionpoints. @param value end loop? */
+            void setLoopEnd (bool value)
+                { this->bLoopEnd_ = value; }
+            bool getLoopEnd() const
+                { return this->bLoopEnd_; }
+
+            std::string getName() const;
+
+        private:    
+            std::string actionName_;    //!< can be set to "FLY", "ATTACK",
+                                        //!< "PROTECT", "FIGHT", "FIGHTALL"
+                                        //!< or "NONE".
+
+            std::string name_;          //!< name of the ship that is to be
+                                        //!< attacked or protected.
+
+            bool bLoopStart_;           //!< if true, this and all following Actionpoints
+                                        //!< until the first Actionpoint with bLoopEnd_
+                                        //!< set to true are executed in a loop.
+
+            bool bLoopEnd_;             //!< if true, this is the last element of
+                                        //!< a loop started by loopStart=true argument
+
+            bool bProtectMe_;           //!< if player is to be protected,
+                                        //!< instead of passing name, one has
+                                        //!< to set protectMe to true.
+    };
+}
+
+#endif /* _Actionpoint_H__ */
Index: code/branches/presentationHS15/src/orxonox/worldentities/CMakeLists.txt
===================================================================
--- code/branches/presentationHS15/src/orxonox/worldentities/CMakeLists.txt	(revision 10963)
+++ code/branches/presentationHS15/src/orxonox/worldentities/CMakeLists.txt	(revision 10970)
@@ -12,4 +12,5 @@
   TeamSpawnPoint.cc
   ExplosionPart.cc
+  Actionpoint.cc
 )
 
Index: code/branches/presentationHS15/src/orxonox/worldentities/SpawnPoint.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/worldentities/SpawnPoint.h	(revision 10963)
+++ code/branches/presentationHS15/src/orxonox/worldentities/SpawnPoint.h	(revision 10970)
@@ -55,5 +55,5 @@
                 { return this->template_; }
 
-            Pawn* spawn();
+            virtual Pawn* spawn();
             void spawn(ControllableEntity* entity);
 
Index: code/branches/presentationHS15/src/orxonox/worldentities/TeamSpawnPoint.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/worldentities/TeamSpawnPoint.cc	(revision 10963)
+++ code/branches/presentationHS15/src/orxonox/worldentities/TeamSpawnPoint.cc	(revision 10970)
@@ -49,3 +49,9 @@
         XMLPortParam(TeamSpawnPoint, "team", setTeamNumber, getTeamNumber, xmlelement, mode).defaultValues(0);
     }
+    Pawn* TeamSpawnPoint::spawn()
+    {
+        Pawn* entity = SpawnPoint::spawn();
+        static_cast<ControllableEntity*>(entity)->setTeam (this->teamNumber_);
+        return entity;
+    }
 }
Index: code/branches/presentationHS15/src/orxonox/worldentities/TeamSpawnPoint.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/worldentities/TeamSpawnPoint.h	(revision 10963)
+++ code/branches/presentationHS15/src/orxonox/worldentities/TeamSpawnPoint.h	(revision 10970)
@@ -49,7 +49,8 @@
             unsigned int getTeamNumber() const
                 { return this->teamNumber_; }
+            virtual Pawn* spawn();
 
         private:
-            unsigned int teamNumber_;
+            int teamNumber_;
     };
 }
Index: code/branches/presentationHS15/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/worldentities/pawns/Pawn.h	(revision 10963)
+++ code/branches/presentationHS15/src/orxonox/worldentities/pawns/Pawn.h	(revision 10970)
@@ -201,4 +201,7 @@
             const std::string& getExplosionSound();
 
+            virtual const WeaponSystem* getWeaponSystem() const
+                { return this->weaponSystem_; }
+
         protected:
             virtual void preDestroy();
