Index: trunk/src/lib/coord/p_node.cc
===================================================================
--- trunk/src/lib/coord/p_node.cc	(revision 6633)
+++ trunk/src/lib/coord/p_node.cc	(revision 6634)
@@ -505,6 +505,10 @@
 {
   PNode* childNode = dynamic_cast<PNode*>(ClassList::getObject(childName, CL_PARENT_NODE));
+//  PRINTF(0)("Adding the Child: %s to: %s\n", childName, this->getName());
+//  assert( childNode != NULL );
   if (childNode != NULL)
+  {
     this->addChild(childNode);
+  }
 }
 
@@ -1069,10 +1073,5 @@
   SYNCHELP_READ_FLOAT( f3 );
   this->setRelCoor( f1, f2, f3 );
-  //this->setRelCoor( 5, 0, 0 );
-
-  /*SYNCHELP_READ_FLOAT( f1 );
-  SYNCHELP_READ_FLOAT( f2 );
-  SYNCHELP_READ_FLOAT( f3 );*/
-  //this->setAbsCoor( f1, f2, f3 );
+
 
   SYNCHELP_READ_FLOAT( f1 );
@@ -1082,19 +1081,15 @@
   this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) );
 
-  /*SYNCHELP_READ_FLOAT( f1 );
-  SYNCHELP_READ_FLOAT( f2 );
-  SYNCHELP_READ_FLOAT( f3 );
-  SYNCHELP_READ_FLOAT( f4 );*/
-  //this->setAbsDir( Quaternion( Vector(f2, f3, f4), f1 ) );
-
   int n;
   char * childName;
 
+  PRINTF(0)("JKLO %d %d %d %d\n", data[__synchelp_read_i], data[__synchelp_read_i+1], data[__synchelp_read_i+2], data[__synchelp_read_i+3]);
   SYNCHELP_READ_INT( n );
+  PRINTF(0)("read %s:n=%d\n", this->getName(), n);
 
   for (int i = 0; i<n; i++)
   {
     SYNCHELP_READ_STRINGM( childName );
-    //PRINTF(0)("childname = %s\n", childName);
+    PRINTF(0)("RCVD CHILD = %s\n", childName);
     addChild( childName );
     delete childName;
@@ -1132,12 +1127,4 @@
   SYNCHELP_WRITE_FLOAT( this->relCoordinate.z );
 
-  //PRINTF(0)("%s, %f, %f, %f\n", getClassName(), relCoordinate.x, relCoordinate.y, relCoordinate.z);
-
-  /*SYNCHELP_WRITE_FLOAT( this->absCoordinate.x );
-  SYNCHELP_WRITE_FLOAT( this->absCoordinate.y );
-  SYNCHELP_WRITE_FLOAT( this->absCoordinate.z );*/
-
-  //PRINTF(0)("%s, %f, %f, %f\n", getClassName(), absCoordinate.x, absCoordinate.y, absCoordinate.z);
-
   SYNCHELP_WRITE_FLOAT( this->relDirection.w );
   SYNCHELP_WRITE_FLOAT( this->relDirection.v.x );
@@ -1145,17 +1132,145 @@
   SYNCHELP_WRITE_FLOAT( this->relDirection.v.z );
 
-  /*SYNCHELP_WRITE_FLOAT( this->absDirection.w );
-  SYNCHELP_WRITE_FLOAT( this->absDirection.v.x );
-  SYNCHELP_WRITE_FLOAT( this->absDirection.v.y );
-  SYNCHELP_WRITE_FLOAT( this->absDirection.v.z );*/
-
   int n = children.size();
+
+  //check if camera is in children
+  for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++)
+  {
+    if ( (*it)->isA(CL_CAMERA) )
+      n--;
+  }
+  PRINTF(0)("write %s:n=%d\n", this->getName(), n);
   SYNCHELP_WRITE_INT( n );
+  PRINTF(0)("ASDF %d %d %d %d\n", data[__synchelp_write_i-4], data[__synchelp_write_i-3], data[__synchelp_write_i-2], data[__synchelp_write_i-1]);
 
   for (std::list<PNode*>::const_iterator it = children.begin(); it!=children.end(); it++)
   {
-    SYNCHELP_WRITE_STRING( (*it)->getName() );
+    //dont add camera because there is only one camera attached to local player
+    if ( !(*it)->isA(CL_CAMERA) )
+    {
+      PRINTF(0)("SENDING CHILD: %s\n", (*it)->getName());
+      SYNCHELP_WRITE_STRING( (*it)->getName() );
+    }
   }
 
   return SYNCHELP_WRITE_N;
 }
