Index: branches/ai/src/ai/Makefile.am
===================================================================
--- branches/ai/src/ai/Makefile.am	(revision 10112)
+++ branches/ai/src/ai/Makefile.am	(revision 10135)
@@ -8,4 +8,5 @@
 			ai_module.cc \
 			ai_team.cc \
+			ai_swarm.cc \
 			ai_team_member.cc \
 			movement_module.cc \
@@ -16,4 +17,5 @@
 			ai_module.h \
 			ai_team.h \
+			ai_swarm.h \
 			ai_team_member.h \
 			movement_module.h \
Index: branches/ai/src/ai/ai_engine.cc
===================================================================
--- branches/ai/src/ai/ai_engine.cc	(revision 10112)
+++ branches/ai/src/ai/ai_engine.cc	(revision 10135)
@@ -22,46 +22,47 @@
 AIEngine* AIEngine::singletonRef = NULL;
 
+AIEngine::AIEngine(){
+	for(int i=0; i < maxTeams; i++ )teams[i]=NULL;
+}
 
-AIEngine::AIEngine()
-{}
+AITeam* AIEngine::getTeam(int teamNumber)
+{
+	if(teamNumber>maxTeams || teamNumber<0)return NULL;
+	return teams[teamNumber];
+}
 
-AIEngine::~AIEngine()
-{}
-
-
-
-/*AITeam* AIEngine::newTeam()
+AITeam* AIEngine::getCreateTeam(int teamNumber)
 {
-	AITeam* newTeam=new AITeam;
-	teams.push_back(newTeam);
-	return newTeam;
-}*/
-int AIEngine::newTeam()
-{
-	AITeam* newTeam=new AITeam;
-	teams.push_back(newTeam);
-	return teams.size()-1;
+	if(teamNumber>maxTeams || teamNumber<0)return NULL;
+	if(teams[teamNumber]==NULL)teams[teamNumber]=new AITeam();
+	return teams[teamNumber];
 }
 
 
-
-AITeam* AIEngine::getTeam(int aiTeamNumber)
+void AIEngine::addTeam(int teamNumber)
 {
- 	//if(teams.size()>aiTeamNumber)
-	return teams.at(aiTeamNumber);
-	//return NULL;
+	if(teamNumber>maxTeams || teamNumber<0)return;
+	teams[teamNumber]=new AITeam();
 }
 
 
+void AIEngine::removeTeam(int teamNumber)
+{
+	if(teamNumber>maxTeams || teamNumber<0)return;
+	teams[teamNumber]=NULL;
+}
 
-void AIEngine::tick(float dtS)
+
+void AIEngine::tick(float dt)
 {
-	this->dtS=dtS;
-	int teamCount=teams.size();
-	for(int i=0; i < teamCount; i++ )
-	{
-		//std::cout << "hello";
-   	//std::cout << "DT " << dtS <<  "...\n";
-   	teams.at(i)->process();
-	}
+	for(int i=0; i < maxTeams; i++ )
+		if(teams[i]!=NULL)teams[i]->process(dt);
 }
+
+
+void AIEngine::rebuildAIVector(){
+	//AIVector.clear();
+
+	//for(int i=0; i < maxTeams; i++ )
+		//if(teams[i]!=NULL)AIVector.push_back(teams[i]);
+}
Index: branches/ai/src/ai/ai_engine.h
===================================================================
--- branches/ai/src/ai/ai_engine.h	(revision 10112)
+++ branches/ai/src/ai/ai_engine.h	(revision 10135)
@@ -9,20 +9,25 @@
 class AIEngine{
  public:
-   ~AIEngine();
+	~AIEngine(){}
 
    static AIEngine* getInstance() { if( singletonRef == NULL) singletonRef = new AIEngine(); return singletonRef; }
 
-   void tick(float dtS);
-   AITeam* getTeam(int);
-	int newTeam();
-	float dtS;
+   void tick(float dt);
+
+	void addTeam(int teamNumber);
+	void removeTeam(int teamNumber);
+	AITeam* getTeam(int teamNumber);
+	AITeam* getCreateTeam(int teamNumber);
+
  private:
+	void rebuildAIVector();
+
+	std::vector<AIModule*> AIVector;
+
+	static const int maxTeams=32;
+	AITeam* teams[32];
 	AIEngine();
 
- private:
-   std::vector<AITeam*> teams;
-
-   static AIEngine* singletonRef;
-
+	static AIEngine* singletonRef;
 };
 
