Game Development Community

How to control/make building on server

by Paulo Coutinho · in Torque Developer Network · 12/14/2009 (2:07 am) · 1 replies

Hi.

When you build a multiplayer RTS game, you need that the server control the buildings/players/units.
So, how Torque3D control it on server?

Today, im doing it:

1 - When client click to build, it send a command to server (ex):
commandToServer('buildXXXX', $Mouse::posVector);

2 - Server receive it and build (ex):

function serverCmdbuildTower(%client, %posVector)
{
%obj = new StaticShape()
{
position = %posVector;
dataBlock = "BldTower";
scale = "0.5 0.5 0.5";
};

%client.player.buildings[%client.player.buildingCount] = %obj;

MissionCleanup.add(%obj);

echo("--------NEW BUILDING---------");
echo(%client.player.buildings[%client.player.buildingCount]);
echo("-----------------------------");

%client.player.buildingCount++;
}

But on my game test, the building process is normal and the model is built on correct place, but on multiplayer game the server will create it on all connected clients?

If i build a datablock(player/building/unit) on server it automacally send all to connected clients?

#1
12/29/2009 (12:31 pm)
I would test it with a friend or make a server and connect to it. I made a RTS where players build buildings and it works great.