+
+#define __FLAG_COOR 1
+#define __FLAG_ROT  2
+
+#define __OFFSET_POS 1
+#define __OFFSET_ROT 0.05
+
+/**
+ * Writes data from network containing information about the state which has changed
+ * @param data pointer to data
+ * @param length length of data
+ * @param sender hostID of sender
+ */
+int PNode::writeSync( const byte * data, int length, int sender )
+{
+  SYNCHELP_READ_BEGIN();
+
+  if ( this->getHostID()==this->getOwner() )
+  {
+    return SYNCHELP_READ_N;
+  }
+
+  byte flags = 0;
+  SYNCHELP_READ_BYTE( flags );
+  //PRINTF(0)("%s::FLAGS = %d\n", this->getName(), flags);
+
+  float f1, f2, f3, f4;
+
+  if ( flags & __FLAG_COOR )
+  {
+    SYNCHELP_READ_FLOAT( f1 );
+    SYNCHELP_READ_FLOAT( f2 );
+    SYNCHELP_READ_FLOAT( f3 );
+    PRINTF(0)("RCVD COOR: %f %f %f\n", f1, f2, f3);
+    this->setRelCoor( f1, f2, f3 );
+  }
+
+  if ( flags & __FLAG_ROT )
+  {
+    SYNCHELP_READ_FLOAT( f1 );
+    SYNCHELP_READ_FLOAT( f2 );
+    SYNCHELP_READ_FLOAT( f3 );
+    SYNCHELP_READ_FLOAT( f4 );
+    PRINTF(0)("RCVD QUAT: %f %f %f %f\n", f1, f2, f3, f4);
+    //this->setRelDir( Quaternion( Vector(f2, f3, f4), f1 ) );
+    Quaternion q;
+    q.w = f1;
+    q.v.x = f2;
+    q.v.y = f3;
+    q.v.z = f4;
+    this->setAbsDir( q );
+  }
+
+  return SYNCHELP_READ_N;
+}
+
+/**
+ * data copied in data will bee sent to another host
+ * @param data pointer to data
+ * @param maxLength max length of data
+ * @return the number of bytes writen
+ */
+int PNode::readSync( byte * data, int maxLength )
+{
+  SYNCHELP_WRITE_BEGIN();
+
+  if ( this->getHostID()!=this->getOwner() )
+  {
+    return SYNCHELP_WRITE_N;
+  }
+
+  byte flags = 0;
+  if ( fabs( coorx - relCoordinate.x ) > __OFFSET_POS ||
+       fabs( coory - relCoordinate.y ) > __OFFSET_POS ||
+       fabs( coorz - relCoordinate.z ) > __OFFSET_POS )
+    flags |= __FLAG_COOR;
+
+  if ( fabs( rotw - absDirection.w ) > __OFFSET_ROT ||
+       fabs( rotx - absDirection.v.x ) > __OFFSET_ROT ||
+       fabs( roty - absDirection.v.y ) > __OFFSET_ROT ||
+       fabs( rotz - absDirection.v.z ) > __OFFSET_ROT )
+    flags |= __FLAG_ROT;
+
+
+  SYNCHELP_WRITE_BYTE( flags );
+  //PRINTF(0)("FLAGS = %d\n", flags);
+
+  if ( flags & __FLAG_COOR )
+  {
+
+    PRINTF(0)("SEND COOR: %f %f %f\n", this->relCoordinate.x, this->relCoordinate.y, this->relCoordinate.z);
+
+    SYNCHELP_WRITE_FLOAT( this->relCoordinate.x );
+    SYNCHELP_WRITE_FLOAT( this->relCoordinate.y );
+    SYNCHELP_WRITE_FLOAT( this->relCoordinate.z );
+
+    coorx = relCoordinate.x;
+    coory = relCoordinate.y;
+    coorz = relCoordinate.z;
+  }
+
+  if ( flags & __FLAG_ROT )
+  {
+
+    PRINTF(0)("SEND QUAT: %f %f %f %f\n", this->absDirection.w, this->absDirection.v.x, this->absDirection.v.y, this->absDirection.v.z);
+
+    SYNCHELP_WRITE_FLOAT( this->absDirection.w );
+    SYNCHELP_WRITE_FLOAT( this->absDirection.v.x );
+    SYNCHELP_WRITE_FLOAT( this->absDirection.v.y );
+    SYNCHELP_WRITE_FLOAT( this->absDirection.v.z );
+
+    rotw = absDirection.w;
+    rotx = absDirection.v.x;
+    roty = absDirection.v.y;
+    rotz = absDirection.v.z;
+  }
+
+  return SYNCHELP_WRITE_N;
+}
Index: trunk/src/lib/coord/p_node.h
===================================================================
--- trunk/src/lib/coord/p_node.h	(revision 6633)
+++ trunk/src/lib/coord/p_node.h	(revision 6634)
@@ -186,4 +186,6 @@
   int       writeState(const byte* data, int length, int sender);
   int       readState(byte* data, int maxLength );
