Index: orxonox/trunk/src/Makefile.am
===================================================================
--- orxonox/trunk/src/Makefile.am	(revision 3645)
+++ orxonox/trunk/src/Makefile.am	(revision 3646)
@@ -35,4 +35,5 @@
 		 track_node.cc \
 		 simple_animation.cc \
+		 garbage_collector.cc \
 		 story_entities/story_entity.cc \
 		 story_entities/campaign.cc \
@@ -81,4 +82,5 @@
 		 track_node.h \
 		 simple_animation.h \
+		 garbage_collector.h \
 		 story_entities/story_entity.h \
 		 story_entities/story_def.h \
Index: orxonox/trunk/src/Makefile.in
===================================================================
--- orxonox/trunk/src/Makefile.in	(revision 3645)
+++ orxonox/trunk/src/Makefile.in	(revision 3646)
@@ -56,11 +56,11 @@
 	command_node.$(OBJEXT) keynames.$(OBJEXT) camera.$(OBJEXT) \
 	track_manager.$(OBJEXT) track_node.$(OBJEXT) \
-	simple_animation.$(OBJEXT) story_entity.$(OBJEXT) \
-	campaign.$(OBJEXT) world.$(OBJEXT) world_entity.$(OBJEXT) \
-	player.$(OBJEXT) environment.$(OBJEXT) skysphere.$(OBJEXT) \
-	terrain.$(OBJEXT) primitive.$(OBJEXT) weapon.$(OBJEXT) \
-	projectile.$(OBJEXT) character_attributes.$(OBJEXT) \
-	test_gun.$(OBJEXT) ai.$(OBJEXT) p_node.$(OBJEXT) \
-	null_parent.$(OBJEXT) helper_parent.$(OBJEXT) \
+	simple_animation.$(OBJEXT) garbage_collector.$(OBJEXT) \
+	story_entity.$(OBJEXT) campaign.$(OBJEXT) world.$(OBJEXT) \
+	world_entity.$(OBJEXT) player.$(OBJEXT) environment.$(OBJEXT) \
+	skysphere.$(OBJEXT) terrain.$(OBJEXT) primitive.$(OBJEXT) \
+	weapon.$(OBJEXT) projectile.$(OBJEXT) \
+	character_attributes.$(OBJEXT) test_gun.$(OBJEXT) ai.$(OBJEXT) \
+	p_node.$(OBJEXT) null_parent.$(OBJEXT) helper_parent.$(OBJEXT) \
 	data_tank.$(OBJEXT) graphics_engine.$(OBJEXT) light.$(OBJEXT) \
 	fontset.$(OBJEXT) array.$(OBJEXT) objModel.$(OBJEXT) \
@@ -83,4 +83,5 @@
 @AMDEP_TRUE@	./$(DEPDIR)/environment.Po ./$(DEPDIR)/fontset.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/game_loader.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/garbage_collector.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/glmenu_imagescreen.Po \
 @AMDEP_TRUE@	./$(DEPDIR)/graphics_engine.Po \
@@ -238,4 +239,5 @@
 		 track_node.cc \
 		 simple_animation.cc \
+		 garbage_collector.cc \
 		 story_entities/story_entity.cc \
 		 story_entities/campaign.cc \
@@ -284,4 +286,5 @@
 		 track_node.h \
 		 simple_animation.h \
+		 garbage_collector.h \
 		 story_entities/story_entity.h \
 		 story_entities/story_def.h \
@@ -410,4 +413,5 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fontset.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game_loader.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/garbage_collector.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glmenu_imagescreen.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/graphics_engine.Po@am__quote@
Index: orxonox/trunk/src/lib/coord/p_node.cc
===================================================================
--- orxonox/trunk/src/lib/coord/p_node.cc	(revision 3645)
+++ orxonox/trunk/src/lib/coord/p_node.cc	(revision 3646)
@@ -354,5 +354,5 @@
 {
   pNode->remove();
-  this->children->remove (pNode);
+  //this->children->remove (pNode);
   pNode->parent = NULL;
 }
