Jump to content
Sign in to follow this  
kiwi1234

client side vs server side scripts, help needed please!

Recommended Posts

Hi there

Can someone please explain the role that client side vs server side plays? Ive been making single player missions for a while now and am moving to mp ones, but im not sure which scripts should be server side?

What does server side do as opposed to running a script as i would in a sp mission? And how do i ensure the script is only run server side if need be?

usually my triggers are used to set a convoy to move, or set an enemy squad to move to the next waypoint when a group member is detected - do these need to be server side?

thanks heaps!

Recon - AAF.

Share this post


Link to post
Share on other sites

A great number of Arma commands are global - invoke them and the effect happens on all machines running that mission ( e.g. damage a vehicle ). But some only affect only the machine the command runs on, so you need to both be aware of that and chose the correct location to run them.

Graphical and sound effects are common examples of this. The reasons include the differing player viewpoints, hardware differences, and network load - so let each handle the problem separately while avoiding the need for huge amounts of bandwidth to send a video stream. So you run those per client, avoiding a dedicated server since there is no one to watch the effects anyway. For a damage routine, you should run that in just one place or it will cause N-times the damage due to it's global effect ( N being number of machines running the mission ). So that runs server only.

You ensure that a script runs one side or the other by using simple test statements like isDedicated, isServer, etc. as wrapper code around the appropriate scripts or sections of scripts. Not hard at all, it's just learning where to use them that is the challenge to a newcomer. For that - check the descriptions on the BI wiki, ask around, and especially test and retest your mission. Odd behavior, either too much or too little is a sure sign the feature needs some TLC.

Edited by Evil_Echo

Share this post


Link to post
Share on other sites

http://community.bistudio.com/wiki/Locality_in_Multiplayer

This is good for basic guidelines.

Also you have to determine and consider if it is hosted MP or dedicated MP as there is a player on the server in hosted MP and that makes a difference.

Triggers should be on all machines so it will play on every machine in the game and the server. This should be fine if you are just using the trigger to switch to a new waypoint but is not fine if you want to run a script on just one client or just the server.

Ai is on the server unless its in your group or you are their driver. Basically all ai scripts will be running on the server. If you want to controll the ai with scripts in MP you need to make sure you send a message from the client to the server somehow. In my missions I had to make a server script that listens to variables and runs scripts based on those changed variables. On the client I have actions that update the variables and use publicvar command to "send" that change to the server so it works in MP. I also had to send strings across the network to have the serve run the string as code to solve a problem. That is how I generally deal with locality.

There are functions and resources out there that give expanded abilities with client to server work. You used to only be able to send numbers and strings over MP but BIS has updated that to send arrays and do other things....

BIS Multiplayer Framework:

http://community.bistudio.com/wiki/Multiplayer_framework

I actually have to read up on this myself.....

You basically have to test your mission out in dedicated server mode to be sure you have no issues. It really depends on what you want to do. Then if you run into problems you can post here with specific details about it. Then use the guidelines of locality and research the problem to get a good solution.

Share this post


Link to post
Share on other sites

Hi all

thanks very much for the help. Its starting to make a little more sense. :-)

Can I run the following specifics by you?

I have this in the oc act of a trigger set to activate when a teammember is present: (trig is to start a convoy moving on their assigned route)

if (isServer) then { [["pos1","pos2","pos3","pos4"],[c1,c2,c3,c4,c5,c6],false] execVM "convoyDefend\convoyDefend_init.sqf"; };

So am I correct in assuming this should be server side, and if so is the syntax correct? (this works fine in the editor)

Also I have several enemy ai groups set to move to their next waypoints by blufor present triggers - do i need to do something with these to make them server side? no scripts are involved here,.,.

thanks!

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  

×