Index: orxonox/trunk/src/lib/physics/fields/field.cc
===================================================================
--- orxonox/trunk/src/lib/physics/fields/field.cc	(revision 4727)
+++ orxonox/trunk/src/lib/physics/fields/field.cc	(revision 4728)
@@ -1,3 +1,3 @@
-/* 
+/*
    orxonox - the future of 3D-vertical-scrollers
 
@@ -20,20 +20,24 @@
 #include "physics_engine.h"
 
+#include "factory.h"
+#include "load_param.h"
 using namespace std;
-
 
 /**
    \brief standard constructor
-   \todo this constructor is not jet implemented - do it
 */
-Field::Field () 
+Field::Field ()
 {
-   this->setClassName ("Field");
-   this->setMagnitude(1);
-   this->setAttenuation(0);
-   
-   PhysicsEngine::getInstance()->addField(this);
+  this->init();
 }
 
+/**
+  \param root The XML-element to load settings from
+ */
+Field::Field(const TiXmlElement* root)
+{
+  this->init();
+  this->loadParams(root);
+}
 
 /**
@@ -41,14 +45,40 @@
 
 */
-Field::~Field () 
+Field::~Field ()
 {
    PhysicsEngine::getInstance()->removeField(this);
 }
 
+/**
+  \brief initializes a Field
+*/
+void Field::init(void)
+{
+  this->setClassID(CL_FIELD, "Field");
+  this->setMagnitude(1);
+  this->setAttenuation(0);
+
+  PhysicsEngine::getInstance()->addField(this);
+}
+
+/**
+  \param root The XML-element to load settings from
+ */
+void Field::loadParams(const TiXmlElement* root)
+{
+  static_cast<PNode*>(this)->loadParams(root);
+
+  LoadParam<Field>(root, "magnitude", this, &Field::setMagnitude)
+      .describe("sets the magnitude of this Field");
+
+  LoadParam<Field>(root, "attenuation", this, &Field::setAttenuation)
+      .describe("sets the attenuation of this Field.");
+
+}
 
 /**
    \param magnitude the magnitude of the Field.
 */