+  int       writeSync(const byte* data, int length, int sender);
+  int       readSync(byte* data, int maxLength );
 
  private:
@@ -229,4 +231,14 @@
 
   static PNode*      nullParent;         //!< The ROOT of the main PNode Tree.
+
+  private:
+    float coorx;
+    float coory;
+    float coorz;
+
+    float rotw;
+    float rotx;
+    float roty;
+    float rotz;
 };
 
Index: trunk/src/lib/graphics/graphics_engine.cc
===================================================================
--- trunk/src/lib/graphics/graphics_engine.cc	(revision 6633)
+++ trunk/src/lib/graphics/graphics_engine.cc	(revision 6634)
@@ -274,5 +274,5 @@
     this->hwExtensions = new SubString((char*)glGetString(GL_EXTENSIONS), " \n\t,");
 
-  PRINT(4)("Running on : %s %s %s\n", vendor, renderer, version);
+  PRINT(4)("Running on : vendor: %s,  renderer: %s,  version:%s\n", vendor, renderer, version);
   PRINT(4)("Extensions:\n");
   if (this->hwExtensions != NULL)
Index: trunk/src/lib/graphics/importer/texture.cc
===================================================================
--- trunk/src/lib/graphics/importer/texture.cc	(revision 6633)
+++ trunk/src/lib/graphics/importer/texture.cc	(revision 6634)
@@ -260,15 +260,16 @@
   glBindTexture(target, texture);
 
-  glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+  glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_REPEAT);
+  glTexParameteri(target, GL_TEXTURE_WRAP_R, GL_REPEAT);
+
+  glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR/*_MIPMAP_LINEAR*/);
   glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
-
-  glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_REPEAT);
-  glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_REPEAT);
+  glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_PRIORITY, this->priority);
+
 
   /* control the mipmap levels */
-//   glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MIN_LOD, 5);f
-//   glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MAX_LOD, 0);
-  glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_PRIORITY, this->priority);
+  glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MIN_LOD, 5);
+  glTexParameterf(GL_TEXTURE_ENV, GL_TEXTURE_MAX_LOD, 0);
 
   /* build the Texture  OpenGL V >= 1.1 */
@@ -295,6 +296,8 @@
     PRINTF(1)("Error while loading texture (mipmap generation), gluBuild2DMipmaps returned %i\n", errorCode);
 
+  // Deselect newly built texture, as we do not want to display with this texture.
   if (target == GL_TEXTURE_2D)
     glBindTexture(target, 0);
+
   return texture;
 }
Index: trunk/src/lib/lang/base_object.cc
===================================================================
--- trunk/src/lib/lang/base_object.cc	(revision 6633)
+++ trunk/src/lib/lang/base_object.cc	(revision 6634)
@@ -224,4 +224,5 @@
   SYNCHELP_WRITE_BEGIN();
 
+  //PRINTF(0)("objectname = %s\n", this->objectName);
   SYNCHELP_WRITE_STRING( this->objectName );
 
Index: trunk/src/lib/network/converter.cc
===================================================================
--- trunk/src/lib/network/converter.cc	(revision 6633)
+++ trunk/src/lib/network/converter.cc	(revision 6634)
@@ -22,4 +22,9 @@
 /* include your own header */
 #include "converter.h"
+#include "shell_command.h"
+
+#include <limits>
+
+SHELL_COMMAND_STATIC(debug, Converter, Converter::debug);
 
 
@@ -182,4 +187,13 @@
 const int expmult = 8388608; //2^23
 
