Index: branches/network/src/defs/class_id.h
===================================================================
--- branches/network/src/defs/class_id.h	(revision 7973)
+++ branches/network/src/defs/class_id.h	(revision 7974)
@@ -367,5 +367,6 @@
   CL_NETWORK_GAME_MANAGER       =    0x00000d07,
   CL_MESSAGE_MANAGER            =    0x00000d08,
-  CL_SIMPLE_SYNC                =    0x00000d09,
+  CL_PLAYER_STATS               =    0x00000d09,
+  CL_SIMPLE_SYNC                =    0x00000d0a,
 
 
Index: branches/network/src/lib/network/Makefile.am
===================================================================
--- branches/network/src/lib/network/Makefile.am	(revision 7973)
+++ branches/network/src/lib/network/Makefile.am	(revision 7974)
@@ -23,4 +23,5 @@
 		      network_log.cc \
 		      zip.cc \
+		      player_stats.cc \
 		      \
 		      synchronizeable_var/synchronizeable_var.cc \
@@ -56,4 +57,5 @@
 		 network_log.h \
 		 zip.h \
+		 player_stats.h \
 		 \
 		 synchronizeable_var/synchronizeable_var.h \
Index: branches/network/src/lib/network/connection_monitor.cc
===================================================================
--- branches/network/src/lib/network/connection_monitor.cc	(revision 7973)
+++ branches/network/src/lib/network/connection_monitor.cc	(revision 7974)
@@ -61,8 +61,6 @@
  * @param stateId packet's state id
  */
-void ConnectionMonitor::processUnzippedOutgoingPacket( byte * data, int length, int stateId )
-{
-  int tick = SDL_GetTicks();
-  
+void ConnectionMonitor::processUnzippedOutgoingPacket( int tick, byte * data, int length, int stateId )
+{
   nOutgoingPackets++;
   
@@ -93,8 +91,6 @@
  * @param ackedState state which was acked by this packet
  */
-void ConnectionMonitor::processUnzippedIncomingPacket( byte * data, int length, int stateId, int ackedState )
-{
-  int tick = SDL_GetTicks();
-  
+void ConnectionMonitor::processUnzippedIncomingPacket( int tick, byte * data, int length, int stateId, int ackedState )
+{
   nIncomingPackets++;
   
@@ -169,8 +165,6 @@
  * @param stateId packet's state id
  */
-void ConnectionMonitor::processZippedOutgoingPacket( byte * data, int length, int stateId )
-{
-  int tick = SDL_GetTicks();
-  
+void ConnectionMonitor::processZippedOutgoingPacket( int tick, byte * data, int length, int stateId )
+{
   nZOutgoingPackets++;
   
@@ -196,8 +190,6 @@
  * @param ackedState state which was acked by this packet
  */
-void ConnectionMonitor::processZippedIncomingPacket( byte * data, int length, int stateId, int ackedState )
-{
-  int tick = SDL_GetTicks();
-  
+void ConnectionMonitor::processZippedIncomingPacket( int tick, byte * data, int length )
+{
   nZIncomingPackets++;
   
@@ -233,9 +225,10 @@
 void ConnectionMonitor::printStatis( )
 {
-  NETPRINT(n)("=========NETWORKSTATS FOR USER %d=========\n", userId);
-  NETPRINT(n)("PING = %d\n", ping);
+  NETPRINT(n)("============NETWORKSTATS FOR USER %d============\n", userId);
+  NETPRINT(n)("PING = %d\n", ping );
   NETPRINT(n)("BANDWIDTH: UP: %f (%f) DOWN %f (%f)\n", outgoingZippedBandWidth, outgoingUnzippedBandWidth, incomingZippedBandWidth, incomingUnzippedBandWidth);
-  NETPRINT(n)("==========================================");
-}
-
-
+  NETPRINT(n)("PACKETS: RECIEVED %d; SENT %d\n", nIncomingPackets, nOutgoingPackets );
+  NETPRINT(n)("================================================\n");
+}
+
+
Index: branches/network/src/lib/network/connection_monitor.h
===================================================================
--- branches/network/src/lib/network/connection_monitor.h	(revision 7973)
+++ branches/network/src/lib/network/connection_monitor.h	(revision 7974)
@@ -22,9 +22,9 @@
     virtual ~ConnectionMonitor();
 
-    void processUnzippedOutgoingPacket( byte * data, int length, int stateId );
-    void processUnzippedIncomingPacket( byte * data, int length, int stateId, int ackedState );
+    void processUnzippedOutgoingPacket( int tick, byte * data, int length, int stateId );
+    void processUnzippedIncomingPacket( int tick, byte * data, int length, int stateId, int ackedState );
     
-    void processZippedOutgoingPacket( byte * data, int length, int stateId );
-    void processZippedIncomingPacket( byte * data, int length, int stateId, int ackedState );
+    void processZippedOutgoingPacket( int tick, byte * data, int length, int stateId );
+    void processZippedIncomingPacket( int tick, byte * data, int length );
     
     void calculatePing();
Index: branches/network/src/lib/network/network_stream.cc
===================================================================
--- branches/network/src/lib/network/network_stream.cc	(revision 7973)
+++ branches/network/src/lib/network/network_stream.cc	(revision 7974)
@@ -177,4 +177,6 @@
 void NetworkStream::processData()
 {
+  int tick = SDL_GetTicks();
+  
   currentState++;
   
@@ -207,6 +209,6 @@
   // order of up/downstream is important!!!!
   // don't change it
-  handleDownstream();
-  handleUpstream();
+  handleDownstream( tick );
+  handleUpstream( tick );
 
 }
@@ -391,10 +393,10 @@
  * handle upstream network traffic
  */
-void NetworkStream::handleUpstream( )
+void NetworkStream::handleUpstream( int tick )
 {
   int offset;
   int n;
   
-  for ( PeerList::iterator peer = peers.begin(); peer != peers.end(); peer++ )
+  for ( PeerList::reverse_iterator peer = peers.rbegin(); peer != peers.rend(); peer++ )
   {
     offset = INTSIZE; //make already space for length 
@@ -496,6 +498,6 @@
       writeToNewDict( buf, offset );
     
-    peer->second.connectionMonitor->processUnzippedOutgoingPacket( buf, offset, currentState );
-    peer->second.connectionMonitor->processZippedOutgoingPacket( compBuf, compLength, currentState );
+    peer->second.connectionMonitor->processUnzippedOutgoingPacket( tick, buf, offset, currentState );
+    peer->second.connectionMonitor->processZippedOutgoingPacket( tick, compBuf, compLength, currentState );
     
     //NETPRINTF(n)("send packet: %d userId = %d\n", offset, peer->second.userId);
@@ -506,5 +508,5 @@
  * handle downstream network traffic
  */
-void NetworkStream::handleDownstream( )
+void NetworkStream::handleDownstream( int tick )
 {
   int offset = 0;
@@ -527,5 +529,6 @@
     while ( 0 < (compLength = peer->second.socket->readPacket( compBuf, UDP_PACKET_SIZE )) )
     {
-      //TODO tell monitor about zipped packet. because dropped packets dont count to bandwidth
+      peer->second.connectionMonitor->processZippedIncomingPacket( tick, compBuf, compLength );
+      
       //PRINTF(0)("GGGGGOOOOOOOOOOTTTTTTTT: %d\n", compLength);
       packetLength = Zip::getInstance()->unZip( compBuf, compLength, buf, UDP_PACKET_SIZE );
@@ -547,4 +550,6 @@
       //NETPRINTF(n)("ackedstate: %d\n", ackedState);
       offset = 4*INTSIZE;
+      
+      peer->second.connectionMonitor->processUnzippedIncomingPacket( tick, buf, offset, state, ackedState );
 
       //NETPRINTF(n)("got packet: %d, %d\n", length, packetLength);
@@ -672,7 +677,4 @@
       }
       
-      peer->second.connectionMonitor->processZippedIncomingPacket( compBuf, compLength, state, ackedState );
-      peer->second.connectionMonitor->processUnzippedIncomingPacket( buf, offset, state, ackedState );
-    
       assert( peer->second.lastAckedState <= ackedState );
       peer->second.lastAckedState = ackedState;
Index: branches/network/src/lib/network/network_stream.h
===================================================================
--- branches/network/src/lib/network/network_stream.h	(revision 7973)
+++ branches/network/src/lib/network/network_stream.h	(revision 7974)
@@ -79,6 +79,6 @@
     void updateConnectionList();
     void handleHandshakes();
-    void handleUpstream();
-    void handleDownstream(); 
+    void handleUpstream( int tick );
+    void handleDownstream(int tick ); 
     void handleNewClient( int userId );
     void cleanUpOldSyncList();
Index: branches/network/src/lib/network/player_stats.cc
===================================================================
--- branches/network/src/lib/network/player_stats.cc	(revision 7974)
+++ branches/network/src/lib/network/player_stats.cc	(revision 7974)
@@ -0,0 +1,142 @@
+/*
+   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: Christoph Renner
+   co-programmer: ...
+*/
+
+#include "player_stats.h"
+
+#include "class_list.h"
+#include "src/lib/util/loading/factory.h"
+
+
+CREATE_FACTORY(PlayerStats, CL_PLAYER_STATS);
+
+/**
+ * constructor
+ */
+PlayerStats::PlayerStats( int userId )
+{
+  init();
+  
+  this->userId = userId;
+}
+
+/**
+ * constructor
+ */
+PlayerStats::PlayerStats( const TiXmlElement* root )
+{
+  init();
+}
+
+void PlayerStats::init( )
+{
+  this->setClassID( CL_PLAYER_STATS, "PlayerStats" );
+
+  this->userId = 0;
+  this->groupId = 0;
+  this->score = 0;
+  this->playableClassId = 0;
+  this->modelFileName = "";
+  
+  userId_handle = registerVarId( new SynchronizeableInt( &userId, &userId, "userId" ) );
+  groupId_handle = registerVarId( new SynchronizeableInt( &groupId, &groupId, "groupId" ) );
+  score_handle = registerVarId( new SynchronizeableInt( &score, &score, "score" ) );
+  playableClassId_handle = registerVarId( new SynchronizeableInt( &playableClassId, &playableClassId, "playableClassId") );
+  playableUniqueId_handle = registerVarId( new SynchronizeableInt( &playableUniqueId, &playableUniqueId, "playableUniqueId" ) );
+  modelFileName_handle = registerVarId( new SynchronizeableString( &modelFileName, &modelFileName, "modelFileName" ) );
+}
+
+
+/**
+ * standard deconstructor
+ */
+PlayerStats::~PlayerStats()
+{
+}
+
+
+ /**
+ * override this function to be notified on change
+ * of your registred variables.
+ * @param id id's which have changed
+  */
+void PlayerStats::varChangeHandler( std::list< int > & id )
+{
+  if ( std::find( id.begin(), id.end(), playableUniqueId_handle ) != id.end() )
+  {
+    this->setPlayableUniqueId( this->playableUniqueId );
+  }
+}
+
+/**
+ * get stats for user userId
+ * @param userId user's id
+ * @return stats assigned to user
+ */
+PlayerStats * PlayerStats::getStats( int userId )
+{
+  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYER_STATS );
+  
+  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
+  {
+    if ( dynamic_cast<PlayerStats*>(*it)->getUserId() == userId )
+    {
+      return dynamic_cast<PlayerStats*>(*it);
+    }
+  }
+  
+  //TODO maybe we should create an object here
+  
+  return NULL;
+}
+
+/**
+ * set playable class id and set playable
+ */
+void PlayerStats::setPlayableUniqueId( int uniqueId )
+{
+  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
+  
+  this->playable = NULL;
+  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
+  {
+    if ( dynamic_cast<Playable*>(*it)->getUniqueID() == uniqueId )
+    {
+      this->playable = dynamic_cast<Playable*>(*it);
+      break;
+    }
+  }
+  
+  this->playableUniqueId = uniqueId;
+}
+
+/**
+ * get playable associated to player
+ * @return playable associated to player
+ */
+Playable * PlayerStats::getPlayable()
+{
+  if ( playable )
+    return playable;
+  
+  assert( playableUniqueId > 0 );
+  
+  setPlayableUniqueId( playableUniqueId );
+  
+  assert( playable );
+  
+  return playable;
+}
+
+
Index: branches/network/src/lib/network/player_stats.h
===================================================================
--- branches/network/src/lib/network/player_stats.h	(revision 7974)
+++ branches/network/src/lib/network/player_stats.h	(revision 7974)
@@ -0,0 +1,66 @@
+/*!
+ * @file player_stats.h
+ * @brief Definition of PlayerStats
+ */
+
+#ifndef _PLAYER_STATS_H
+#define _PLAYER_STATS_H
+
+#include "synchronizeable.h"
+#include "playable.h"
+
+#include <string>
+#include <list>
+
+//! A class for storing player information
+class PlayerStats : public Synchronizeable 
+{
+
+  public:
+    PlayerStats( const TiXmlElement* root = NULL );
+    PlayerStats( int userId );
+    virtual ~PlayerStats();
+    
+    virtual void varChangeHandler( std::list<int> & id );
+    
+    PlayerStats * getStats( int userId );
+    
+    inline int getUserId(){ return userId; }
+    
+    inline int getGroupId(){ return groupId; }
+    inline void setGroupId( int groupId ){ this->groupId = groupId; }
+    
+    inline int getScore(){ return score; }
+    inline void setScore( int score ){ this->score = score; }
+    
+    inline int getPlayableClassId(){ return playableClassId; }
+    void setPlayableClassId( int classId ){ this->playableClassId = classId; };
+    
+    inline int getPlayableUniqueId(){ return playableUniqueId; }
+    void setPlayableUniqueId( int uniqueId );
+    
+    Playable * getPlayable();
+
+  private:
+    int userId;                //!< userId
+    int groupId;               //!< groupId
+
+    int score;                 //!< users score points
+    int playableClassId;       //!< players playable class id
+    int playableUniqueId;      //!< playable's uniqueId
+    std::string modelFileName; //!< model filename
+
+    Playable * playable;       //!< pointer to players playable
+
+    // handles for SynchronizeableVars
+    int userId_handle;
+    int groupId_handle;
+    int score_handle;
+    int playableClassId_handle;
+    int playableUniqueId_handle;
+    int modelFileName_handle;
+    
+    void init();
+};
+
+#endif /* _PLAYER_STATS_H */
Index: branches/network/src/lib/network/synchronizeable.h
===================================================================
--- branches/network/src/lib/network/synchronizeable.h	(revision 7973)
+++ branches/network/src/lib/network/synchronizeable.h	(revision 7974)
@@ -61,5 +61,5 @@
     virtual void handleSentState( int userId, int stateId, int fromStateId );
     virtual void handleRecvState( int userId, int stateId, int fromStateId );
-
+    
     void registerVar( SynchronizeableVar * var );
     int registerVarId( SynchronizeableVar * var );