-void Field::setMagnitude(const float& magnitude)
+void Field::setMagnitude(float magnitude)
 {
   this->magnitude = magnitude;
@@ -58,5 +88,5 @@
    \param attenuation The attenuation of the Field (the bigger the smaller the region of influence)
 */
-void Field::setAttenuation(const float& attenuation)
+void Field::setAttenuation(float attenuation)
 {
   this->attenuation = attenuation;
Index: orxonox/trunk/src/lib/physics/fields/field.h
===================================================================
--- orxonox/trunk/src/lib/physics/fields/field.h	(revision 4727)
+++ orxonox/trunk/src/lib/physics/fields/field.h	(revision 4728)
@@ -1,3 +1,3 @@
-/* 
+/*
    orxonox - the future of 3D-vertical-scrollers
 
@@ -14,9 +14,9 @@
 */
 
-/*! 
+/*!
     \file field.h
     \brief abstract definition of a Physical Field
 
-    This is a totally abstract class, that only enables different Physical Fields to 
+    This is a totally abstract class, that only enables different Physical Fields to
     exist on a common Level.
 */
@@ -28,15 +28,19 @@
 
 // FORWARD DEFINITION
-
+class TiXmlElement;
 
 
 //! An abstract class that represents a Force.
-class Field : public PNode 
+class Field : public PNode
 {
  public:
   Field();
+  Field(const TiXmlElement* root);
   virtual ~Field();
 
-  /** 
+  void init(void);
+  void loadParams(const TiXmlElement* root);
+
+  /**
       \param data This is the data given to this force, to calculate the ForceVector
       \returns The Force Vector
@@ -44,9 +48,9 @@
   virtual Vector calcForce(const Vector& data) const = 0;
 
-  void setMagnitude(const float& magnitude);
+  void setMagnitude(float magnitude);
   /** \returns The Magnitude of the Field */
   inline const float& getMagnitude(void) const {return this->magnitude;}
 
-  void setAttenuation(const float& attenuation);
+  void setAttenuation(float attenuation);
   /** \returns The Attenuation of the Fiels */
   inline const float& getAttenuation(void) const {return this->attenuation;}
Index: orxonox/trunk/src/lib/physics/fields/gravity.cc
===================================================================
--- orxonox/trunk/src/lib/physics/fields/gravity.cc	(revision 4727)
+++ orxonox/trunk/src/lib/physics/fields/gravity.cc	(revision 4728)
@@ -1,3 +1,3 @@
-/* 
+/*
    orxonox - the future of 3D-vertical-scrollers
 
@@ -18,6 +18,10 @@
 #include "gravity.h"
 
+#include "load_param.h"
+#include "factory.h"
+
 using namespace std;
 
+CREATE_FACTORY(Gravity);
 
 /**
@@ -25,9 +29,15 @@
    \todo this constructor is not jet implemented - do it
 */
-Gravity::Gravity () 
+Gravity::Gravity ()
 {
-   this->setClassName ("Gravity");
+   this->setClassName("Gravity");
 }
 
+Gravity::Gravity(const TiXmlElement* root)
+{
+  this->setClassName("Gravity");
+
+  this->loadParams(root);
+}
 
 /**
@@ -35,7 +45,13 @@
 
 */
-Gravity::~Gravity () 
+Gravity::~Gravity ()
 {
   // delete what has to be deleted here
+}
+
+void Gravity::loadParams(const TiXmlElement* root)
+{
+  static_cast<Field*>(this)->loadParams(root);
+
 }
 
Index: orxonox/trunk/src/lib/physics/fields/gravity.h
===================================================================
--- orxonox/trunk/src/lib/physics/fields/gravity.h	(revision 4727)
+++ orxonox/trunk/src/lib/physics/fields/gravity.h	(revision 4728)
@@ -1,3 +1,3 @@
-/*! 
+/*!
     \file gravity.h
     \brief Definition of ...
@@ -19,5 +19,8 @@
  public:
   Gravity();
+  Gravity(const TiXmlElement* root);
   virtual ~Gravity();
+
+  void loadParams(const TiXmlElement* root);
 
   virtual Vector calcForce(const Vector& data) const;
Index: orxonox/trunk/src/lib/physics/physics_connection.cc
===================================================================
--- orxonox/trunk/src/lib/physics/physics_connection.cc	(revision 4727)
+++ orxonox/trunk/src/lib/physics/physics_connection.cc	(revision 4728)
@@ -24,5 +24,9 @@
 #include "physics_interface.h"
 
+#include "factory.h"
+
 using namespace std;
+
+CREATE_FACTORY(PhysicsConnection);
 
 /**
@@ -39,4 +43,17 @@
 }
 
+PhysicsConnection::PhysicsConnection(const TiXmlElement* root)
+{
+  this->setClassID(CL_PHYSICS_CONNECTION, "PhysicsConnection");
+  this->type = PCON_PhysIField;
+
+  static_cast<BaseObject*>(this)->loadParams(root);
+
+  LoadParam<PhysicsConnection>(root, "subject", this, &PhysicsConnection::setSubject)
+      .describe("set the subject by a name");
+
+  LoadParam<PhysicsConnection>(root, "field", this, &PhysicsConnection::setField)
+      .describe("set the field by name");
+}
 
 /**
@@ -50,9 +67,30 @@
 
 /**
+   \param subjectName the name of the Subject for this PhysicsConnection
+*/
+void PhysicsConnection::setSubject(const char* subjectName)
+{
+  this->subject = PhysicsEngine::getInstance()->getPhysicsInterfaceByName(subjectName);
+  if (this->subject == NULL)
+    PRINTF(2)("subject: (%s) not found for PhysicsConnection\n", subjectName);
+}
+
+/**
+  \param fieldName the Name of the Field for this connection
+*/
+void PhysicsConnection::setField(const char* fieldName)
+{
+  this->field = PhysicsEngine::getInstance()->getFieldByName(fieldName);
+  if (this->field == NULL)
+    PRINTF(2)("field: (%s) not found for PhysicsConnection\n", fieldName);
+}
+
+/**
     \brief applies the Force to some Object.
 */
 void PhysicsConnection::apply(void) const
 {
-  if (likely(this->type == PCON_PhysIField && this->field->getMagnitude() != 0.0))
+  if (likely(this->type == PCON_PhysIField && this->field->getMagnitude() != 0.0
+      && this->subject != NULL && this->field != NULL))
       this->subject->applyField(this->field);
   else ;
Index: orxonox/trunk/src/lib/physics/physics_connection.h
===================================================================
--- orxonox/trunk/src/lib/physics/physics_connection.h	(revision 4727)
+++ orxonox/trunk/src/lib/physics/physics_connection.h	(revision 4728)
@@ -30,6 +30,10 @@
   PhysicsConnection(PhysicsInterface* subject, Field* field);
   //  PhysicsConnection(PhysicsInterface* partnerOne, PhysicsInterface* partnerTwo);
+  PhysicsConnection(const TiXmlElement* root);
 
   virtual ~PhysicsConnection();
+
+  void setSubject(const char* subjectName);
+  void setField(const char* fieldName);
 
   void apply(void) const;
Index: orxonox/trunk/src/lib/physics/physics_engine.cc
===================================================================
--- orxonox/trunk/src/lib/physics/physics_engine.cc	(revision 4727)
+++ orxonox/trunk/src/lib/physics/physics_engine.cc	(revision 4728)
@@ -21,4 +21,6 @@
 
 #include "list.h"
+#include "game_loader.h"
+#include "tinyxml.h"
 
 using namespace std;
@@ -51,4 +53,33 @@
 }
 
+/**
+  \param root the XML-element to load settings from
+ */
+void loadParams(const TiXmlElement* root)
+{
+  const TiXmlElement* element;
+
+  PRINTF(4)("Loading Physical Fields\n");
+  element = root->FirstChildElement("Fields");
+  {
+    element = element->FirstChildElement();
+    GameLoader::getInstance()->fabricate(element);
+
+    element = element->NextSiblingElement();
+  }
+
+  PRINTF(4)("Loading Physical Connections\n");
+  element = root->FirstChildElement("PhysicsConnections");
+  {
+    element = element->FirstChildElement();
+    GameLoader::getInstance()->fabricate(element);
+
+    element = element->NextSiblingElement();
+  }
+
+}
+
+
+
 
 /**
@@ -75,4 +106,25 @@
 
 /**
+  \param physicsInterfaceName the Name of the PhysicsInterface to search for
+  \returns the PhysicsInterface if found, or NULL if not
+ */
+PhysicsInterface* PhysicsEngine::getPhysicsInterfaceByName(const char* physicsInterfaceName) const
+{
+  tIterator<PhysicsInterface>* tmpIt = interfaces->getIterator();
+  PhysicsInterface* tmpInt = tmpIt->nextElement();
+  while(tmpInt)
+  {
+    if (!strcmp(physicsInterfaceName, tmpInt->getName()))
+    {
+      delete tmpIt;
+      return tmpInt;
+    }
+    tmpInt = tmpIt->nextElement();
+  }
+  delete tmpIt;
+  return NULL;
+}
+
+/**
    \brief adds a Field to the list of handeled fields
    \param field the field to add
@@ -97,4 +149,27 @@
 
 /**
+  \param FieldName the Name of the PhysicsInterface to search for
+  \returns the Field if found, or NULL if not
+ */
+Field* PhysicsEngine::getFieldByName(const char* FieldName) const
+{
+  tIterator<Field>* tmpIt = fields->getIterator();
+  Field* tmpField = tmpIt->nextElement();
+  while(tmpField)
+  {
+    if (!strcmp(FieldName, tmpField->getName()))
+    {
+      delete tmpIt;
+      return tmpField;
+    }
+    tmpField = tmpIt->nextElement();
+  }
+  delete tmpIt;
+  return NULL;
+}
+
+
+
+/**
    \brief adds A Physical Connection to the List of Connections
    \param connection the Connection to add
@@ -118,5 +193,24 @@
 }
 
-
+/**
+  \param physicsConnectionName the Name of the PhysicsInterface to search for
+  \returns the PhysicsConnection if found, or NULL if not
+ */
+PhysicsConnection* PhysicsEngine::getPhysicsConnectionByName(const char* physicsConnectionName) const
+{
+  tIterator<PhysicsConnection>* tmpIt = connections->getIterator();
+  PhysicsConnection* tmpConn = tmpIt->nextElement();
+  while(tmpConn)
+  {
+    if (!strcmp(physicsConnectionName, tmpConn->getName()))
+    {
+      delete tmpIt;
+      return tmpConn;
+    }
+    tmpConn = tmpIt->nextElement();
+  }
+  delete tmpIt;
+  return NULL;
+}
 
 
Index: orxonox/trunk/src/lib/physics/physics_engine.h
===================================================================
--- orxonox/trunk/src/lib/physics/physics_engine.h	(revision 4727)
+++ orxonox/trunk/src/lib/physics/physics_engine.h	(revision 4728)
@@ -16,5 +16,5 @@
 // Forward Declaration
 template<class T> class tList;
-
+class TiXmlElement;
 
 //! A class, that brings things into motion through Physics.
@@ -26,16 +26,22 @@
   inline static PhysicsEngine* getInstance(void) { if (!singletonRef) singletonRef = new PhysicsEngine();  return singletonRef; };
 
-  void addPhysicsInterface(PhysicsInterface* physicsInterface);
-  void removePhysicsInterface(PhysicsInterface* physicsInterface);
+  void loadParams(const TiXmlElement* root);
 
-  void addField(Field* field);
-  void removeField(Field* field);
+  void                   addPhysicsInterface(PhysicsInterface* physicsInterface);
+  void                   removePhysicsInterface(PhysicsInterface* physicsInterface);
+  PhysicsInterface*      getPhysicsInterfaceByName(const char* physicsInterfaceName) const;
 
-  void addConnection(PhysicsConnection* connection);
-  void removeConnection(PhysicsConnection* connection);
+  void                   addField(Field* field);
+  void                   removeField(Field* field);
+  Field*                 getFieldByName(const char* FieldName) const;
 
-  void tick(float dt);
+  void                   addConnection(PhysicsConnection* connection);
+  void                   removeConnection(PhysicsConnection* connection);
+  PhysicsConnection*     getPhysicsConnectionByName(const char* physicsConnectionName) const;
 
-  void debug(void) const;
+
+  void                   tick(float dt);
+
+  void                   debug(void) const;
 
  private:
