Index: trunk/src/lib/network/message_manager.cc
===================================================================
--- trunk/src/lib/network/message_manager.cc	(revision 9027)
+++ trunk/src/lib/network/message_manager.cc	(revision 9059)
@@ -58,4 +58,8 @@
   
   messageQueue.clear();
+  
+  this->messageHandlerMap.clear();
+  
+  MessageManager::singletonRef = NULL;
 }
 
Index: trunk/src/lib/network/network_game_manager.cc
===================================================================
--- trunk/src/lib/network/network_game_manager.cc	(revision 9027)
+++ trunk/src/lib/network/network_game_manager.cc	(revision 9059)
@@ -77,4 +77,6 @@
   
   PlayerStats::deleteAllPlayerStats();
+  
+  NetworkGameManager::singletonRef = NULL;
 }
 
@@ -274,10 +276,15 @@
     if ( State::getPlayer()->getPlayable() != *it )
     {
-      PRINTF(0)("Delete unused playable: %s owner: %d\n", (*it)->getClassName(), (*it)->getOwner() );
-      std::list<Playable*>::iterator delit = it;
-      it++;
-      delete *delit;
-      playablesToDelete.erase( delit );
-      continue;
+      const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
+       
+      if ( list && std::find( list->begin(), list->end(), *it ) != list->end() )
+      {      
+        PRINTF(0)("Delete unused playable: %s owner: %d\n", (*it)->getClassName(), (*it)->getOwner() );
+        std::list<Playable*>::iterator delit = it;
+        it++;
+        delete *delit;
+        playablesToDelete.erase( delit );
+        continue;
+      }
     }
     it++;
Index: trunk/src/lib/network/network_manager.cc
===================================================================
--- trunk/src/lib/network/network_manager.cc	(revision 9027)
+++ trunk/src/lib/network/network_manager.cc	(revision 9059)
@@ -52,5 +52,4 @@
   /* initialize the references */
   this->networkStream = NULL;
-  this->sharedNetworkData = SharedNetworkData::getInstance();
   this->elapsedTime = 0.0f;
   
@@ -70,4 +69,5 @@
 NetworkManager::~NetworkManager()
 {
+  PRINTF(0)("NetworkManager destructor\n");
   if ( this->networkStream )
   {
@@ -75,4 +75,6 @@
     this->networkStream = NULL;
   }
+  
+  NetworkManager::singletonRef = NULL;
 }
 
@@ -103,5 +105,5 @@
 {
   this->networkStream = new NetworkStream( name, port );
-  this->sharedNetworkData->setDefaultSyncStream(this->networkStream);
+  SharedNetworkData::getInstance()->setDefaultSyncStream(this->networkStream);
   this->networkStream->startHandshake();
   return 1;
@@ -115,8 +117,8 @@
 int NetworkManager::createServer(unsigned int port)
 {
-  this->sharedNetworkData->setHostID(0);
-  this->sharedNetworkData->setGameServer(true);
+  SharedNetworkData::getInstance()->setHostID(0);
+  SharedNetworkData::getInstance()->setGameServer(true);
   this->networkStream = new NetworkStream(port);
-  this->sharedNetworkData->setDefaultSyncStream(this->networkStream);
+  SharedNetworkData::getInstance()->setDefaultSyncStream(this->networkStream);
   this->networkStream->createNetworkGameManager();
   PRINTF(0)("CREATE SERVER\n");
@@ -144,5 +146,5 @@
   this->elapsedTime = 0.0f;
 
-//  if ( networkStream->isActive() )
+  if ( networkStream )
     networkStream->processData();
   
Index: trunk/src/lib/network/network_manager.h
===================================================================
--- trunk/src/lib/network/network_manager.h	(revision 9027)
+++ trunk/src/lib/network/network_manager.h	(revision 9059)
@@ -40,6 +40,6 @@
 
     /** Returns the hostID @return The hostID of the object */
-    inline int getHostID() { return this->sharedNetworkData->getHostID(); }
-    inline bool isGameServer() { return this->sharedNetworkData->isGameServer(); }
+    inline int getHostID() { return SharedNetworkData::getInstance()->getHostID(); }
+    inline bool isGameServer() { return SharedNetworkData::getInstance()->isGameServer(); }
 
 
@@ -58,5 +58,4 @@
     NetworkStream*                   networkStream;       //!< pointer to network stream
 
-    SharedNetworkData*               sharedNetworkData;       //!< reference to the shared data
     float                            elapsedTime;             //!< elapsed time since the last network update
 };
Index: trunk/src/lib/network/network_stream.cc
===================================================================
--- trunk/src/lib/network/network_stream.cc	(revision 9027)
+++ trunk/src/lib/network/network_stream.cc	(revision 9059)
@@ -111,5 +111,4 @@
     serverSocket = NULL;
   }
-
   for ( PeerList::iterator i = peers.begin(); i!=peers.end(); i++)
   {
@@ -133,5 +132,4 @@
     }
   }
-  
   for ( SynchronizeableList::const_iterator it = getSyncBegin(); it != getSyncEnd(); it ++ )
     (*it)->setNetworkStream( NULL );
Index: trunk/src/story_entities/menu/game_menu.cc
===================================================================
--- trunk/src/story_entities/menu/game_menu.cc	(revision 9027)
+++ trunk/src/story_entities/menu/game_menu.cc	(revision 9059)
@@ -36,4 +36,8 @@
 #include "glgui.h"
 #include "menu/glgui_imagebutton.h"
+
+#include "glgui_text.h"
+
+#include "network_manager.h"
 
 //! This creates a Factory to fabricate a GameMenu
@@ -122,4 +126,7 @@
   this->levelsBox = NULL;
   this->networkBox = NULL;
+  
+  this->clientNetworkBox = NULL;
+  this->serverNetworkBox = NULL;
 
   this->optionsBox = NULL;
@@ -233,7 +240,9 @@
       OrxGui::GLGuiButton* clientButton = new OrxGui::GLGuiPushButton("Client");
       networkBox->pack(clientButton);
+      clientButton->connect(SIGNAL(clientButton, released), this, SLOT(GameMenu, showClientMenu));
 
       OrxGui::GLGuiButton* serverButton = new OrxGui::GLGuiPushButton("Server");
       networkBox->pack(serverButton);
+      serverButton->connect(SIGNAL(serverButton, released), this, SLOT(GameMenu, showServerMenu));
 
 
@@ -495,4 +504,97 @@
 }
 
-
-
+/**
+ * show controls to join network game
+ */
+void GameMenu::showClientMenu( )
+{
+  if ( this->serverNetworkBox )
+  {
+    delete this->serverNetworkBox;
+    this->serverNetworkBox = NULL;
+  }
+  
+  if ( !this->clientNetworkBox )
+  {
+    this->clientNetworkBox = new OrxGui::GLGuiBox();
+    {
+      OrxGui::GLGuiText * text = new OrxGui::GLGuiText();
+      text->setText( "Host:" );
+      this->clientNetworkBox->pack( text );
+      
+      this->ipInputLine = new OrxGui::GLGuiInputLine( );
+      this->ipInputLine->setText( "tardis-d08" );
+      this->clientNetworkBox->pack( this->ipInputLine );
+      this->ipInputLine->connect(SIGNAL(ipInputLine, enterPushed), this, SLOT(GameMenu, connectToServer));
+      this->ipInputLine->select();
+      
+      OrxGui::GLGuiButton* connectButton = new OrxGui::GLGuiPushButton("Connect");
+      clientNetworkBox->pack(connectButton);
+      connectButton->connect(SIGNAL(connectButton, released), this, SLOT(GameMenu, connectToServer));
+    }
+  }
+  
+  this->clientNetworkBox->showAll();
+  
+  this->clientNetworkBox->setAbsCoor2D( 300.0f, 100.0f );
+}
+
+/**
+ * show controls to create new network game
+ */
+void GameMenu::showServerMenu( )
+{
+  if ( this->clientNetworkBox )
+  {
+    delete this->clientNetworkBox;
+    this->clientNetworkBox = NULL;
+  }
+  
+  if ( !this->serverNetworkBox )
+  {
+    this->serverNetworkBox = new OrxGui::GLGuiBox();
+    {
+      OrxGui::GLGuiText * text = new OrxGui::GLGuiText();
+      text->setText( "Map:" );
+      this->serverNetworkBox->pack( text );
+      
+      OrxGui::GLGuiText * text2 = new OrxGui::GLGuiText();
+      text2->setText( "Multiplayer TeamDeathMatch Arena" );
+      this->serverNetworkBox->pack( text2 );
+      
+      OrxGui::GLGuiButton* createButton = new OrxGui::GLGuiPushButton("Create Server");
+      serverNetworkBox->pack(createButton);
+      createButton->connect(SIGNAL(createButton, released), this, SLOT(GameMenu, createServer));
+    }
+  }
+  
+  this->serverNetworkBox->showAll();
+  
+  this->serverNetworkBox->setAbsCoor2D( 300.0f, 100.0f );
+}
+
+/**
+ * connect to host
+ */
+void GameMenu::connectToServer( )
+{
+  PRINTF(0)("Connecting to %s\n", this->ipInputLine->_getText().c_str() );
+  
+  State::setOnline(true);
+  NetworkManager::getInstance()->establishConnection( this->ipInputLine->_getText(), 9999 );
+  
+  this->startLevel( 5 );
+}
+
+void GameMenu::createServer( )
+{
+  PRINTF(0)("Create server\n" );
+  
+  State::setOnline(true);
+  NetworkManager::getInstance()->createServer( 9999 );
+  
+  this->startLevel( 5 );
+}
+
+
+
Index: trunk/src/story_entities/menu/game_menu.h
===================================================================
--- trunk/src/story_entities/menu/game_menu.h	(revision 9027)
+++ trunk/src/story_entities/menu/game_menu.h	(revision 9059)
@@ -45,4 +45,10 @@
     void showMultiPlayer();
     void showOptionsMenu();
+    
+    void showClientMenu();
+    void connectToServer();
+    
+    void showServerMenu();
+    void createServer();
 
 
@@ -63,4 +69,6 @@
     void setSelectorSound(const std::string& selectorSound);
 
+    
+
 
   private:
@@ -68,4 +76,9 @@
     OrxGui::GLGuiBox*                 levelsBox;
     OrxGui::GLGuiBox*                 networkBox;
+    
+    OrxGui::GLGuiBox*                 clientNetworkBox;
+    OrxGui::GLGuiInputLine*           ipInputLine;
+    
+    OrxGui::GLGuiBox*                 serverNetworkBox;
 
     OrxGui::GLGuiBox*                 optionsBox;
Index: trunk/src/story_entities/multi_player_world.cc
===================================================================
--- trunk/src/story_entities/multi_player_world.cc	(revision 9027)
+++ trunk/src/story_entities/multi_player_world.cc	(revision 9059)
@@ -27,4 +27,6 @@
 #include "network_manager.h"
 #include "network_game_manager.h"
+
+#include "state.h"
 
 
@@ -150,4 +152,6 @@
   delete NetworkGameManager::getInstance();
 
+  State::setOnline( false );
+  
   return ErrorMessage();
 }
Index: trunk/src/util/multiplayer_team_deathmatch.cc
===================================================================
--- trunk/src/util/multiplayer_team_deathmatch.cc	(revision 9027)
+++ trunk/src/util/multiplayer_team_deathmatch.cc	(revision 9059)
@@ -83,12 +83,6 @@
   subscribeEvent( ES_GAME, SDLK_TAB );
   subscribeEvent( ES_GAME, SDLK_F1 );
-  subscribeEvent( ES_MENU, SDLK_F1 );
   subscribeEvent( ES_MENU, KeyMapper::PEV_FIRE1 );
 
-  this->notifier = new OrxGui::GLGuiNotifier();
-  this->notifier->show();
-  this->notifier->setAbsCoor2D(5, 30);
-  this->notifier->setFadeAge( 6.0 );
-  this->notifier->setHideAge( 8.0 );
   this->input = new OrxGui::GLGuiInputLine();
   this->input->setAbsCoor2D(180, 5);
@@ -104,12 +98,5 @@
   unsubscribeEvent( ES_GAME, SDLK_TAB );
   unsubscribeEvent( ES_GAME, SDLK_F1 );
-  unsubscribeEvent( ES_MENU, SDLK_F1 );
   unsubscribeEvent( ES_MENU, KeyMapper::PEV_FIRE1 );
-
-  if ( this->notifier )
-  {
-    delete this->notifier;
-    this->notifier = NULL;
-  }
 
   if ( this->input )
@@ -308,5 +295,5 @@
 
   if ( team == 0 || team == 1 )
-    return CL_SPACE_SHIP;
+    return CL_FPS_PLAYER;
 
   assert( false );
@@ -316,7 +303,7 @@
 {
   if ( team == 0 )
-    return "models/ships/reap_#.obj";
+    return "models/creatures/doom_guy.md2";
   else if ( team == 1 )
-    return "models/ships/fighter.obj";
+    return "models/creatures/doom_guy.md2";
   else
     return "";
@@ -545,13 +532,13 @@
   } else if ( event.type == SDLK_F1 )
   {
+    if ( this->statsBox && !this->bLocalPlayerDead && event.bPressed )
+    {
+      PRINTF(0)("hide stats\n");
+      this->hideStats();
+    }
     if ( !this->statsBox && event.bPressed )
     {
       PRINTF(0)("show stats\n");
       this->showStats();
-    }
-    if ( this->statsBox && !this->bLocalPlayerDead && event.bPressed && this->table->rowCount() != 0 && this->table->columnCount() != 0 )
-    {
-      PRINTF(0)("hide stats\n");
-      this->hideStats();
     }
   }
@@ -597,5 +584,5 @@
 
   PRINTF(0)("CHATMESSAGE %s (%d): %s\n", name.c_str(), userId, message.c_str() );
-  notifier->pushNotifyMessage(name + ": " + message);
+  State::getPlayer()->hud().notifyUser(name + ": " + message);
 }
 
@@ -624,9 +611,8 @@
 void MultiplayerTeamDeathmatch::showStats( )
 {
-  EventHandler::getInstance()->pushState( ES_MENU );
   statsBox = new OrxGui::GLGuiBox();
   statsBox->setAbsCoor2D( 300, 100 );
 
-  this->table = new OrxGui::GLGuiTable(0,0);
+  this->table = new OrxGui::GLGuiTable(5,5);
 
   statsBox->pack( this->table );
@@ -645,6 +631,4 @@
       statsBox = NULL;
     }
-
-    EventHandler::getInstance()->popState();
 }
 
Index: trunk/src/util/multiplayer_team_deathmatch.h
===================================================================
--- trunk/src/util/multiplayer_team_deathmatch.h	(revision 9027)
+++ trunk/src/util/multiplayer_team_deathmatch.h	(revision 9059)
@@ -83,5 +83,4 @@
     OrxGui::GLGuiBox* box;
     
-    OrxGui::GLGuiNotifier* notifier;
     OrxGui::GLGuiInputLine* input;
     
Index: trunk/src/world_entities/bsp_entity.cc
===================================================================
--- trunk/src/world_entities/bsp_entity.cc	(revision 9027)
+++ trunk/src/world_entities/bsp_entity.cc	(revision 9059)
@@ -53,7 +53,8 @@
 
   this->bspManager = NULL;
-  /**
-   * @todo: Write CL_BSP_ENTITY INTO THE src/defs/class_id.h (your own definition)
-   */
+ 
+  this->name_handle = registerVarId( new SynchronizeableString( &this->name, &this->name_write, "name" ) );
+  
+  this->setSynchronized( true );
 }
 
@@ -62,4 +63,6 @@
 {
   PRINTF(0)("+++++++++++ LOADING NAME %s\n", name.c_str());
+  
+  this->name = name;
 
   // Check wether file exists....
@@ -130,2 +133,10 @@
 void BspEntity::collidesWith (WorldEntity* entity, const Vector& location)
 {}
+
+void BspEntity::varChangeHandler( std::list< int > & id )
+{
+  if ( std::find( id.begin(), id.end(), this->name_handle ) != id.end() )
+  {
+    this->setName( this->name_write );
+  }
+}
Index: trunk/src/world_entities/bsp_entity.h
===================================================================
--- trunk/src/world_entities/bsp_entity.h	(revision 9027)
+++ trunk/src/world_entities/bsp_entity.h	(revision 9059)
@@ -28,4 +28,6 @@
 
   void init();
+  
+  virtual void varChangeHandler( std::list<int> & id );
 
   virtual void draw() const;
@@ -38,4 +40,8 @@
  private:
    BspManager* bspManager;
+   
+   std::string name;                   //!< store name
+   std::string name_write;             //!< temp variable to store name
+   int name_handle;                    //!< handle for name
 
 };
Index: trunk/src/world_entities/player.h
===================================================================
--- trunk/src/world_entities/player.h	(revision 9027)
+++ trunk/src/world_entities/player.h	(revision 9059)
@@ -31,4 +31,5 @@
     bool              eject();
     inline Playable*  getPlayable() const  { return this->playable; };
+    
 
      inline Hud& hud() { return this->_hud; };
Index: trunk/src/world_entities/world_entity.cc
===================================================================
--- trunk/src/world_entities/world_entity.cc	(revision 9027)
+++ trunk/src/world_entities/world_entity.cc	(revision 9059)
@@ -738,5 +738,5 @@
   this->decreaseHealth(damage);
 
-  PRINTF(5)("Hit me: %s now only %f/%f health\n", this->getClassName(), this->getHealth(), this->getHealthMax());
+  PRINTF(0)("Hit me: %s now only %f/%f health\n", this->getClassName(), this->getHealth(), this->getHealthMax());
 
   if( this->getHealth() > 0)