Index: branches/ai/src/ai/ai_module.h
===================================================================
--- branches/ai/src/ai/ai_module.h	(revision 10112)
+++ branches/ai/src/ai/ai_module.h	(revision 10135)
@@ -9,16 +9,24 @@
 
 
-class AIModule{
+class AIModule {
  public:
    AIModule();
    virtual ~AIModule() {}
+
    virtual void process() {}
    virtual void process(float dt) {}
+
    void setDifficulty(int newDifficulty);
    void setOwner(AITeamMember* newOwner);
+
+
  protected:
    int difficulty;
+	int myTeam;
+	int mySwarm;
+
    AITeamMember* owner;
    NPC2* myNPC;
+	WorldEntity* myWorldEnity;
 };
 
Index: branches/ai/src/ai/ai_swarm.cc
===================================================================
--- branches/ai/src/ai/ai_swarm.cc	(revision 10135)
+++ branches/ai/src/ai/ai_swarm.cc	(revision 10135)
@@ -0,0 +1,56 @@
+
+
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   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, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: Thomas Fahrni
+   co-programmer:
+*/
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_AI
+
+#include "ai_swarm.h"
+
+
+void AISwarm::process(float dt)
+{
+	Vector swarmCenter;
+
+	for(unsigned int i=0;i<swarmMembers.size();i++){
+		//swarmCenter=swarmCenter+swarmMembers.at(i)->getPosition();
+	}
+	swarmCenter=swarmCenter/swarmMembers.size();
+
+	for(unsigned int i=0;i<swarmMembers.size();i++)
+		swarmMembers.at(i)->process(dt);
+}
+
+
+void AISwarm::addToSwarm(AIModule* newMember)
+{
+	swarmMembers.push_back(newMember);
+}
+
+
+void AISwarm::removeFromSwarm(AIModule* member)
+{
+	std::vector<AIModule*>::iterator it = this->swarmMembers.begin();
+	for(; it < this->swarmMembers.end(); it++) {
+
+// 	for(unsigned int i=0;i<swarmMembers.size();i++){
+		if(*it==member){
+			swarmMembers.erase(it);
+			return;
+		}
+	}
+}
+
+
+
Index: branches/ai/src/ai/ai_swarm.h
===================================================================
--- branches/ai/src/ai/ai_swarm.h	(revision 10135)
+++ branches/ai/src/ai/ai_swarm.h	(revision 10135)
@@ -0,0 +1,20 @@
+
+#ifndef _AI_SWARM_H
+#define _AI_SWARM_H
+
+//class AITeamMember;
+#include "ai_team_member.h"
+class NPC2;
+
+class AISwarm{
+	public:
+		AISwarm(){};
+		~AISwarm(){};
+		void process(float dt);
+		void addToSwarm(AIModule* newMember);
+		void removeFromSwarm(AIModule* member);
+	private:
+		std::vector<AIModule*> swarmMembers;
+};
+
+#endif /* _AI_SWARM_H */
Index: branches/ai/src/ai/ai_team.cc
===================================================================
--- branches/ai/src/ai/ai_team.cc	(revision 10112)
+++ branches/ai/src/ai/ai_team.cc	(revision 10135)
@@ -19,29 +19,44 @@
 #include "ai_team.h"
 
-AITeam::AITeam()
-{}
+AITeam::AITeam(){
+	for(int i=0; i < maxSwarms; i++ )swarms[i]=NULL;
+}
 
-AITeam::~AITeam()
-{}
 
-void AITeam::process()
+AISwarm* AITeam::getSwarm(int swarmNumber)
 {
-	int teamSize=teamMembers.size();
-	for(int i=0; i < teamSize; i++ )
-	{
-   	//std::cout << "Processing TeamMember " << i <<  "...\n";
-   	teamMembers.at(i)->process();
+	if(swarmNumber>maxSwarms || swarmNumber<0)return NULL;
+	return swarms[swarmNumber];
+}
+
+
+AISwarm* AITeam::getCreateSwarm(int swarmNumber)
+{
+	if(swarmNumber>maxSwarms || swarmNumber<0)return NULL;
+	if(swarms[swarmNumber]==NULL)swarms[swarmNumber]=new AISwarm();
+	return swarms[swarmNumber];
+}
+
+
+void AITeam::addSwarm(int swarmNumber)
+{
+	if(swarmNumber>maxSwarms || swarmNumber<0)return;
+	swarms[swarmNumber]=new AISwarm();
+}
+
+
+void AITeam::removeSwarm(int swarmNumber)
+{
+	if(swarmNumber>maxSwarms || swarmNumber<0)return;
+	swarms[swarmNumber]=NULL;
+}
+
+
+void AITeam::process(float dt)
+{
+	for(int i=0; i < maxSwarms; i++ ){
+		if(swarms[i]!=NULL)swarms[i]->process(dt);
 	}
 }
 
 
-void AITeam::addMember(AITeamMember* newMember)
-{
-	teamMembers.push_back(newMember);
-}
-
-
-AITeamMember* AITeam::getTeamMember(int teamMemberID)
-{
-	return teamMembers.at(teamMemberID);
-}
Index: branches/ai/src/ai/ai_team.h
===================================================================
--- branches/ai/src/ai/ai_team.h	(revision 10112)
+++ branches/ai/src/ai/ai_team.h	(revision 10135)
@@ -3,16 +3,20 @@
 #define _AI_TEAM_H
 
-//class AITeamMember;
-#include "ai_team_member.h"
+#include "ai_swarm.h"
 
 class AITeam{
  public:
-   AITeam();
-   ~AITeam();
-   void process();
-   void addMember(AITeamMember*);
-   AITeamMember* getTeamMember(int);
+	~AITeam(){};
+	AITeam();
+   void process(float dt);
+
+	void addSwarm(int swarmNumber);
+	void removeSwarm(int swarmNumber);
+	AISwarm* getSwarm(int swarmNumber);
+	AISwarm* getCreateSwarm(int swarmNumber);
+
  private:
-   std::vector<AITeamMember*> teamMembers;
+	AISwarm* swarms[32];
+	static const int maxSwarms=32;
 };
 
Index: branches/ai/src/ai/ai_team_member.cc
===================================================================
--- branches/ai/src/ai/ai_team_member.cc	(revision 10112)
+++ branches/ai/src/ai/ai_team_member.cc	(revision 10135)
@@ -14,51 +14,44 @@
 */
 
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_AI
-#include "ai_team_member.h"
-#include "movement_module.h"
-#include "ai_engine.h"
-#include "debug.h"
-
-
-AITeamMember::AITeamMember()
-{}
-
-AITeamMember::~AITeamMember()
-{}
-
-
-
-void AITeamMember::process()
-{
-	int moduleCount=modules.size();
-	for(int i=0; i < moduleCount; i++ )
-	{
-   	//std::cout << "Processing AIModule " << i << " (" << moduleCount << ")\n";
-   	modules.at(i)->process();
-	}
-}
-
-
-
-
-void AITeamMember::addToTeam(int aiTeamNumber)
-{
-	//macht nicht so ganz das was es eigntlich machen sollte..
-	AIEngine* aiEngine=AIEngine::getInstance();
-	int teamNumber=aiEngine->newTeam();
-	aiEngine->getTeam(teamNumber)->addMember(this);
-
-	MovementModule* nMod=new MovementModule;
-	addModule(nMod);
-	//nMod->testModule=nMod;
-}
-
-
-
-
-void AITeamMember::addModule(AIModule* newModule)
-{
-		std::cout << "AIModule added\n";
-		modules.push_back(newModule);
-		newModule->setOwner(this);
-}
+// #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_AI
+// #include "ai_team_member.h"
+// #include "movement_module.h"
+// #include "ai_engine.h"
+// #include "debug.h"
+//
+//
+//
+// void AITeamMember::process()
+// {
+// 	int moduleCount=modules.size();
+// 	for(int i=0; i < moduleCount; i++ )
+// 	{
+//    	//std::cout << "Processing AIModule " << i << " (" << moduleCount << ")\n";
+//    	modules.at(i)->process();
+// 	}
+// }
+//
+//
+//
+//
+// void AITeamMember::addToTeam(int aiTeamNumber)
+// {
+// 	//macht nicht so ganz das was es eigntlich machen sollte..
+// 	AIEngine* aiEngine=AIEngine::getInstance();
+// 	int teamNumber=aiEngine->newTeam();
+// 	aiEngine->getTeam(teamNumber)->addMember(this);
+//
+// 	MovementModule* nMod=new MovementModule;
+// 	addModule(nMod);
+// 	//nMod->testModule=nMod;
+// }
+//
+//
+//
+//
+// void AITeamMember::addModule(AIModule* newModule)
+// {
+// 		std::cout << "AIModule added\n";
+// 		modules.push_back(newModule);
+// 		newModule->setOwner(this);
+// }
Index: branches/ai/src/ai/ai_team_member.h
===================================================================
--- branches/ai/src/ai/ai_team_member.h	(revision 10112)
+++ branches/ai/src/ai/ai_team_member.h	(revision 10135)
@@ -8,14 +8,23 @@
 //class AIModule;
 
-class AITeamMember : public WorldEntity{
- public:
-   AITeamMember();
-   ~AITeamMember();
-
-   void process();
-   void addToTeam(int);
-   void addModule(AIModule*);
- private:
-   std::vector<AIModule*>          modules;
+class AITeamMember : public WorldEntity {
+//  public:
+// 	AITeamMember(){};
+// 	~AITeamMember(){};
+//
+//    void process();
+//    void addToTeam(int);
+//    void addModule(AIModule*);
+//
+// 	inline void setTeamNumber(int teamNumber){this->teamNumber=teamNumber;}
+// 	inline int getTeamNumber(){return this->teamNumber;}
+// 	inline void setSwarmNumber(int swarmNumber){this->swarmNumber=swarmNumber;}
+// 	inline int getSwarmNumber(){return this->swarmNumber;}
+//
+//  private:
+// 	 AIModule* aiModule;
+// 	 int teamNumber;
+// 	 int swarmNumber;
+// 	 int difficulty;
 };
 
Index: branches/ai/src/ai/movement_module.cc
===================================================================
--- branches/ai/src/ai/movement_module.cc	(revision 10112)
+++ branches/ai/src/ai/movement_module.cc	(revision 10135)
@@ -25,41 +25,41 @@
 
 #include "shell_command.h"
-SHELL_COMMAND(setDistanceToPlayer, MovementModule, setDistanceToPlayer);
-SHELL_COMMAND(setDistanceToNPC, MovementModule, setDistanceToNPC);
-SHELL_COMMAND(setMaxAccleartion, MovementModule, setMaxAccleartion);
-
-float MovementModule::distanceToPlayer=15;
-float MovementModule::distanceToNPC=2;
-float MovementModule::maxAccleration=200.0f;
-
-void MovementModule::setDistanceToPlayer(float newValue){ distanceToPlayer=newValue; }
-void MovementModule::setDistanceToNPC(float newValue){ distanceToNPC=newValue; }
-void MovementModule::setMaxAccleartion(float newValue){ maxAccleration=newValue; }
-
-
-
-
-
-
-std::vector<Vector>	MovementModule::hidingPoint;
-std::vector<float>	MovementModule::hidingPointSize;
-
-std::vector<NPC2*> MovementModule::npcList;
-std::vector<Vector> MovementModule::npcPosition;
-std::vector<float> MovementModule::npcRadius;
-std::vector<int> MovementModule::npcSwarm;
-std::vector<int> MovementModule::npcTeam;
-
-Vector MovementModule::playerPosition;
-Vector MovementModule::playerMovement;
-float MovementModule::playerRadius;
-
-std::vector<Vector> MovementModule::swarmCenter;
-std::vector<int> MovementModule::swarmMemberCount;
-
-
-
-
-
+// SHELL_COMMAND(setDistanceToPlayer, MovementModule, setDistanceToPlayer);
+// SHELL_COMMAND(setDistanceToNPC, MovementModule, setDistanceToNPC);
+// SHELL_COMMAND(setMaxAccleartion, MovementModule, setMaxAccleartion);
+//
+// float MovementModule::distanceToPlayer=15;
+// float MovementModule::distanceToNPC=2;
+// float MovementModule::maxAccleration=200.0f;
+//
+// void MovementModule::setDistanceToPlayer(float newValue){ distanceToPlayer=newValue; }
+// void MovementModule::setDistanceToNPC(float newValue){ distanceToNPC=newValue; }
+// void MovementModule::setMaxAccleartion(float newValue){ maxAccleration=newValue; }
+//
+//
+//
+//
+//
+//
+// std::vector<Vector>	MovementModule::hidingPoint;
+// std::vector<float>	MovementModule::hidingPointSize;
+//
+// std::vector<NPC2*> MovementModule::npcList;
+// std::vector<Vector> MovementModule::npcPosition;
+// std::vector<float> MovementModule::npcRadius;
+// std::vector<int> MovementModule::npcSwarm;
+// std::vector<int> MovementModule::npcTeam;
+//
+// Vector MovementModule::playerPosition;
+// Vector MovementModule::playerMovement;
+// float MovementModule::playerRadius;
+//
+// std::vector<Vector> MovementModule::swarmCenter;
+// std::vector<int> MovementModule::swarmMemberCount;
+//
+//
+//
+//
+//
 MovementModule::MovementModule(NPC2* object){ this->myNPC=object; }
 MovementModule::~MovementModule(){}
@@ -72,5 +72,5 @@
 	AABB* aabb = object->getModelAABB();
 	if( aabb == NULL)return -1;
-	
+
 	float a = aabb->halfLength[0];
 	float b = aabb->halfLength[1];
@@ -87,143 +87,135 @@
 
 
-void MovementModule::collectInformation(float dt)
+// void MovementModule::collectInformation(float dt)
+// {
+// 	//return if already processed..
+// 	if(dt==this->oldDT)return;
+// 	this->oldDT=dt;
+//
+//
+// 	//clear old Information..
+// 	hidingPoint.clear();
+// 	hidingPointSize.clear();
+//
+// 	npcList.clear();
+// 	npcPosition.clear();
+// 	npcRadius.clear();
+// 	npcSwarm.clear();
+// 	npcTeam.clear();
+//
+// 	swarmCenter.clear();
+// 	swarmMemberCount.clear();
+//
+//
+// 	//get all NPCs..
+// 	for(ObjectList<NPC2>::const_iterator it = NPC2::objectList().begin(); it != NPC2::objectList().end(); ++it)
+// 	{
+// 		npcList.push_back(*it);
+// 		npcRadius.push_back(getRadius(*it));
+// 		npcPosition.push_back((*it)->getAbsCoor());
+// 		npcSwarm.push_back((*it)->swarm);
+// 		npcTeam.push_back((*it)->team);
+// 	}
+//
+//
+// 	//Swarm Information
+// 	unsigned int tmpSwarm;
+// 	for(unsigned int i=0;i<npcList.size();i++){
+// 		tmpSwarm = npcSwarm.at(i);
+// 		if(tmpSwarm > swarmMemberCount.size()){
+// 			//swarmMemberCount.insert(swarmMemberCount.size(), tmpSwarm - swarmMemberCount.size(), 0);
+// 			//swarmCenter.insert(swarmCenter.size(), tmpSwarm - swarmCenter.size(), Vector(0,0,0));
+// 		}
+// 		//swarmMemberCount.at(tmpSwarm)++;
+// 		//swarmCenter.at(tmpSwarm)=swarmCenter.at(tmpSwarm)+npcPosition.at(i);
+// 	}
+// 	for(unsigned int i=0;i<swarmCenter.size();i++){
+// 		//swarmCenter.at(i)=swarmCenter.at(i)/swarmMemberCount.at(i);
+// 	}
+//
+//
+// 	//get information about Player
+// 	Player* pl = State::getPlayer();
+// 	if( pl != NULL){
+// 		playerPosition = pl->getPlayable()->getAbsCoor();
+// 		playerRadius=getRadius( pl->getPlayable() );
+// 		//PRINTF(0)("Player Radius: %f\n",playerRadius);
+// 	}
+//
+//
+// 	//calculate hiding Points..
+//
+// }
+
+
+void MovementModule::process(float dt)
 {
-	//return if already processed..
-	if(dt==this->oldDT)return;
-	this->oldDT=dt;
-	
-	
-	//clear old Information..
-	hidingPoint.clear();
-	hidingPointSize.clear();
-
-	npcList.clear();
-	npcPosition.clear();
-	npcRadius.clear();
-	npcSwarm.clear();
-	npcTeam.clear();
-	
-	swarmCenter.clear();
-	swarmMemberCount.clear();
-	
-	
-	//get all NPCs..
-	for(ObjectList<NPC2>::const_iterator it = NPC2::objectList().begin(); it != NPC2::objectList().end(); ++it)
-	{
-		npcList.push_back(*it);
-		npcRadius.push_back(getRadius(*it));
-		npcPosition.push_back((*it)->getAbsCoor());
-		npcSwarm.push_back((*it)->swarm);
-		npcTeam.push_back((*it)->team);
-	}
-	
-	
-	//Swarm Information
-	unsigned int tmpSwarm;
-	for(unsigned int i=0;i<npcList.size();i++){
-		tmpSwarm = npcSwarm.at(i);
-		if(tmpSwarm > swarmMemberCount.size()){
-			//swarmMemberCount.insert(swarmMemberCount.size(), tmpSwarm - swarmMemberCount.size(), 0);
-			//swarmCenter.insert(swarmCenter.size(), tmpSwarm - swarmCenter.size(), Vector(0,0,0));
-		}
-		//swarmMemberCount.at(tmpSwarm)++;
-		//swarmCenter.at(tmpSwarm)=swarmCenter.at(tmpSwarm)+npcPosition.at(i);
-	}
-	for(unsigned int i=0;i<swarmCenter.size();i++){
-		//swarmCenter.at(i)=swarmCenter.at(i)/swarmMemberCount.at(i);
-	}
-	
-	
+	if(myNPC == NULL)return;
+
 	//get information about Player
 	Player* pl = State::getPlayer();
-	if( pl != NULL){
-		playerPosition = pl->getPlayable()->getAbsCoor();
-		playerRadius=getRadius( pl->getPlayable() );
-		//PRINTF(0)("Player Radius: %f\n",playerRadius);
-	}
-	
-	
-	//calculate hiding Points..
-	
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-void MovementModule::process()
-{
-	this->process(AIEngine::getInstance()->dtS);
-}
-
-
-void MovementModule::process(float dt)
-{
-	collectInformation(dt);
-	
-	if(myNPC == NULL)return;
-	
+	if( pl == NULL)return;
+
+	Vector playerPosition = pl->getPlayable()->getAbsCoor();
+	float playerRadius=getRadius( pl->getPlayable() );
+
+
+// collectInformation(dt);
+
 	Vector myPosition = myNPC->getAbsCoor();
 	float myRadius = getRadius(myNPC);
-	int mySwarm = myNPC->swarm;
-	int myTeam = myNPC->team;
-	
+
+
 	Vector vectorToPlayer = playerPosition - myPosition;
-	
+
 	Vector tmpVector;
 	float tmpFloat;
-	
-	Vector npcCollision;
-	Vector swarmVector;
+
+// 	Vector npcCollision;
+// 	Vector swarmVector;
 	Vector playerCollision;
-	
+
 
 
 	//float a=200.0f;
 	float vMax=200.0f;
+	float maxAccleration=300.0f;
 	//float safetyDistance=2.0f;
 
 
 	//Anti Player Collision
-	tmpFloat=vectorToPlayer.len()-playerRadius-myRadius-distanceToPlayer;
+	tmpFloat=vectorToPlayer.len()-playerRadius-myRadius-30;//distanceToPlayer;
 	if(tmpFloat<0.1)tmpFloat=0.1;
 	playerCollision=vectorToPlayer/(tmpFloat*tmpFloat)*(-1);
-	
-	
-	
-	for (unsigned int i=0;i<npcList.size();i++)
-	{
-		if(npcList.at(i)==myNPC)continue;
-		
-		//Anti NPC Collision
-		tmpVector=myPosition-npcPosition.at(i);
-		tmpFloat=tmpVector.len()-myRadius-npcRadius.at(i)-distanceToNPC;
-		
-		if(tmpFloat<0.1)tmpFloat=0.1;
-		tmpVector=tmpVector/(tmpFloat*tmpFloat);
-		
-		npcCollision=npcCollision+tmpVector;
-		
-		//Schwarmverhalten
-		if(npcSwarm.at(i) == mySwarm){
-		
-		
-		}
-	}
-
-
-
-	
-	
-	Vector correction=playerCollision*50+npcCollision*50+vectorToPlayer-myMovement;
+
+
+
+// 	for (unsigned int i=0;i<npcList.size();i++)
+// 	{
+// 		if(npcList.at(i)==myNPC)continue;
+//
+// 		//Anti NPC Collision
+// 		tmpVector=myPosition-npcPosition.at(i);
+// 		tmpFloat=tmpVector.len()-myRadius-npcRadius.at(i)-distanceToNPC;
+//
+// 		if(tmpFloat<0.1)tmpFloat=0.1;
+// 		tmpVector=tmpVector/(tmpFloat*tmpFloat);
+//
+// 		npcCollision=npcCollision+tmpVector;
+//
+// 		//Schwarmverhalten
+// 		if(npcSwarm.at(i) == mySwarm){
+//
+//
+// 		}
+// 	}
+
+
+
+
+
+	//Vector correction=playerCollision*50+npcCollision*50+vectorToPlayer+Vector(70,0,0)-myMovement;
+	Vector correction=playerCollision*50+vectorToPlayer+Vector(50,0,0)-myMovement;
+
 	correction.y=0;
 	float correctionLen=correction.len();
Index: branches/ai/src/ai/movement_module.h
===================================================================
--- branches/ai/src/ai/movement_module.h	(revision 10112)
+++ branches/ai/src/ai/movement_module.h	(revision 10135)
@@ -11,48 +11,47 @@
 
 class MovementModule : public AIModule{
-	
- public:
-   MovementModule() {}
-   MovementModule(NPC2* object);
-   virtual ~MovementModule();
-   virtual void process();
-   virtual void process(float dt);
 
-   static void setDistanceToPlayer(float newValue);
-   static void setDistanceToNPC(float newValue);
-   static void setMaxAccleartion(float newValue);
-   
- private:
-	void collectInformation(float dt);
-	
-	
-	static std::vector<Vector>	hidingPoint;
-	static std::vector<float>	hidingPointSize;
-	
-	static std::vector<NPC2*> npcList;
-	static std::vector<Vector> npcPosition;
-	static std::vector<float> npcRadius;
-	static std::vector<int> npcSwarm;
-	static std::vector<int> npcTeam;
-	
-	static Vector playerPosition;
-	static Vector playerMovement;
-	static float playerRadius;
-	
-	static std::vector<Vector> swarmCenter;
-	static std::vector<int> swarmMemberCount;
-	
-	Vector myMovement;
-	float myMaxAccleration;
-	float myMaxSpeed;
-	
-	
-	float getRadius(WorldEntity* object);
-	static float aa;
-	float oldDT;
-	
-	static float maxAccleration;
-	static float distanceToPlayer;
-	static float distanceToNPC;
+	public:
+		MovementModule() {}
+		MovementModule(NPC2* object);
+		virtual ~MovementModule();
+		virtual void process(float dt);
+
+//    static void setDistanceToPlayer(float newValue);
+//    static void setDistanceToNPC(float newValue);
+//    static void setMaxAccleartion(float newValue);
+//
+	private:
+// 	void collectInformation(float dt);
+//
+//
+// 	static std::vector<Vector>	hidingPoint;
+// 	static std::vector<float>	hidingPointSize;
+//
+// 	static std::vector<NPC2*> npcList;
+// 	static std::vector<Vector> npcPosition;
+// 	static std::vector<float> npcRadius;
+// 	static std::vector<int> npcSwarm;
+// 	static std::vector<int> npcTeam;
+//
+// 	static Vector playerPosition;
+// 	static Vector playerMovement;
+// 	static float playerRadius;
+//
+// 	static std::vector<Vector> swarmCenter;
+// 	static std::vector<int> swarmMemberCount;
+
+		Vector myMovement;
+		float myMaxAccleration;
+		float myMaxSpeed;
+
+
+		float getRadius(WorldEntity* object);
+// 	static float aa;
+// 	float oldDT;
+//
+// 	static float maxAccleration;
+// 	static float distanceToPlayer;
+// 	static float distanceToNPC;
 };
 
Index: branches/ai/src/world_entities/npcs/npc_test.cc
===================================================================
--- branches/ai/src/world_entities/npcs/npc_test.cc	(revision 10112)
+++ branches/ai/src/world_entities/npcs/npc_test.cc	(revision 10135)
@@ -19,5 +19,5 @@
 
 #include "npc_test.h"
-
+#include <stdio.h>
 
 #include "state.h"
@@ -34,5 +34,7 @@
 #include "movement_module.h"
 #include "ai_module.h"
-
+#include "ai_team.h"
+#include "ai_swarm.h"
+#include "ai_engine.h"
 
 ObjectListDefinitionID(NPC2, CL_NPC_TEST2);
@@ -43,12 +45,19 @@
 {
 	this->registerObject(this, NPC2::_objectList);
-	if (root != NULL)this->loadParams(root);
-	
-	this->aiModule=new MovementModule(this); 
+
+	if (root != NULL)
+		this->loadParams(root);
+
+	std::cout << "Team Number: " << teamNumber << "\n";
+	std::cout << "Swarm Number:" << swarmNumber << "\n";
+
+	AITeam* myTeam=AIEngine::getInstance()->getCreateTeam(teamNumber);
+	//std::cout << "Testpoint 4: " << myTeam << "\n";
+	AISwarm* mySwarm=myTeam->getCreateSwarm(swarmNumber);
+	//std::cout << "Testpoint 5: " << mySwarm << "\n";
+	mySwarm->addToSwarm(new MovementModule(this));
+
 }
 
-
-NPC2::~NPC2 ()
-{}
 
 
@@ -56,4 +65,12 @@
 {
   NPC::loadParams(root);
+
+  LoadParam(root, "team", this, NPC2, setTeamNumber)
+		.describe("this sets the team number")
+		.defaultValues(0);
+
+  LoadParam(root, "swarm", this, NPC2, setSwarmNumber)
+		.describe("this sets the swarm number")
+		.defaultValues(0);
 }
 
@@ -65,8 +82,4 @@
 	if( likely(this->getModel(0) != NULL) && this->getModel(0)->isA(MD2Model::staticClassID()))
 		((MD2Model*)this->getModel(0))->tick(dt);
-
-	// processing AI
-	//PRINTF(0)("Processing NPC\n");
-	if(this->aiModule!=NULL)this->aiModule->process(dt);
 }
 
Index: branches/ai/src/world_entities/npcs/npc_test.h
===================================================================
--- branches/ai/src/world_entities/npcs/npc_test.h	(revision 10112)
+++ branches/ai/src/world_entities/npcs/npc_test.h	(revision 10135)
@@ -11,16 +11,22 @@
 
 class NPC2 : public NPC {
-  ObjectListDeclaration(NPC2);
+	ObjectListDeclaration(NPC2);
 
- public:
-  NPC2 (const TiXmlElement* root);
-  virtual ~NPC2 ();
-  virtual void loadParams(const TiXmlElement* root);
-  virtual void tick(float dt);
+	public:
+		NPC2 (const TiXmlElement* root);
+		virtual ~NPC2 (){};
+		virtual void loadParams(const TiXmlElement* root);
+		virtual void tick(float dt);
 
- 	int team;
- 	int swarm;
-	int difficulty;
-	AIModule* aiModule;
+
+	private:
+		inline void setTeamNumber(int number){teamNumber=number;}
+		inline void setSwarmNumber(int number){swarmNumber=number;}
+
+ 		int teamNumber;
+ 		int swarmNumber;
+		int difficulty;
+
+		AIModule* aiModule;
 };
 
