Game Development Community

I'm stuck with a RTS prototype tutorial

by Sergey Yo · in Torque Developer Network · 11/13/2009 (6:57 am) · 4 replies

When i comlete this tutorial it works nice, but only from server side, when i join to server like client, i can't control my player by mouse. I think the trouble is in this line :

%ai = ClientGroup.getObject(%index).Player;

1. When a %index is "0" i can control my player fron server side.
2. When a %index is a index of connected client, i can control the connected players by changing index, but only from server side.

And another question how i can get a client index, a didn't finf any info in manuals.

Sorry for my English :(

#1
11/13/2009 (8:08 am)
The problem is that the raycast function used to select the units only queries the serverContainer.
The result of this is that the selection method described in the tutorial will not work for multiplayer games.
It is not difficult to modify the engine to allow client-side raycasts from script, but many consider that to be a major security issue.
#2
11/13/2009 (8:24 am)
Thank's a lot, i'll try find another way to selection.
#3
11/25/2009 (5:44 am)
Problem is solved.
#4
01/07/2010 (5:28 am)
Hello I'm sort of new to to Torque3D, my problem is I'm trying to go through and do the RTS prototype tut, the very first section where it states:
--------------------------------------------------------------------
Mouse Cursor Toggling

Normally, the camera is controlled by an actor in FPS (aim) mode. To focus on just mouse and camera work, we need to change how the default camera is controlled. Open game/scripts/server/gameCore.cs. In function GameCore::preparePlayer(%game, %client), locate the following line:

%game.spawnPlayer(%client, %playerSpawnPoint);


Change this code by adding a third argument to the function call:

%game.spawnPlayer(%client, %playerSpawnPoint, false);


The function being modified is GameCore::spawnPlayer(%game, %this, %spawnPoint, %noControl), located in game/core/scripts/server/gameCore.cs. The last two arguments determine the location of spawning (%spawnPoint) and whether or not the actor object controls the camera (%noControl).


If you run the game, you will now be using a free fly camera instead of an FPS view controlled by the actor.
----------------------------------------------------------------------

This seems to not be working where as when I run the game I am not in free fly mode and it actually creates a second player in the mission and the camera is attached to it. The only difference is this player doesn't have a weapon. I posted here because you have seem to completed the RTS prototype tut and I am wondering did you run into issue..?