Client/Server Instantiation Question
by sixb0nes · in Torque Game Engine · 09/03/2005 (8:58 pm) · 2 replies
Hello,
Just picked the TGE a few weeks back, and I'm having a great time with it thus far. I have a question regarding client/server object creation that is still a little foggy in my head.
I have implemented a random ParticleEmitterNode function that will, essentially, throw mortar fire on random points on the terrain within a specific area. Visual feedback only, right now. I've made various other little effects that add to the immersion of the game, such as random minor changes to the wind during gameplay, and am now at the point where I'm wondering if there is additional code required to make things work on a client/server model.
My main question is this .. when I create and/or modify properties of an object (in this case, a new ParticleEmitterNode) do I need to do something special for the clients to receive this new object or is it transparent? I know about commandToClient, etc. Will I need to loop through active connections and trigger the code for the server change on each client as well?
Thanks for any help, or links.
Just picked the TGE a few weeks back, and I'm having a great time with it thus far. I have a question regarding client/server object creation that is still a little foggy in my head.
I have implemented a random ParticleEmitterNode function that will, essentially, throw mortar fire on random points on the terrain within a specific area. Visual feedback only, right now. I've made various other little effects that add to the immersion of the game, such as random minor changes to the wind during gameplay, and am now at the point where I'm wondering if there is additional code required to make things work on a client/server model.
My main question is this .. when I create and/or modify properties of an object (in this case, a new ParticleEmitterNode) do I need to do something special for the clients to receive this new object or is it transparent? I know about commandToClient, etc. Will I need to loop through active connections and trigger the code for the server change on each client as well?
Thanks for any help, or links.
#2
I managed to get it on a 2nd PC at home for testing, and was quite shocked to see it all replicate automatically across to the client. What a lovely system!
09/06/2005 (6:25 am)
Thanks Ben.I managed to get it on a 2nd PC at home for testing, and was quite shocked to see it all replicate automatically across to the client. What a lovely system!
Associate Kyle Carter
The networking system has to be notified of changes by the objectss being networked. In some cases the objects being networked will take care of that. In other cases they won't. All you need to do is add appropriate calls to setMaskBits() in the object's code. If you look over the tutorial network objects you should get a pretty good idea of what needs to be done. If you're just creating new objects, all their properties get sent; it's only subsequent changes that may need special attention.