Multiplayer networking?
Page 1 of 1

Author:  imranhabib [ 26.09.2012, 13:50 ]
Post subject:  Multiplayer networking?

I am facing a problem with multiplayer networking. All that I am doing is that I start a server by calling a function Mystartserver();
Before this function my variable named m_networkstarted is set as false but as soon as i start server once i set it to true.

if (m_networkStarted)
   m_networkStarted = true;

While in my client i am doing folowing things

Myclient(const char* character, int spectator){
m_networkStarted = true;
const char* serverip = "";
if (m_networkStarted){
   if(spectator > 0)   {
      m_spectator = true;
      m_character = GameEngine::entityWorldID("Hans");
      m_spectatorNum = spectator;
      h3dSetupCameraView(GameEngine::entitySceneGraphID(m_camID),73.7f,4.0f / 3.0f, 0.1f, 1000.0f);   }
      m_character = GameEngine::entityWorldID(character);
      m_NPC = GameEngine::entityWorldID("Emilia");   }

   if(!m_spectator)   {
      GameEngine::registerCallbackOnStateRequest(NetworkApp::stateRequestCb);   }

      const char* serverip = "";
      GameEngine::registerCallbackOnStateRequest(NetworkApp::stateRequestCb);   }

else   {return;}


Now when i am running the application (.exe) first time I am calling the server once. I run another (new) exe on same computer and then i call the client 1. It works and is connected to the server. Then I run 3rd .exe and then i call my client function again and this is the second time my client is called. so now when i do this i get the status on my screen that it is connected and after half a second its shows as it is Disconnected. What is the wrong in connecting a client that i am doing ?

Although client is running but it is not connected to the server. what possible reason could it be?

i just don't get why one client gets connected while when second client is connecting it is connected for half a second and then it is disconnected?

Author:  imranhabib [ 26.09.2012, 15:19 ]
Post subject:  Re: Multiplayer networking?

Ok now i know what mistake i am doing . Probably when i am using this function while creating server it is not allowing me connect new clients but when i remove this i can attach as many client as i can.

But now problem here is that client 1 is not updating according to client 2. my client 1 is attached with hans as a view while client 2 is also attached with hans as a left view. so its attached as left view but its not updating as client 1 is updating . Does some one has any idea how can i update client 2 if client 1 is changing its position?

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group