Game Development Community

Really Really basic lient server

by Wolfgang Kurz · in Torque Game Engine · 11/21/2006 (11:41 am) · 0 replies

Hello all,

i have a really basic client and server.

all it does is load a mission and drop a player in it. thats it

i had this on a local connection so client and server in one app

what i tried to do is have them in diffrent applications on the same computer but somehow i dont think i got it right:-)

Server setup:
function CreateServer(%serverType, %mission)
{
   if (%mission $= "") {
      Error("CreateServer: mission name unspecified");
      return;
   }

   destroyServer();

   //
   $missionSequence = 0;
   $Server::PlayerCount = 0;
   $Server::ServerType = %serverType;

   // Setup for multi-player, the network must have been
   // initialized before now.
   if (%serverType $= "Dedicated") {
      Echo("Starting multiplayer mode");

      // Make sure the network port is set to the correct pref.
      portInit($Pref::Server::Port);
      allowConnections(true);

      if ($pref::Net::DisplayOnMaster !$= "Never" )
         schedule(0,0,startHeartbeat);
   }

   // Load the mission
   $ServerGroup = new SimGroup(ServerGroup);
   onServerCreated();
   loadMission(%mission, true);
}

and on the client side i do this:

InitBaseClient(); // basic client features defined in the common modules
  
  // these are necessary graphics settings
  $pref::Video::allowOpenGL   = true;
  $pref::Video::displayDevice = "OpenGL";

   // Make sure a canvas has been built before any gui scripts are
   // executed because many of the controls depend on the canvas to
   // already exist when they are loaded.

   InitCanvas("Egama4 - 3DGPAi1 Sample Game"); // Start the graphics system.

   Exec("./client.cs");

   %conn = new GameConnection(ServerConnection);
   %conn.SetConnectArgs($pref::Player::Name);
   %conn.SetJoinPassword("");
   %conn.Connect("127.0.0.1:28000");

can anyone please point me to what i am doing wrong?