Game Development Community

Chapter 5 - LaunchGame()

by Matthew W · in Torque Game Engine · 03/13/2008 (3:05 pm) · 1 replies

In chapter 5 at the bottom of page 188, second edition, it also makes a local variable %conn and assigns it a new GameConnection(ServerConnection) object. (Well, i would include the code but im not sure if that is ok.)

What i dont understand is how does using a local variable allow the GameConnection object to be accessed by other functions. In chapter 4 it refered to this GameConnection object from another page. How is that possible? local variables scope is only defined in the set of { } that it appears in?

#1
05/24/2008 (8:43 am)
This is a new module using the inheritance of the module ServerConnection. I believe this is so you can use variables like this:

%conn.setConnectArgs("Reader"); // passes string Reader to ConnectArgs
%conn.connectLocal(); // uses inheritance to modify things within the calling module

From what I have read this seems to keep the module (client.cs) from modifying things in other modules like server.cs.