Separate game observer cameras
by Bisher Tarakji · in Technical Issues · 04/12/2006 (6:58 am) · 4 replies
Actually, as you will notice, I'm still a beginner using TGE.
my question has many branches. i want to program a client, which functions as an observer on the multipayer game, for the racing demo.
i have searched through many articles related to this subject, and i couldn't get that usefull info, maybe according to my knowledge level in the engine structure.
how can i improve my knowledge in camera structures and modes, and can i implement that separate observer and deal with it not as a player?
thanks in advance
my question has many branches. i want to program a client, which functions as an observer on the multipayer game, for the racing demo.
i have searched through many articles related to this subject, and i couldn't get that usefull info, maybe according to my knowledge level in the engine structure.
how can i improve my knowledge in camera structures and modes, and can i implement that separate observer and deal with it not as a player?
thanks in advance
#2
05/05/2006 (12:57 am)
This may take some time but look in the sorce code for the call that attaches a camera to a player, use that to a model of your player and set players flags to invisable, and call the function that allows player to have free camera movement. I cant give you the code in C++, I did come across this once in C script accidently while trying to make isometric type camera for another 3D game engine.. I know its fustrating even more so when info given out is not clear, but take the time to explore the code and try dif things with it, and reassemble it certain ways. This can give you an understanding of how it works, worked for me in C script. Make sure You back up Your info lol... While You do this maybe someone will post a helpfull reply with an answear, and if not at least your making an attempt to get the answear on your own and learn while doing so.
#3
05/05/2006 (1:15 am)
Clients are put into the game as an observer by default. If you step through the code, they are only given a camera initially, before more code adds a player and assigns it as their control object. Of course this only lets you fly around, but I think using the Advanced Camera may let you use other types of camera views as only an observer... someone who's used it would know better though.
#4
1) Check this folder: C:\Torque\SDK\example\GameOne.base\client
2) Open up: fefault.bind file
3) Look at this code below:
//------------------------------------------------------------------------------
// Camera & View functions
function toggleFreeLook( %val )
{
if ( %val )
$mvFreeLook = true;
else
$mvFreeLook = false;
}
$firstPerson = true;
function toggleFirstPerson(%val)
{
if (%val)
{
$firstPerson = !$firstPerson;
ServerConnection.setFirstPerson($firstPerson);
}
}
function toggleCamera(%val)
{
if (%val)
commandToServer('ToggleCamera');
}
moveMap.bind( keyboard, z, toggleFreeLook );
moveMap.bind(keyboard, tab, toggleFirstPerson );
moveMap.bind(keyboard, "alt c", toggleCamera);
05/05/2006 (9:51 am)
While searching for an answear to one of my problems I stumbled across this info.. When I seen this I thought of you- so i hope this helps....Might work if you assign the function toggle-FreeLook to your player.cs.. Im not sure ive had the engine for 2 days now but worth taking a look into... 1) Check this folder: C:\Torque\SDK\example\GameOne.base\client
2) Open up: fefault.bind file
3) Look at this code below:
//------------------------------------------------------------------------------
// Camera & View functions
function toggleFreeLook( %val )
{
if ( %val )
$mvFreeLook = true;
else
$mvFreeLook = false;
}
$firstPerson = true;
function toggleFirstPerson(%val)
{
if (%val)
{
$firstPerson = !$firstPerson;
ServerConnection.setFirstPerson($firstPerson);
}
}
function toggleCamera(%val)
{
if (%val)
commandToServer('ToggleCamera');
}
moveMap.bind( keyboard, z, toggleFreeLook );
moveMap.bind(keyboard, tab, toggleFirstPerson );
moveMap.bind(keyboard, "alt c", toggleCamera);
Torque Owner Joey Skinner
I have not done this yet but will need to eventually. I was planning on having the observer still be a "player" object but restrict its ability to do things. You may still want it to do some things like navigate around in the world. But you may not want to let it do game-behavior-like things such as interacting with other players.
If you want your camera to be navigatable, then my recommendation is, and I'm fairly new to TGE, to not try to tackle making a non-player camera entity but instead use the basics which TGE comes with, which is first person player camera and just restrict your observer-player to being a person in the crowd watching.