Jump to content
Sign in to follow this  
mad rabbit

knowing when to 'local' is necessary?

Recommended Posts

I was wondering when is it necessary to have certain things only happening locally on the server and when is it necessary that every client has these things running.

I have a very vague idea of what happens during MP OFP games but I would really like a better explaination or to be directed to a link that gives a good explaination.

In particular I am making a CTI map and I have some trouble sometimes knowing when to make the script run locally or not.

For example:

-----------------

I createVeh a scud (scriptA - local to server only) which is then entered into another looping script (scriptB - global script) which checks for the scuds phase. When the scud reaches a certain phase (i.e. >3) then a wait-time is started and upon completion a scud missle (still scriptB - global script) is created in mid air above the target with end of the scriptB starting scriptC which makes the nuke explosions (scriptC in an addon).

----------------

I remember reading that if you createVeh something that it should only be done on the server (i.e. local localServerObject) otherwise it will create multiple copies of that vehicle depending upon the number of players as each client runs the script. Is this right?

So if someone wouldn't mind explaining this whole 'local' concept thing to me and how it fits into OFP MP that would be most appreciated, as it would benefit me and the rest of the community as well I think.

Thanks in advance

Share this post


Link to post
Share on other sites
I remember reading that if you createVeh something that it should only be done on the server (i.e. local localServerObject) otherwise it will create multiple copies of that vehicle depending upon the number of players as each client runs the script. Is this right?

Yep it's true, createVehicle is global.

If a command is executed everywhere you may want to run it on a single machine not to duplicate the call (like createUnit). That is the basis of the local check. Other commands must be ran on a node where any object is local, so you do a different local check (command like move msut be ran local to the unit).

If a command is local then you may want to duplicate it on every machine, like say or sidechat

Share this post


Link to post
Share on other sites

Hmmm....

Just found these:

gamelogics and local effects

createVehicle in MP

LI've provided these to show that I have researched this tpoic somewhat and for others to have a look at, but I would still like a better explaination.

For example:

-------------

If I run a script (server only) that hints a msg, does that message appear on every client. In particular I'm using this in the CTI to hint error messages or max vehicle message but if every client is getting this then this would be a bad thing as the enemy would know when the other side has reached max vehicles in this example. Is this right?

-------------

I found this thread at OFPEC to be particularly helpful:

Scripts in MP

Terox mentions in this thread that you should never trust the client to store important data, and that you should get the client to send it to the server.

Why is this?

How do you do this?

I can understand in some instances why you would want a script run only on the server for example for creating vehicles, but why would you want a script to run only on the player/client and not ther server.

Doesn't go against the "don't trust clients to store data" thing?

Wouldn't it just be easier then to not have any ?!(local server) or ?!(local player) things and just let the script run as is?

Again further explaination would be grateful.

Share this post


Link to post
Share on other sites

DAMN THAT WAS QUICK bn880!

Keep the great info coming please, I think this is important topic for problem solving and lag reduction, yes?

@bn880

So in regards to the createVehicle issue:

I should create the vehicle and units (driver etc) local only to the server but with the moveIn command, can that be executed within the same script, or do I have to initiate another script which is local to the both client and server to ensure that the player sees the units move into the vehicle.

A resource showing which particular 'commands' should be local to the server and which should not would be helpful I think, or does this just depend upon the application of the command?

Share this post


Link to post
Share on other sites
@bn880

So in regards to the createVehicle issue:

I should create the vehicle and units (driver etc) local only to the server but with the moveIn command, can that be executed within the same script, or do I have to initiate another script which is local to the both client and server to ensure that the player sees the units move into the vehicle.

You can do the movin commands on the server as well, same script. Movein, if it occurs is global.

Quote[/b] ]

A resource showing which particular 'commands' should be local to the server and which should not would be helpful I think, or does this just depend upon the application of the command?

It would be useful, I rmember some talk about such a resource but I am not sure if it's been assembled. I would think locality should be mentioned in the official command reference.

Share this post


Link to post
Share on other sites

EDIT: Yes bn880 I fully agree. This problem was raised in the thread below.

Doolittle's Original Post

Oops, it seems I'm not the first to try and grapple with this problem/concept.  The above is a realy good thread started by doolittle, describing the problem I have with the MP server and client concept but in a different application.  Good read though.

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
Sign in to follow this  

×