Game Development Community

'Cloning' server player

by Luis Anton · in Torque Game Engine · 10/15/2003 (12:42 pm) · 5 replies

Hi! Is it possible to control every client from the server player? I mean... Imagine I'm playing on the server machine, alone. Suddenly a client connects to my game... but I want him/her/it to see exactly what I'm seeing, to move where I'm moving... to be an exact clone of my 'server player'. I know that even someone playing on the sever is a 'client'. However, he would be the FIRST client. Every other client should behave exactly as that FIRST one.

I also know that connections are managed in 'server/scripts/game.cs'. GameConnection::onClientEnterGame(%this) looks like a nice place to add this 'cloning' code... , and
function GameConnection::createPlayer(%this, %spawnPoint) seems the right place to alter the controlling function ( %this.setControlObject(%player); )

I need it to be as fast as possible, so that's why I thought that I could alter the way clients are created... Am I right?

Maybe I'm totally lost :(

#1
10/15/2003 (5:08 pm)
What are you trying to do?
#2
10/16/2003 (1:32 am)
Stereography. I'm working in a certain research thar involves stereography. We need to create what each of our two eyes see (same image but translated a few centimetres to the left/right) in order to create a 3D effect. We have two polarized projectors and passive googles, and we need to create those images. A simple approach is a two computer network, one for the right eye and the second one for the left eye. The problem is there can be a maximum of 8ms lag. That will be hard to get. A different approach would be a DUAL monitor, I'm also studying it. That would be easier, I think, buy I don't master OpenGL programming yet (eventually, I'll have to!)

Well, that's why I need to control every client (in fact, just one) with the server. I want the server to render the right eye image and the client to render the left one. Last night, I managed to control the client, but I lost control of the server, and nothing was being rendered on the client, anyway... I'll search through the C++ client manager...
#3
10/16/2003 (4:20 am)
You'll have to find a way to get the client to accept network events without messing with the controls. This, like porting Torque to use OpenGL's stereo stuff, will require some tricky (but not impossible) tweaking.

Good luck! I'd look into setControlObject and go from there.
#4
10/19/2003 (2:35 am)
Hi, just a thought, why don't use a bot? The old implementation of AIPlayer uses a net connection like another human player, so what you need to add is a way to send the same move that the server player uses to the bot, in this way the bot should move in the same way as server
#5
10/19/2003 (9:09 am)
That could be a solution, Davide, but after a few tests I think it will be quite difficult to achive the 8ms that I need of maximum lag. I'm trying a different solution for my problem, but if that doesn't work I will give your idea a try :)