+float Converter::getDenormConst()
+{
+  const int exp = 126;
+  float result = 1.0f;
+  for (int i = 0; i < exp; i++)
+    result /= 2.0f;
+  return result;
+}
+
 /*!
  * Converts a float value into a byte-array
@@ -189,4 +203,8 @@
 byte* Converter::floatToByteArray(float x)
 {
+  byte* result = new byte[4];
+  floatToByteArray(x, result, 4);
+  return result;
+  /*
   int mantisse = 0;
   int exponent = 128;
@@ -201,34 +219,54 @@
     sgn = 1;
 
-  float sub = 1;
-  while (sub < x)
-  {
-    sub *= 2;
+  if (x == 0)
+  {
+    exponent = 255;
+    mantisse = 0;
+  }
+  else
+  {
+    //if (x < getDenormConst())
+    //  printf("Denormalisiert!\n");
+    //printf("DenormConst = %e", getDenormConst());
+
+    float sub = 1;
+    while (sub < x)
+    {
+      sub *= 2;
+      exponent++;
+    }
+
+    while (x > 0)
+    {
+      if (x >= sub)
+      {
+        mantisse += 1;
+        x -= sub;
+      }
+
+      mantisse *= 2;
+      exponent--;
+      sub /= 2;
+    }
     exponent++;
-  }
-
-  while (x > 0)
-  {
-    if (x >= sub)
-    {
-      mantisse += 1;
-      x -= sub;
-    }
-
-    mantisse *= 2;
-    exponent--;
-    sub /= 2;
-  }
-  exponent++;
-  mantisse /= 2;
-  while (mantisse < expmult)
-  {
-    mantisse *= 2;
-    exponent--;
-  }
-
-  //printf("mantisse = %i exponent = %i \n", mantisse, exponent);
-
-  mantisse -= expmult;
+    mantisse /= 2;
+
+    printf("Conv:        mantisse = %i exponent = %i \n", mantisse, exponent);
+
+
+    if (mantisse != 0)
+    {
+      while (mantisse < expmult)
+      {
+        mantisse *= 2;
+        exponent--;
+      }
+
+      mantisse -= expmult;
+    }
+  }
+
+  printf("Conv: mantisse = %i exponent = %i \n", mantisse, exponent);
+
 
   int hx = mantisse + expmult * exponent;
@@ -238,4 +276,5 @@
 
   return result;
+  */
 }
 
