When is initialControlSet called?
by Daniel Buckmaster · in Torque 3D Professional · 05/06/2013 (12:05 am) · 10 replies
I'm working on creating the barest of barebone T3D projects, and I'm getting close, but I'm stuck on this one function call. The initialControlSet function seems to handle actually pushing the PlayGui to the Canvas which lets the client see the game. But it's not called from anywhere! I can see it seems to be called from the engine code, but I'm not sure under what conditions this is accomplished.
I have this function in game.cs:
And it seems to create a camera fine, but initialControlSet is not being called.
function GameConnection::initialControlSet(%this)
{
echo ("*** Initial Control Object");
// The first control object has been set by the server
// and we are now ready to go.
if (Canvas.getContent() != PlayGui.getId())
{
Canvas.setContent(PlayGui);
ControlsHelpDlg.toggle();
}
}I have this function in game.cs:
function GameConnection::onClientEnterGame(%client) {
%c = spawnObject(Camera, Observer);
%client.setControlObject(%c);
}And it seems to create a camera fine, but initialControlSet is not being called.
About the author
Studying mechatronic engineering and computer science at the University of Sydney. Game development is probably my most time-consuming hobby!
#2
05/06/2013 (3:36 am)
Yes, but for some reason that's not getting called. Sorry, it was a weird question. I've discovered that the ghost index of my camera is -1, so it's never getting sent down the connection. Hrm.
#3
Imo it would be a great addition to MIT3D 3
05/06/2013 (3:39 am)
Are you going to share the barebones template when you are done with it?Imo it would be a great addition to MIT3D 3
#4
05/06/2013 (3:55 am)
For sure! I've just started on it today; it'll probably be on Github soon, if I can get it to work! Basically I've gotten as far as stripping out every single piece of art :P. But there's still the amazingly messy client/server setup to deal with; once I nail this I think it should be smooth(er) sailing.
#5
Tried to do a barebones template myself but failed along the way because it was too confusing for me lol!
The best of luck!
Oh yeah, if you have a look at:
core/scripts/server/spawn.cs
Line 181:
You have to scope it manually because the other clients have no interest in the camera, make sure you are doing that! ;)
05/06/2013 (4:00 am)
Awesome! I've always been frustrated of all the things going on behind the curtains in the T3D templates that I didn't know about and had no easy way to figure out exactly how it worked.Tried to do a barebones template myself but failed along the way because it was too confusing for me lol!
The best of luck!
Oh yeah, if you have a look at:
core/scripts/server/spawn.cs
Line 181:
function GameConnection::spawnCamera(%this, %spawnPoint)
{
// Set the control object to the default camera
if (!isObject(%this.camera))
{
if (isDefined("$Game::DefaultCameraClass"))
%this.camera = spawnObject($Game::DefaultCameraClass, $Game::DefaultCameraDataBlock);
}
// If we have a camera then set up some properties
if (isObject(%this.camera))
{
MissionCleanup.add( %this.camera );
%this.camera.scopeToClient(%this); //<- NOTICE THIS
%this.setControlObject(%this.camera);
if (isDefined("%spawnPoint"))
{
// Attempt to treat %spawnPoint as an object
if (getWordCount(%spawnPoint) == 1 && isObject(%spawnPoint))
{
%this.camera.setTransform(%spawnPoint.getTransform());
}
else
{
// Treat %spawnPoint as an AxisAngle transform
%this.camera.setTransform(%spawnPoint);
}
}
}
}You have to scope it manually because the other clients have no interest in the camera, make sure you are doing that! ;)
#6
Okay, now to strip away everything.
EDIT: Currently at 1.6MB plus the executable and DLL. Awesome. Thanks again for the tip Lukas!
05/06/2013 (4:11 am)
Oh wow, that's excellent. Good catch! That's done it! Huzzar! Champagne, everybody!Okay, now to strip away everything.
EDIT: Currently at 1.6MB plus the executable and DLL. Awesome. Thanks again for the tip Lukas!
#7
Just happy to help!
And 1.6MB sounds outstanding! Great work!
05/06/2013 (5:56 am)
No, thank you for your work on a barebones template!Just happy to help!
And 1.6MB sounds outstanding! Great work!
#8
What parts of those server folders do I need to ship with the client? It seems they aren't as separate from the client as I had hoped. Thanks
05/26/2014 (2:01 pm)
I'm using Torque 3D and I removed both core/scripts/server and scripts/server folders from my client but now the client hangs because initialControlSet() isn't being called. What parts of those server folders do I need to ship with the client? It seems they aren't as separate from the client as I had hoped. Thanks
#9
github.com/eightyeight/t3d-bones
You should be able to track it down from there.
05/26/2014 (3:49 pm)
Dan completed his work on creating a minimal template here:github.com/eightyeight/t3d-bones
You should be able to track it down from there.
#10
05/26/2014 (9:48 pm)
t3d-bones is only for single-player (unless dB updated it)
Torque Owner Lukas Joergensen
WinterLeaf Entertainment
GameConnection::readPacket
//... Some code // let move list know that control object is dirty mMoveList->markControlDirty(); if(callScript) { initialControlSet_callback(); } if(controlObjChange) { onControlObjectChange_callback(); } } else { // read out the compression point Point3F pos; bstream->read(&pos.x); bstream->read(&pos.y); bstream->read(&pos.z); bstream->setCompressionPoint(pos); } //Some code...Edit: It's:
Engine/source/T3D/gameBase/gameConnection.cpp
Line 1047