Jump to content
thirith

Does the server always know where all units are?

Recommended Posts

I expect this is a very newbie question, but does the server always know where all units are? I'm asking because I've read that units can be 'owned' by clients (e.g. a Headless Client) as well, and I don't know if this means that the server might not always know every single position.

 

More concretely: if I create a trigger that spawns, say, a smoke grenade when heli1 is in the trigger area and begin the trigger with an if (isServer) condition, will this work and is it the right way to ensure that I don't spawn a smoke grenade for every single client plus the server?

Share this post


Link to post
Share on other sites
9 minutes ago, thirith said:

I expect this is a very newbie question, but does the server always know where all units are? I'm asking because I've read that units can be 'owned' by clients (e.g. a Headless Client) as well, and I don't know if this means that the server might not always know every single position.

 

More concretely: if I create a trigger that spawns, say, a smoke grenade when heli1 is in the trigger area and begin the trigger with an if (isServer) condition, will this work and is it the right way to ensure that I don't spawn a smoke grenade for every single client plus the server?

 

Only if you use createVehicleLocal, it will be created only on the client it was called on.

Using createVehicleLocal you can create as example an ammo crate only on a specific players client, without the crate existing on the server or anywhere else.

 

Even if the trigger is set to isServer and using createVehicle will create the smoke grenade visible to every client.

If the trigger is set to isServer and you're using createVehicleLocal then only the server will have the smoke grenade.

 

Cheers

Share this post


Link to post
Share on other sites
11 hours ago, thirith said:

 

More concretely: if I create a trigger that spawns, say, a smoke grenade when heli1 is in the trigger area and begin the trigger with an if (isServer) condition, will this work and is it the right way to ensure that I don't spawn a smoke grenade for every single client plus the server?

 

As you mentioned headless client, HC, there is a point to remember. You can spawn objects but their name must be broadcast, if any.

For example, heli1 must be defined, as variable, on server if  you want to use it on server. If heli1 is spawned, then named on HC, you have to publicVariable its name.

 

  • Like 1

Share this post


Link to post
Share on other sites

Ah, I didn't know about that. I assume that units or objects created in the editor are named on all clients as well as the server - is that correct?

Share this post


Link to post
Share on other sites
4 hours ago, thirith said:

Ah, I didn't know about that. I assume that units or objects created in the editor are named on all clients as well as the server - is that correct?

Broadly speaking, all units created and named in the editor are known to all clients, yes.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks.

 

Somewhat tangential question: Is there an easy way to test how a mission would behave on a dedicated server setup? I do use a second PC as a dedicated server, but if there are easier ways of testing a mission I'm working on than copying it over to the second PC, launching the server, connecting and playing, that'd be much appreciated.

Share this post


Link to post
Share on other sites
1 hour ago, thirith said:

Thanks.

 

Somewhat tangential question: Is there an easy way to test how a mission would behave on a dedicated server setup? I do use a second PC as a dedicated server, but if there are easier ways of testing a mission I'm working on than copying it over to the second PC, launching the server, connecting and playing, that'd be much appreciated.

Check out TADST.

 

Cheers

Share this post


Link to post
Share on other sites

By the way, I've uploaded the current version of the mission my questions were about to the Steam Workshop:

 

http://steamcommunity.com/sharedfiles/filedetails/?id=1341443196

 

It's a simple transport helicopter training mission that allows for one or two players (pilot and co-pilot); I thought the latter might be useful if a more experienced pilot flies along with a relative newbie, to give feedback on their flying etc.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×