Index: orxonox/trunk/src/lib/lang/base_object.cc
===================================================================
--- orxonox/trunk/src/lib/lang/base_object.cc	(revision 3645)
+++ orxonox/trunk/src/lib/lang/base_object.cc	(revision 3646)
@@ -30,4 +30,5 @@
 {
   this->className = NULL;
+  this->finalized = false;
 }
 
@@ -58,2 +59,14 @@
   return true;
 }
+
+
+bool BaseObject::isFinalized()
+{
+  return this->finalized;
+}
+
+
+void BaseObject::finalize()
+{
+  this->finalized = true;
+}
Index: orxonox/trunk/src/lib/lang/base_object.h
===================================================================
--- orxonox/trunk/src/lib/lang/base_object.h	(revision 3645)
+++ orxonox/trunk/src/lib/lang/base_object.h	(revision 3646)
@@ -21,7 +21,10 @@
   bool isA (char* className);
 
+  bool isFinalized();
+  void finalize();
+
  private:
   char* className;
-
+  bool finalized;
 };
 
Index: orxonox/trunk/src/story_entities/world.cc
===================================================================
--- orxonox/trunk/src/story_entities/world.cc	(revision 3645)
+++ orxonox/trunk/src/story_entities/world.cc	(revision 3646)
@@ -26,5 +26,4 @@
 #include "track_node.h"
 #include "world_entity.h"
-#include "track_manager.h"
 #include "player.h"
 #include "camera.h"
@@ -35,4 +34,7 @@
 #include "light.h"
 
+#include "track_manager.h"
+#include "garbage_collector.h"
+
 #include "command_node.h"
 #include "glmenu_imagescreen.h"
@@ -182,4 +184,5 @@
   WorldInterface* wi = WorldInterface::getInstance();
   wi->init(this);
+  this->garbageCollector = GarbageCollector::getInstance();
 }
 
@@ -506,4 +509,14 @@
 {
   return this->entities;
+}
+
+
+/**
+   \brief this returns the current game time
+   \returns elapsed game time
+*/
+double World::getGameTime()
+{
+  return this->gameTime;
 }
 
@@ -721,5 +734,5 @@
       this->dt = currentFrame - this->lastFrame;
       
-      if(dt > 0)
+      if( this->dt > 0)
 	{
 	  float fps = 1000/dt;
@@ -733,5 +746,5 @@
 	  PRINTF(2)("fps = 1000 - frame rate is adjusted\n");
 	  SDL_Delay(10);
-	  dt = 10;
+	  this->dt = 10;
 	}
       //this->timeSlice (dt);
@@ -739,5 +752,6 @@
       /* function to let all entities tick (iterate through list) */
       WorldEntity* entity;
-      float seconds = dt / 1000.0;      
+      float seconds = this->dt / 1000.0;      
+      this->gameTime += seconds;
       entity = entities->enumerate(); 
       while( entity != NULL) 
@@ -749,6 +763,7 @@
       
       /* update tick the rest */
-      this->trackManager->tick(dt);
-      this->localCamera->tick(dt);
+      this->trackManager->tick(this->dt);
+      this->localCamera->tick(this->dt);
+      this->garbageCollector->tick(seconds);
     }
   this->lastFrame = currentFrame;
@@ -764,4 +779,5 @@
 void World::update()
 {
+  this->garbageCollector->update();
   this->nullParent->update (dt);
 }
Index: orxonox/trunk/src/story_entities/world.h
===================================================================
--- orxonox/trunk/src/story_entities/world.h	(revision 3645)
+++ orxonox/trunk/src/story_entities/world.h	(revision 3646)
@@ -23,4 +23,5 @@
 class FontSet;
 class Terrain;
+class GarbageCollector;
 
 //! The game world Interface
@@ -57,4 +58,5 @@
   virtual ~World ();
 
+  double getGameTime();
 
   /* classes from story-entity */
@@ -88,4 +90,5 @@
   Uint32 lastFrame;             //!< last time of frame
   Uint32 dt;                    //!< time needed to calculate this frame
+  double gameTime;              //!< this is where the game time is saved
   bool bQuitOrxonox;            //!< quit this application
   bool bQuitCurrentGame;        //!< quit only the current game and return to menu
