Command repeated/duplicated on client and server
by J. Alan Atherton · in Torque Game Engine · 06/08/2004 (2:08 pm) · 6 replies
I've noticed from other forum threads that when the client and server are the same machine (i.e., testing on my own machine) some commands are called twice... such as onAdd. Supposedly if the server is on a different machine, this is not a factor.
Now, I am working on a game that will start single-player, and I may eventually go to multiplayer also. (version 2?) I have a datablock for a StaticShape, with the className as "Collector". I defined a function like so:
Where fluid is a dynamic variable. When I shoot my collector object in-game, it adds 10 to the fluid variable, rather than 5. I'm guessing this is because of the server/client thing. What can I do about it? How can I make this work properly for single-player? Then, will that mess things up when I decide to move to multiplayer?
Now, I am working on a game that will start single-player, and I may eventually go to multiplayer also. (version 2?) I have a datablock for a StaticShape, with the className as "Collector". I defined a function like so:
function Collector::damage(%this, %obj, %delta)
{
%obj.fluid += 5;
}Where fluid is a dynamic variable. When I shoot my collector object in-game, it adds 10 to the fluid variable, rather than 5. I'm guessing this is because of the server/client thing. What can I do about it? How can I make this work properly for single-player? Then, will that mess things up when I decide to move to multiplayer?
#2
After a bit of searching, I finally found the isGhost() method in the C++ documents. Is this sort of problem only solvable through engine modification? That seems silly to me... Will I need to derive a class just to have an accumulator variable?
I found some docs on ghosts and such, but it seemed to be a little sparse. That document was the engine overview. The only other place I found mention of ghosts is in the C++ source reference under NetObject. That has quite a bit of info, which I must admit I haven't got into completely.
I just want to make sure I'm reading the stuff you're thinking of, as my time allowed to spend on this game is limited. Once I get this section of the game prototyped, I've got the hardest part out of the way...
Much thanks for your help.
06/09/2004 (3:37 pm)
Ben:After a bit of searching, I finally found the isGhost() method in the C++ documents. Is this sort of problem only solvable through engine modification? That seems silly to me... Will I need to derive a class just to have an accumulator variable?
I found some docs on ghosts and such, but it seemed to be a little sparse. That document was the engine overview. The only other place I found mention of ghosts is in the C++ source reference under NetObject. That has quite a bit of info, which I must admit I haven't got into completely.
I just want to make sure I'm reading the stuff you're thinking of, as my time allowed to spend on this game is limited. Once I get this section of the game prototyped, I've got the hardest part out of the way...
Much thanks for your help.
#3
In your increment function I would print the object id, then examine the log to see what's going on.
06/10/2004 (7:57 am)
If you're working entirely in script, then no, that stuff is probably not relevant. For some reason I assumed you were working in C++. :)In your increment function I would print the object id, then examine the log to see what's going on.
#4
Thanks for starting a chain reaction! :) I think my problems with Torque deal more with leaks in my own head than Torque's HEAD. I had totally forgotten about the trace(true); function which is so valuable to script debugging. It turns out this isn't a client/server thing, but an onCollision and radiusDamage thing. It's calling damage twice... once in onCollision, and once in radiusDamage. Funny how that works...
06/10/2004 (9:04 am)
Ben:Thanks for starting a chain reaction! :) I think my problems with Torque deal more with leaks in my own head than Torque's HEAD. I had totally forgotten about the trace(true); function which is so valuable to script debugging. It turns out this isn't a client/server thing, but an onCollision and radiusDamage thing. It's calling damage twice... once in onCollision, and once in radiusDamage. Funny how that works...
#5
Thanks for starting a chain reaction! :) I think my problems with Torque deal more with leaks in my own head than Torque's HEAD. I had totally forgotten about the trace(true); function which is so valuable to script debugging. It turns out this isn't a client/server thing, but an onCollision and radiusDamage thing. It's calling damage twice... once in onCollision, and once in radiusDamage. Funny how that works...
06/10/2004 (9:12 am)
Ben:Thanks for starting a chain reaction! :) I think my problems with Torque deal more with leaks in my own head than Torque's HEAD. I had totally forgotten about the trace(true); function which is so valuable to script debugging. It turns out this isn't a client/server thing, but an onCollision and radiusDamage thing. It's calling damage twice... once in onCollision, and once in radiusDamage. Funny how that works...
#6
06/12/2004 (8:58 am)
Glad you got it fixed!
Associate Kyle Carter