@@ -248,10 +287,20 @@
 float Converter::byteArrayToFloat(byte* a)
 {
+  byte* h = new byte[4];
+  float result = 0.0f;
+  byteArrayToFloat(a, &result);
+  return result;
+  /*
+  int hexp = a[2] + a[3] * 256;
+  int exponent = (hexp / 128) % 256;
+
   int hmant = a[0] + a[1] * 256 + a[2] * 65536;
   int mantisse = hmant % expmult;
+  if (mantisse == 0 && exponent == 255)
+    return 0;
+
   mantisse += expmult;
-
-  int hexp = a[2] + a[3] * 256;
-  int exponent = (hexp / 128) % 256 - 128;
+  exponent -= 128;
+
 
   int sgn;
@@ -261,5 +310,5 @@
     sgn = 1;
 
-  //printf("mantisse = %i exponent = %i \n", mantisse, exponent);
+  printf("ReConv: mantisse = %i exponent = %i \n", mantisse, exponent);
 
   float emult = 1;
@@ -276,31 +325,5 @@
 
   return result;
-}
-
-/*!
- * Converts a float value into a byte-array
- * @param x: The float which is to convert
- * @return: A byte-array which accords the given float
- */
-byte* Converter::_floatToByteArray(float x)
-{
-  byte* p = (byte*)&x;
-  byte* result = new byte[4];
-  for (int i = 0; i < 4; i++)
-    result[i] = p[i];
-  return result;
-}
-
-
-/*!
- * Converts a byte-array into a float value
- * @param a: The byte-array which is to convert
- * @return: A float value which accords the given byte-array
- */
-float Converter::_byteArrayToFloat(byte* a)
-{
-  float* p = (float*)a;
-  float result = *p;
-  return result;
+  */
 }
 
@@ -310,5 +333,5 @@
  * @return: A byte-array which accords the given float
  */
-int Converter::floatToByteArray(float x, byte* a, int length)
+int Converter::_floatToByteArray(float x, byte* a, int length)
 {
   if (length < FLOATSIZE)
@@ -319,10 +342,10 @@
 
   //handle 0 else function will loop for ever
-  if ( x == 0 )
+  /*if ( x == 0 )
   {
     for ( int i = 0; i<FLOATSIZE; i++)
       a[i] = 0;
     return FLOATSIZE;
-  }
+}*/
 
   int mantisse = 0;
@@ -338,34 +361,55 @@
     sgn = 1;
 
-  float sub = 1;
-  while (sub < x)
-  {
-    sub *= 2;
+  if (x == 0)
+  {
+    exponent = 255;
+    mantisse = 0;
+  }
+  else
+  {
+    //if (x < getDenormConst())
+    //  printf("Denormalisiert!\n");
+    //printf("DenormConst = %e", getDenormConst());
+
+    float sub = 1;
+    while (sub < x)
+    {
+      sub *= 2;
+      exponent++;
+    }
+
+    while (x > 0)
+    {
+      if (x >= sub)
+      {
+        mantisse += 1;
+        x -= sub;
+      }
+
+      mantisse *= 2;
+      exponent--;
+      sub /= 2;
+    }
     exponent++;
-  }
-
-  while (x > 0)
-  {
-    if (x >= sub)
-    {
-      mantisse += 1;
-      x -= sub;
-    }
-
-    mantisse *= 2;
-    exponent--;
-    sub /= 2;
-  }
-  exponent++;
-  mantisse /= 2;
-  while (mantisse < expmult)
-  {
-    mantisse *= 2;
-    exponent--;
-  }
-
-  //printf("mantisse = %i exponent = %i \n", mantisse, exponent);
-
-  mantisse -= expmult;
+    mantisse /= 2;
+
+
+///    printf("Conv:        mantisse = %i exponent = %i \n", mantisse, exponent);
+
+
+    if (mantisse != 0)
+    {
+      while (mantisse < expmult)
+      {
+        mantisse *= 2;
+        exponent--;
+      }
+
+      mantisse -= expmult;
+    }
+  }
+
+///  printf("Conv: mantisse = %i exponent = %i \n", mantisse, exponent);
+
 
   int hx = mantisse + expmult * exponent;
@@ -374,4 +418,10 @@
     a[3] += sgnadd;
 
+
+//  int hx = mantisse + expmult * exponent;
+//  byte* result = intToByteArray(hx);
+//  if (sgn == -1)
+//    result[3] += sgnadd;
+
   return result;
 }
@@ -383,8 +433,8 @@
  * @return: A float value which accords the given byte-array
  */
-int Converter::byteArrayToFloat(const byte* a, float* x)
-{
-  //handle 0
-  for (int i = 0; i<FLOATSIZE; i++)
+int Converter::_byteArrayToFloat(const byte* a, float* x)
+{
+    //handle 0
+  /*for (int i = 0; i<FLOATSIZE; i++)
   {
     if (a[i]!=0)
@@ -395,13 +445,22 @@
       return FLOATSIZE;
     }
-  }
-
+}*/
+
+  int hexp = a[2] + a[3] * 256;
+  int exponent = (hexp / 128) % 256;
 
   int hmant = a[0] + a[1] * 256 + a[2] * 65536;
   int mantisse = hmant % expmult;
+
+  //handle 0
+  if (mantisse == 0 && exponent == 255)
+  {
+    *x = 0;
+    return FLOATSIZE;
+  }
+
   mantisse += expmult;
-
-  int hexp = a[2] + a[3] * 256;
-  int exponent = (hexp / 128) % 256 - 128;
+  exponent -= 128;
+
 
   int sgn;
@@ -411,5 +470,5 @@
     sgn = 1;
 
-  //printf("mantisse = %i exponent = %i \n", mantisse, exponent);
+///  printf("ReConv: mantisse = %i exponent = %i \n", mantisse, exponent);
 
   float emult = 1;
@@ -421,4 +480,12 @@
       emult /= 2;
 
+  /*
+  float result = mantisse * emult;
+  if (sgn == -1)
+    result = -result;
+
+  return result;
+  */
+
   *x = mantisse * emult;
   if (sgn == -1)
@@ -426,4 +493,36 @@
 
   return FLOATSIZE;
+}
+
+/*!
+ * Converts a float value into a byte-array
+ * @param x: The float which is to convert
+ * @return: A byte-array which accords the given float
+ */
+int Converter::floatToByteArray(float x, byte* a, int length)
+{
+  if ( length<4 )
+  {
+    PRINTF(1)("Byte Array to small\n");
+    return 0;
+  }
+  byte* p = (byte*)&x;
+
+  for (int i = 0; i < 4; i++)
+    a[i] = p[i];
+  return 4;
+}
+
+
+/*!
+ * Converts a byte-array into a float value
+ * @param a: The byte-array which is to convert
+ * @return: A float value which accords the given byte-array
+ */
+int Converter::byteArrayToFloat(const byte* a, float* x)
+{
+  *x = *((float*)a);
+
+  return 4;
 }
 
@@ -504,2 +603,52 @@
 }
 
+
+
+
+void Converter::floatTest(float x)
+{
+  //float x = 8.0f;
+  //float x = numeric_limits<float>::infinity();
+
+  printf("To Convert: %e\n", x);
+
+  byte* res = floatToByteArray(x);
+  for (int i = 0; i < 4; i++)
+    printf("%i ", res[i]);
+  printf("\n");
+
+  float y = byteArrayToFloat(res);
+  printf("ReConvert: %e\n", y);
+
+  if (x == y)
+    printf("equal\n");
+  else
+    printf("different\n");
+}
+
+void Converter::debug()
+{
+  printf("We rulez\n");
+
+  //Denormalized?
+  //floatTest(-9.87624e-38f);
+  //floatTest(-9.87624e-37f);
+  //floatTest(-9.87624e-36f);
+  //floatTest(-9.87624e-35f);
+
+  /*
+  floatTest(14.7f);
+  floatTest(12.07e15f);
+  floatTest(0.0f);
+  floatTest(5.67e-15f);
+  */
+
+  //floatTest(-18.0098f);
+  //floatTest(-24.07e23f);
+  //floatTest(-0.0f);
+  //floatTest(-5.67e-29f);
+  floatTest(-45.7e-32f);
+  floatTest(45.7e-33f);
+  floatTest(-45.7e-34f);
+  floatTest(45.7e-35f);
+}
Index: trunk/src/lib/network/converter.h
===================================================================
--- trunk/src/lib/network/converter.h	(revision 6633)
+++ trunk/src/lib/network/converter.h	(revision 6634)
@@ -9,4 +9,5 @@
 /* include this file, it contains some default definitions */
 #include "netdefs.h"
+
 
 /* include base_object.h since all classes are derived from this one */
@@ -21,5 +22,5 @@
  * a class that can convert int to byte-array and vice versa
  */
-class Converter: public BaseObject
+class Converter : public BaseObject
 {
   public:
@@ -43,6 +44,13 @@
     static float byteArrayToFloat(byte* a);
 
-    static byte* _floatToByteArray(float x);
-    static float _byteArrayToFloat(byte* a);
+    static int _floatToByteArray(float x, byte* a, int length);
+    static int _byteArrayToFloat(const byte* a, float* x);
+
+
+    static void debug();
+    static void floatTest(float x);
+    static float getDenormConst();
+
+
   private:
     Converter();
@@ -50,3 +58,5 @@
 };
 
+#undef byte
+
 #endif /*_CONVERTER*/
Index: trunk/src/lib/network/network_game_manager.cc
===================================================================
--- trunk/src/lib/network/network_game_manager.cc	(revision 6633)
+++ trunk/src/lib/network/network_game_manager.cc	(revision 6634)
@@ -52,10 +52,4 @@
   this->setClassID(CL_NETWORK_GAME_MANAGER, "NetworkGameManager");
 
-  allOutBuffer.length = 0;
-
-  allOutBuffer.maxLength = 10*1024;
-
-  allOutBuffer.buffer = new byte[10*1024];
-
   newUniqueID = MAX_CONNECTIONS + 2;
 
@@ -74,6 +68,4 @@
   }
 
