Game Development Community

ClientGroup help

by Michael Rogers · in Torque Game Engine · 07/19/2005 (2:12 pm) · 4 replies

Can someone please help me out with ClientGroups?

First, have I got it right that they are groups of GameCollections, on the server?

Secondly, where and when do the GameCollections get added to the ClientGroup? I've been debugging a game from the 3DAIO book, and when I click on Start Game, and end up in common/server/missionLoad.cs, ClientGroup.getCount() is always 0.

Thanks for any help,

Michael

#1
07/19/2005 (4:57 pm)
GameConnections, not Collections.

Have you tried grepping the source code for ClientGroup? (Or the C++ code for its C++ equivalent, if it is a C++ created group?)
#2
07/20/2005 (8:41 am)
Hi, Ben:

Here's where I had looked, and what I had found, in my search:

0. In Finney's book, there's nothing in the index under ClientGroup, although it does show up in the code in several locations.

1. In the TGE docs, there is a single reference to ClientGroup (p. 169):

DeclaredNameGroup(ClientGroup)

This wasn't particularly helpful to me, since I didn't yet know what a DeclaredNameGroup is.

2. grep -R ClientGroup * in /trq_tutorial_base/and example/CH6 produced numerous instances where ClientGroup is referenced, but I didn't see anything like new ClientGroup()

3. grep -R ClientGroup * in the TorqueGameEngineSDK/engine mashes all the lines together for some reason.

4. Using Spotlight (now I'm *really* getting desperate) produced hits in simBase, simManager and netObject, but again nothing that I could make sense of.

So, I'm still stuck: any additional assistance would be most welcome.

Michael
#3
07/20/2005 (9:20 am)
Opening up GameConnection.cc and searching for "ClientGroup"... the first result is the one your looking for... in this function :)

void GameConnection::onConnectionEstablished(bool isInitiator)
{
   if(isInitiator)
   {
      setGhostFrom(false);
      setGhostTo(true);
      setSendingEvents(true);
      setTranslatesStrings(true);
      setIsServerConnection();
      mServerConnection = this;
      Con::printf("Connection established %d", getId());
      Con::executef(this, 1, "onConnectionAccepted");
   }
   else
   {
      setGhostFrom(true);
      setGhostTo(false);
      setSendingEvents(true);
      setTranslatesStrings(true);
      Sim::getClientGroup()->addObject(this);

      const char *argv[MaxConnectArgs + 2];
      argv[0] = "onConnect";
      for(U32 i = 0; i < mConnectArgc; i++)
         argv[i + 2] = mConnectArgv[i];
      Con::execute(this, mConnectArgc + 2, argv);
   }
}
#4
07/20/2005 (10:30 am)
Thank you! I'm not sure if I would have understood the significance of that line even if grep or spotlight had found it, and neither did.

Michael