@@ -108,4 +111,6 @@
   tList<WorldEntity>* entities;//!< A template List of all entities. Every moving thing should be included here, and world automatically updates them.
   WorldEntity* localPlayer;     //!< The Player, you fly through the level.
+
+  GarbageCollector* garbageCollector; //!< reference to the garbage  collector
  
   /* function for main-loop */
Index: orxonox/trunk/src/world_entities/projectile.cc
===================================================================
--- orxonox/trunk/src/world_entities/projectile.cc	(revision 3645)
+++ orxonox/trunk/src/world_entities/projectile.cc	(revision 3646)
@@ -20,4 +20,5 @@
 
 #include "world_entity.h"
+#include "null_parent.h"
 #include "objModel.h"
 #include "primitive.h"
@@ -35,4 +36,6 @@
   this->projectileModel = new Primitive(P_SPHERE);
   this->flightDirection = NULL;
+  this->currentLifeTime = 0.0f;
+  this->ttl = 1.0f;
   this->speed = 1.1f;
 }
@@ -69,4 +72,16 @@
 
 /**
+   \brief this sets the time to life of the projectile
+   \param ttl in second
+
+   after this life time, the projectile will garbage collect itself
+*/
+void Projectile::setTTL(float ttl)
+{
+  this->ttl = ttl;
+}
+
+
+/**
    \brief signal tick, time dependent things will be handled here
    \param time since last tick
@@ -74,6 +89,15 @@
 void Projectile::tick (float time) 
 {
-  *this->flightDirection = *this->flightDirection * speed;
-  this->shiftCoor(this->flightDirection);
+  this->currentLifeTime += time;
+  if( this->ttl < this->currentLifeTime)
+    {
+      *this->flightDirection = *this->flightDirection * speed;
+      this->shiftCoor(this->flightDirection);
+      return;
+    }
+  this->finalize();
+  //NullParent* np = NullParent::getInstance();
+  /* garbage colelction */
+  // \fix: there is no gc in this class, its all been done by GarbageCollector
 }
 
Index: orxonox/trunk/src/world_entities/projectile.h
===================================================================
--- orxonox/trunk/src/world_entities/projectile.h	(revision 3645)
+++ orxonox/trunk/src/world_entities/projectile.h	(revision 3646)
@@ -21,4 +21,6 @@
 
   void setFlightDirection(Quaternion* flightDirection);
+  void setSpeed(float speed);
+  void setTTL(float ttl);
 
   virtual void hit (WorldEntity* weapon, Vector* loc);
@@ -32,5 +34,8 @@
   Primitive* projectileModel;          //!< this serves temporary as a plasma bullet
   float speed;                         //!< this is the speed of the projectile
+  float currentLifeTime;               //!< this is the time, the projectile exists in this world (incremented by tick)
+  float ttl;                           //!< time to life, after this time, the projectile will garbage collect itself
   Vector* flightDirection;             //!< direction in which the shoot flights
+  
 };
 
Index: orxonox/trunk/src/world_entities/test_gun.cc
===================================================================
--- orxonox/trunk/src/world_entities/test_gun.cc	(revision 3645)
+++ orxonox/trunk/src/world_entities/test_gun.cc	(revision 3646)
@@ -93,4 +93,6 @@
   pj->setFlightDirection(q);
 
+  printf("TestGun::current speed is: %f", this->getSpeed());
+
   this->worldEntities->add(pj);
 }
Index: orxonox/trunk/src/world_entities/weapon.cc
===================================================================
--- orxonox/trunk/src/world_entities/weapon.cc	(revision 3645)
+++ orxonox/trunk/src/world_entities/weapon.cc	(revision 3646)
@@ -183,7 +183,5 @@
 */
 void Weapon::fire()
-{
-  
-}
+{}
 
 
Index: orxonox/trunk/src/world_entities/weapon.h
===================================================================
--- orxonox/trunk/src/world_entities/weapon.h	(revision 3645)
+++ orxonox/trunk/src/world_entities/weapon.h	(revision 3646)
@@ -61,5 +61,5 @@
   bool hasWeaponIdleTimeElapsed(void);
 
-  virtual void fire(void);
+  virtual void fire(void) = 0;
   virtual void hit (WorldEntity* weapon, Vector* loc);
   virtual void destroy(void);
