Archived

This forum has been archived. Please start a new discussion on GitHub.

unable to connect with multiple Clients

Ok when a user logs into the Region/World server I send the server a bunch of different proxies for the different Client systems. For some reason I am unable to connect with multiple Clients through this setup.

Here is my connection to the World Server:
try
	{
		mobMgr = new MobManager(sceneMgr);

		adapter = client->createObjectAdapterWithEndpoints("Client", "default");
		PeerPtr cr = this;
		adapter->add(cr, client->stringToIdentity("Peer"));
		RegionPtr r = TerrainEngine::singleton();
		adapter->add(r, client->stringToIdentity("Region"));
		AIManagerPtr ai = mobMgr;
		adapter->add(ai, client->stringToIdentity("AIManager"));
		adapter->activate();

		Core _core;
		_core.Cpeer = PeerPrx::uncheckedCast(adapter->createProxy(client->stringToIdentity("Peer")));
		RegionPrx _r = RegionPrx::uncheckedCast(adapter->createProxy(client->stringToIdentity("Region")));
		_core.Cregion = _r;
		AIManagerPrx _ai = AIManagerPrx::uncheckedCast(adapter->createProxy(client->stringToIdentity("AIManager")));
		_core.CAIManager = _ai;
		sender->handleClientEnterWorld(SessionManager::getSingleton()->getUserID(), _core);
	}
	catch(const Ice::Exception& ex)
    {
		std::cout << ex << std::endl;
	}

In this code sender is the server Proxy.

Then on the server all of the Proxies are stored in the player object with get methods for each one so they can be used in the different server side classes.

am I doing something wrong or am I not doing something that I should do or what? Any help would be great because I am nearing my deadline for Alpha Testing to start!

Comments

  • It appears that you use the same identity for different objects. That's not possible, each Ice object (in this case, the Ice objects in your clients) must have a different identity. Have a look at http://www.zeroc.com/doc/Ice-3.4.1-IceTouch/manual/Overview.3.2.html:
    Each Ice object has a unique object identity. An object’s identity is an identi fying value that distinguishes the object from all other objects. The Ice object model assumes that object identities are globally unique, that is, no two objects within an Ice communication domain can have the same object iden tity.
    In practice, you need not use object identities that are globally unique, such as UUIDs [14], only identities that do not clash with any other identity within your domain of interest. However, there are architectural advantages to using globally unique identifiers, which we explore in Chapter 34.
  • Ok so would something like this work?
    adapter = client->createObjectAdapterWithEndpoints("Client", "default");
    		PeerPtr cr = this;
    		IDManager* idMgr = new IDManager();
    		adapter->add(cr, client->stringToIdentity(Ogre::StringConverter::toString(idMgr->getID())));
    		RegionPtr r = TerrainEngine::singleton();
    		adapter->add(r, client->stringToIdentity(Ogre::StringConverter::toString(idMgr->getID())));
    		AIManagerPtr ai = mobMgr;
    		adapter->add(ai, client->stringToIdentity(Ogre::StringConverter::toString(idMgr->getID())));
    		adapter->activate();
    

    IDManager.h:
    class IDManager
    {
    	int id1, id2, id3, id4, id5, id6, id;
    
    public:
    	IDManager(){
    		srand(time(0));
    	}
    
    	int getID(){
    		id1 = rand() % 10 + 1;
    		id2 = rand() % 20 + 1;
    		id3 = rand() % 30 + 1;
    		id4 = rand() % 40 + 1;
    		id5 = rand() % 50 + 1;
    		id6 = rand() % 60 + 1;
    
    		id = id1 + id2 + id3 + id4 + id5 * id6;
    		return id;
    	}
    };
    
  • I'm afraid I can't really evaluate this code with respect to how good it is to create unique IDs. Why not simply use UUIDs? Or, for better debugging, the names which you had + a UUID?

    Also, given that you develop an MMO, you should look at Glacier2. It will be a lot of work to add this later, and Glacier2 already has mechanisms to give your clients a unique category string for use in IDs. I recommend to check out our Chat Demo, which explains many important concepts for applications similar to yours.
  • Ok I took some time last night to look at Glacier2. What is needed in order to get it running? I would rather not have to use the Glacier2 Application because that would mean completely rewriting my client.

    Rewriting the client may not be such a bad thing considering I have done some major changes to Entity Management and other areas but with alpha testing starting hopefully next month I would rather not have to rewrite the client.

    also just a little side question sort of unrelated to Ice. You guys were building Ice for a MMO so you have MMO development experience. How would you guys suggest handling Physics. Currently I just have very basic Collision Detection Client side but it was just intended to be enough until I got a Physics simulation going.
  • I really recommend to use Glacier2 for an MMO. You will run into so many problems down the road if you do not use Glacier2, that you will end up re-inventing something very similar to Glacier2, which will be A LOT of work, which is probably better spent on your game instead of general software infrastructure. Again, the chat demo articles are a great starting point. I highly recommend to study them in detail. We just released updated versions of these articles, that make use of Ice 3.4 features.

    I'm afraid I can't give you any advice with respect to how to model game physics. This is really out of the scope of Ice and the support we can give here.
  • marc wrote: »
    I really recommend to use Glacier2 for an MMO. You will run into so many problems down the road if you do not use Glacier2, that you will end up re-inventing something very similar to Glacier2, which will be A LOT of work, which is probably better spent on your game instead of general software infrastructure. Again, the chat demo articles are a great starting point. I highly recommend to study them in detail. We just released updated versions of these articles, that make use of Ice 3.4 features.

    I'm afraid I can't give you any advice with respect to how to model game physics. This is really out of the scope of Ice and the support we can give here.

    I think you some what misunderstood me. I want to use Glacier2 but because of the way I handle State Management and everything I am unable to inherit my Application's class from the Glacier2::Application class. What is it that the Glacier2::Application does that I will have to implement myself to get it working?
  • Please have a look at the manual and the chat article, that explains Glacier2::Application. I'm afraid explaining everything you would have to implement by yourself to emulate Glacier2::Application is out of the scope of the support we can give here.
  • Ok I have been playing around with the chat demo but for some reason it's not working. I followed the directions for it in the readme and got the server running but when I go to start the glacier2 server it can't find cacert.pem

    Heres the error:

    C:\Program Files\ZeroC\Ice-3.4.1\bin>glacier2router --Ice.Config=config.glacier2

    !! 12/28/10 13:44:05.324 glacier2router: error: service caught unhandled exception:
    Instance.cpp:401: Ice::PluginInitializationException:
    plug-in initialization failed: IceSSL: CA certificate file not found:
    cacert.pem
  • xdm
    xdm La Coruña, Spain
    Heres the error:

    C:\Program Files\ZeroC\Ice-3.4.1\bin>glacier2router --Ice.Config=config.glacier2

    !! 12/28/10 13:44:05.324 glacier2router: error: service caught unhandled exception:
    Instance.cpp:401: Ice::PluginInitializationException:
    plug-in initialization failed: IceSSL: CA certificate file not found:
    cacert.pem

    You need to run glacier2router using the configuration files provided with Chat Demo
     > cd <Chat demo directory>\config
     > glacier2router --Ice.Config=config.glacier2router