-  if ( allOutBuffer.buffer )
-    delete allOutBuffer.buffer;
 }
 
@@ -107,4 +99,5 @@
       if ( b == CREATE_ENTITY )
       {
+        PRINTF(0)("CREATE_ENTITY\n");
         if ( !handleCreateEntity( i, data, length, sender ) )
           return i;
@@ -137,14 +130,14 @@
     }
 
+    if ( b == REQUEST_ENTITY_LIST )
+    {
+      sendEntityList( sender );
+      continue;
+    }
+
     if ( b == REQUEST_SYNC )
     {
       if ( !handleRequestSync( i, data, length, sender ) )
         return i;
-      continue;
-    }
-
-    if ( b == REQUEST_ENTITY_LIST )
-    {
-      sendEntityList( sender );
       continue;
     }
@@ -188,19 +181,5 @@
   }
 
-  *reciever = 0;
-  int nbytes = allOutBuffer.length;
-  allOutBuffer.length = 0;
-
-  if ( nbytes <=0 )
-    return 0;
-
-  if ( nbytes > maxLength )
-  {
-    PRINTF(1)("OutBuffer.length (%d) > (%d) networkStreamBuffer.length\n", nbytes, maxLength);
-    return 0;
-  }
-
-  memcpy( data, allOutBuffer.buffer, nbytes );
-  return nbytes;
+  return 0;
 }
 
