Game Development Community

Can't get Checkers Tutorial to work

by Tyler Lin · in Torque Game Builder · 06/07/2007 (12:27 am) · 3 replies

I can't get the networking part to work.

Canvas.pushDialog(NetworkMenu); no longer pops up a dialog. The log says "invalid control"

Is it just a function call change away from fixing it? or is it TGB 1.5 is undergo a major change from 1.13 and networking is yet to be implemented?

#1
06/07/2007 (9:59 am)
Unfortunately it looks like the networkMenu dialog got removed... Thanks for posting this, have you run into any other difficulties with the Checkers Tutorial ?

Basically the networkMenu just had three buttons, one that pushed the "startServerGui" another that pushed the "joinServerGui" and the final just called "disconnect();".
#2
06/07/2007 (10:03 am)
Here is the NetworkMenu.gui contents.... so just go to your project foler, to common/gui and create a file called "NetworkMenu.gui" and saves this inside of it:

be sure to exec it in common/gameScripts/common.cs as well, with all the other .gui files

//--- OBJECT WRITE BEGIN ---
new GuiControl(NetworkMenu) {
   canSaveDynamicFields = "0";
   Profile = "GuiDefaultProfile";
   HorizSizing = "right";
   VertSizing = "bottom";
   position = "0 0";
   Extent = "640 480";
   MinExtent = "8 2";
   canSave = "1";
   Visible = "1";
   hovertime = "1000";

   new GuiWindowCtrl() {
      canSaveDynamicFields = "0";
      Profile = "GuiWindowProfile";
      HorizSizing = "right";
      VertSizing = "bottom";
      position = "220 153";
      Extent = "218 153";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      hovertime = "1000";
      text = "Network Menu";
      maxLength = "1024";
      resizeWidth = "0";
      resizeHeight = "0";
      canMove = "1";
      canClose = "1";
      canMinimize = "0";
      canMaximize = "0";
      minSize = "50 50";
      closeCommand = "canvas.popDialog(networkMenu);";

      new GuiButtonCtrl(StartServer) {
         canSaveDynamicFields = "0";
         internalName = "StartServer";
         Profile = "GuiButtonProfile";
         HorizSizing = "relative";
         VertSizing = "relative";
         position = "43 31";
         Extent = "137 34";
         MinExtent = "8 2";
         canSave = "1";
         Visible = "1";
         Command = "canvas.pushDialog(startServerGui);";
         hovertime = "1000";
         text = "Start a Server";
         groupNum = "-1";
         buttonType = "PushButton";
      };
      new GuiButtonCtrl(JoinServer) {
         canSaveDynamicFields = "0";
         internalName = "JoinServer";
         Profile = "GuiButtonProfile";
         HorizSizing = "relative";
         VertSizing = "relative";
         position = "43 71";
         Extent = "137 31";
         MinExtent = "8 2";
         canSave = "1";
         Visible = "1";
         Command = "canvas.pushDialog(joinServerGui);";
         hovertime = "1000";
         text = "Join a Server";
         groupNum = "-1";
         buttonType = "PushButton";
      };
      new GuiButtonCtrl(disconnect) {
         canSaveDynamicFields = "0";
         internalName = "disconnect";
         Profile = "GuiButtonProfile";
         HorizSizing = "relative";
         VertSizing = "relative";
         position = "43 110";
         Extent = "137 30";
         MinExtent = "8 2";
         canSave = "1";
         Visible = "1";
         Command = "disconnect();";
         hovertime = "1000";
         text = "Disconnect";
         groupNum = "-1";
         buttonType = "PushButton";
      };
   };
};
//--- OBJECT WRITE END ---
#3
06/07/2007 (8:23 pm)
Thank You for the fast reply. The NetworkMenu did show up after the fix.

But that is not all, to get the server up, I had to insert "$Game::UsesNetwork = 1;" into common.cs
I haven't figure out the proper way in TGB1.5 to do config. So I will just leave the problem there.

Another problem I encountered was that the tile size setting is done differently from previous TGB.
In the tutorial, the tile size for the checker board is 68, which is board width/height. In TGB 1.5, tile size means single tile size. So, to get the 8x8 board, I had to convert "tile size" to 68/8 = 8.5. The problem is that "tile size" can't have decimal points.

The way I solved that was to make the world size 10 times larger (ex: 640x480 becomes 6400x4800), so I can get the extra decimal place.

Again, Thank You for the fast reply.