@@ -221,5 +200,4 @@
 int NetworkGameManager::createEntity( ClassID classID, int owner )
 {
-
   if ( this->isServer() )
   {
@@ -254,5 +232,4 @@
       return NULL;
     }
-    newUniqueID++;
 
     BaseObject * b = Factory::fabricate( element );
@@ -268,5 +245,5 @@
     {
       Synchronizeable * s = dynamic_cast<Synchronizeable*>(b);
-      s->setUniqueID( newUniqueID );
+      s->setUniqueID( newUniqueID++ );
       s->setOwner( 0 );
       this->networkStream->connectSynchronizeable( *s );
@@ -313,8 +290,14 @@
 void NetworkGameManager::requestCreateEntity(ClassID classID)
 {
-  if ( !writeToClientBuffer( allOutBuffer, (byte)REQUEST_CREATE ) )
-    return;
-  if ( !writeToClientBuffer( allOutBuffer, (int)classID ) )
-    return;
+  for ( int i = 0; i<outBuffer.size(); i++)
+  {
+    if ( !this->networkStream->isUserIdActive( i ) )
+      continue;
+
+    if ( !writeToClientBuffer( outBuffer[i], (byte)REQUEST_CREATE ) )
+      return;
+    if ( !writeToClientBuffer( outBuffer[i], (int)classID ) )
+      return;
+  }
 }
 
@@ -325,8 +308,14 @@
 void NetworkGameManager::requestRemoveEntity(int uniqueID)
 {
-  if ( !writeToClientBuffer( allOutBuffer, (byte)REQUEST_REMOVE ) )
-    return;
-  if ( !writeToClientBuffer( allOutBuffer, uniqueID ) )
-    return;
+  for ( int i = 0; i<outBuffer.size(); i++)
+  {
+    if ( !this->networkStream->isUserIdActive( i ) )
+      continue;
+
+    if ( !writeToClientBuffer( outBuffer[i], (byte)REQUEST_REMOVE ) )
+      return;
+    if ( !writeToClientBuffer( outBuffer[i], uniqueID ) )
+      return;
+  }
 }
 
@@ -338,12 +327,18 @@
 int NetworkGameManager::executeCreateEntity(ClassID classID, int uniqueID, int owner)
 {
-  if ( !writeToClientBuffer( allOutBuffer, (byte)CREATE_ENTITY ) )
-    return -1;
-  if ( !writeToClientBuffer( allOutBuffer, (int)classID ) )
-    return -1;
-  if ( !writeToClientBuffer( allOutBuffer, uniqueID ) )
-    return -1;
-  if ( !writeToClientBuffer( allOutBuffer, owner ) )
-    return -1;
+  for ( int i = 0; i<outBuffer.size(); i++)
+  {
+    if ( !this->networkStream->isUserIdActive( i ) )
+      continue;
+
+    if ( !writeToClientBuffer( outBuffer[i], (byte)CREATE_ENTITY ) )
+      return -1;
+    if ( !writeToClientBuffer( outBuffer[i], (int)classID ) )
+      return -1;
+    if ( !writeToClientBuffer( outBuffer[i], uniqueID ) )
+      return -1;
+    if ( !writeToClientBuffer( outBuffer[i], owner ) )
+      return -1;
+  }
 
   doCreateEntity( classID, uniqueID, owner );
@@ -359,8 +354,14 @@
 void NetworkGameManager::executeRemoveEntity(int uniqueID)
 {
-  if ( !writeToClientBuffer( allOutBuffer, (byte)REMOVE_ENTITY ) )
-    return;
-  if ( !writeToClientBuffer( allOutBuffer, uniqueID ) )
-    return;
+  for ( int i = 0; i<outBuffer.size(); i++)
+  {
+    if ( !this->networkStream->isUserIdActive( i ) )
+      continue;
+
+    if ( !writeToClientBuffer( outBuffer[i], (byte)REMOVE_ENTITY ) )
+      return;
+    if ( !writeToClientBuffer( outBuffer[i], uniqueID ) )
+      return;
+  }
 
   doRemoveEntity(uniqueID);
@@ -406,5 +407,5 @@
   while ( it != e )
   {
-
+    PRINTF(5)("SENDING ENTITY %s id %d\n", (*it)->getClassName(), (*it)->getUniqueID() );
     if ( !writeToClientBuffer( outBuffer[userID], (int)((*it)->getLeafClassID()) ) )
       return;
@@ -426,4 +427,6 @@
 bool NetworkGameManager::signalNewPlayer(int userId)
 {
+  if ( userId >= outBuffer.size() )
+    resizeBufferVector( userId );
 
   /* create new playable for Player*/
@@ -483,5 +486,5 @@
 
     //HACK: hack to prevent collision
-    if ( b->isA(CL_WORLD_ENTITY) )
+    if ( b->isA(CL_WORLD_ENTITY) && !b->isA(CL_PLAYABLE) )
     {
       if ( NetworkManager::getInstance()->getHostID()!=0 )
@@ -489,6 +492,6 @@
         static Vector pos = Vector(1000.0, 1000.0, 1000.0);
         PNode *p = dynamic_cast<PNode*>(b);
-        p->setRelCoor(pos);
-        p->updateNode(0);
+        p->setAbsCoor(pos);
+        //p->updateNode(0);
         pos += Vector(1000.0, 1000.0, 1000.0);
       }
@@ -596,4 +599,5 @@
 
   Playable *p = NULL;
+  Synchronizeable *s = NULL;
 
   for ( ; it !=networkStream->getSyncEnd(); it++ )
@@ -601,4 +605,8 @@
     if ( (*it)->getUniqueID()==uniqueID )
     {
+      if ( (*it)->isA( CL_SYNCHRONIZEABLE ) )
+      {
+        s = dynamic_cast<Synchronizeable*>(*it);
+      }
       if ( (*it)->isA( CL_PLAYABLE ) )
       {
@@ -614,5 +622,10 @@
   Player* player = State::getPlayer();
   assert(p != NULL);
+  assert(s != NULL);
   assert(player != NULL);
+
+  s->setIsOutOfSync( true );
+
+  PRINTF(0)("uniqueID = %d\n", s->getUniqueID());
 
   player->setControllable(p);
@@ -871,6 +884,6 @@
 void NetworkGameManager::sync( int uniqueID, int owner )
 {
-  if ( owner==this->getHostID() )
-    return;
+  /*if ( owner==this->getHostID() )
+  return;*/
 
   if ( !isServer() )
Index: trunk/src/lib/network/network_game_manager.h
===================================================================
--- trunk/src/lib/network/network_game_manager.h	(revision 6633)
+++ trunk/src/lib/network/network_game_manager.h	(revision 6634)
@@ -122,5 +122,5 @@
   private:
     std::vector<clientBuffer>     outBuffer;
-    clientBuffer                  allOutBuffer;
+    //clientBuffer                  allOutBuffer;
     static NetworkGameManager*    singletonRef;
 
Index: trunk/src/lib/network/network_socket.cc
===================================================================
--- trunk/src/lib/network/network_socket.cc	(revision 6633)
+++ trunk/src/lib/network/network_socket.cc	(revision 6634)
@@ -398,5 +398,8 @@
 bool NetworkSocket::writePacket( byte * data, int length )
 {
-  PRINTF(5)("NetworkSocket::writePacket()\n");
+  PRINTF(5)("NetworkSocket::writePacket() size=%d\n", length);
+
+  if ( length > 1024 )
+  PRINTF(2)("WARNING SENDING BIG PACKET SIZE = %d\n", length);
 
   byte blen[INTSIZE];
Index: trunk/src/lib/network/network_stream.cc
===================================================================
--- trunk/src/lib/network/network_stream.cc	(revision 6633)
+++ trunk/src/lib/network/network_stream.cc	(revision 6634)
@@ -78,4 +78,5 @@
   this->connectionMonitor = new ConnectionMonitor();
   this->networkSockets.push_back( NULL );
+  this->networkSockets[0] = NULL; //TODO: remove this
   this->handshakes.push_back( NULL );
   this->bActive = true;
@@ -266,5 +267,5 @@
             if ( networkSockets[i] != NULL )
             {
-              PRINTF(5)("write %d bytes to socket %d\n", dataLength, reciever);
+              PRINTF(5)("write %d bytes to socket %d\n", dataLength, i);
               networkSockets[i]->writePacket(downBuffer, dataLength);
             }
@@ -310,5 +311,5 @@
             if ( (*it)->writeBytes(upBuffer+sizeof(header), dataLength, i) != header.length )
             {
-              PRINTF(1)("%s did not read all the data!\n", (*it)->getClassName());
+              PRINTF(1)("%s did not read all the data id = %d!\n", (*it)->getClassName(), (*it)->getUniqueID());
               break;
             }
Index: trunk/src/lib/network/network_stream.h
===================================================================
--- trunk/src/lib/network/network_stream.h	(revision 6633)
+++ trunk/src/lib/network/network_stream.h	(revision 6634)
@@ -55,4 +55,6 @@
     inline int getSyncCount(){ return synchronizeables.size(); }
 
+    inline bool isUserIdActive( int userID ) { if (userID>=networkSockets.size()) return false; else return networkSockets[userID]!=NULL; }
+
   private:
     NetworkProtocol*       networkProtocol;
Index: trunk/src/lib/sound/sound_source.h
===================================================================
--- trunk/src/lib/sound/sound_source.h	(revision 6633)
+++ trunk/src/lib/sound/sound_source.h	(revision 6634)
@@ -44,5 +44,5 @@
     ALuint                 sourceID;              //!< The ID of the Source
     const SoundBuffer*     buffer;                //!< The buffer to play in this source.
-    const PNode*           sourceNode;            //!< The SourceNode represente the position/velocity... of this source.
+    const PNode*           sourceNode;            //!< The SourceNode representing the position/velocity... of this source.
 };
 #endif /* _SOUND_SOURCE_H */
