Page 1 of 2 12 LastLast
Results 1 to 10 of 17

  Click here to go to the first Developer post in this thread.  

Thread: Server and client

  1. #1
    I think I am starting to finally understand multiplayer map making...but only when I started thinking of it this way: ***there are scripting commands which will never work/run on a dedicated server, and that can only be run by clients. ***For example, the moveInDriver is something I thought the server could do, but it doesn't work!! ***Only the client that this object is local to can execute moveInDriver on that object, namely the player. ***Another thing I noticed is you cannot addWeapon to something unless it is local to you.

    So, I have been doing this to make everything work well....and I can only show this in examples. ***For example, I keep an array of the soldiers on the battlefield. ***After a certain amount of time, I will respawn them from being dead. ***Soldiers that are local to players (such as the soldiers in their squad) are "run" by them, while the server handles everyone else.
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">#init
    _i = 0
    #loop
    _unit = soldierList select _i
    ?not local _unit &#58; goto &#34;continue&#34;

    ?alive _unit &#58; goto &#34;continue&#34;

    ;blah ... blah do something with them

    #continue
    _i = _i + 1
    ?_i &#60; count soldierList &#58; goto &#34;loop&#34;
    goto &#34;init&#34;[/QUOTE]<span id='postcolor'>

    So if I think that anything dealing with markers can only be done by human players, then I realize that once the game starts, moving markers around will mean they are at different locations now for each client. ***The same with the hint command. ***Each client must run this command if they are to see any hint.

    So if you have a GameLogic called Server and are doing:
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?not local Server &#58; exit
    hint &#34;Charges set&#33;&#34;
    [/QUOTE]<span id='postcolor'>Then this will never be seen by anyone because the "server" never runs any "client command".

    A list of "client-only commands":

    - addAnything (addAction, addEvent, addMagazine, addScore, ...) (I had the server addMagazineCargo to ammo crates & none of the clients could see the weapons there until I had everyone running addMagazineCargo)
    - Anything dealing with cameras (camCreate)
    - Anything dealing with dialogs (createDialog)
    - enableRadio (I originally thought this meant NOONE could use the radio.....nope..just the client that runs the command)
    - hint
    - moveInAnything
    - onMapSingleClick (the command will ALWAYS be run by the client)
    - setFog, setOvercast, setRain, skipTime (one person could be playing a map at night while the other players are playing in the day)
    - Anything to do with talking (vehicleChat, globalChat, groupChat, sideChat)

    Commands that work for every client when just the server runs it, (because they are changing objects within the game):
    - createUnit
    - createVehicle (if this was run by each client, there would be that many copies of the vehicle)
    - deleteVehicle

    Neither of these lists are anywhere near complete, but hopefully will give you some idea of what&#39;s going on.

    Doolittle

    Ranger School - Make your own mission in game! Full MP support (Old ver)
    DooACS - Arma2 anti-cheat to protect your server, feared by cheaters

  2. #2
    Hi Doolittle

    Perhaps BIS will do us a full list of the sever and client commands split into the two catogories (plus those that run of both dependent on circumstances)

    Kind Regards walker

    You are only a bullet away from being stupid.

  3. #3

    Red face

    I have noticed that setdammage command seems to be client command too. Don&#39;t know but i have problems with it. I can only see setdammage in mp game when i host. For example when i set killed man&#39;s dammage back to 0 i can se him in full health and full working BUT other player see just body sliding on the ground &#33; The full list would be nice ***. Oh and what is the solution... can&#39;t you use these commands in mp scripting




  4. #4
    Yes, you can use them, you just need to be clever about it. ***Like the above example, to solve that you could do:

    server.sqs
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?not local Server &#58; exit
    showHint = 1
    publicVariable &#34;showHint&#34;
    [/QUOTE]<span id='postcolor'>
    client.sqs
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">@showHint == 1
    hint &#34;Charges set&#33;&#34;[/QUOTE]<span id='postcolor'>
    So if every client is running client.sqs, they&#39;re all just waiting for the server to send the flag that it&#39;s time to print that particular message. ***It&#39;s the server that decides if Joey is close enough to the bomb and to let everyone else know....this is, of course, a very basic example.

    init.sqs
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">
    &#91;&#93; exec &#34;server.sqs&#34;
    &#91;&#93; exec &#34;client.sqs&#34;
    [/QUOTE]<span id='postcolor'>
    The server could be running a copy of the client.sqs command too...it just won&#39;t run the "hint" command if it is a dedicated server, because this is a client/player-only command.

    There is also the special case where you are testing out your map or being a server and NOT being dedicated. ***So that means your computer is both server and client....so you want to always allow even the "server" to execute client stuff. ***Like, the following would ONLY work if you were just testing out your own mission (I wasn&#39;t totaly correct with what I said before):
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">
    ?not local Server &#58; exit
    hint &#34;Charges set&#33;&#34;
    [/QUOTE]<span id='postcolor'>
    In this case you WOULD see "Charges set&#33;" on your screen because, even though you are a client, you are ALSO the server and the GameLogic Server is local to you. ***This is why it&#39;s such a pain to test MP missions....you think you have everything working great, but then try it out on a dedicated server and nothing works...well that was because you were doing stuff between client and server that worked only when both were local.

    Doolittle

  5. #5
    BratZ
    Guest
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Hekezu @ April 17 2003,05:45)</td></tr><tr><td id="QUOTE">I have noticed that setdammage command seems to be client command too. Don&#39;t know but i have problems with it. I can only see setdammage in mp game when i host. For example when i set killed man&#39;s dammage back to 0 i can se him in full health and full working BUT other player see just body sliding on the ground &#33; The full list would be nice ***. Oh and what is the solution... can&#39;t you use these commands in mp scripting [/QUOTE]<span id='postcolor'>
    Back when I made RTS scripts,I had to revive the dead soldier instantly otherwise it like lost its spot and was unrecoverable

    In the same sense vehicles are opposite,you want them to explode first and burn out ,then revive

  6. #6
    I just tested and found that units command does NOT work on a server, only clients.

    Doolittle

  7. #7
    Hi all

    As I said the solution is for BIS to do a list of commands that work on server.

    The comref is the correct place for all this I would suggest:
    1 Under Operand types:
    Server or Client or (Server and Client)
    2 Each of the them hyper linked to a sub section in scripting describing the requirements and options.

    Kind Regards Walker

  8. #8
    One has to be careful with the wording when discussing these client/server issues.

    Besides the client-server distinction, there is also the local-not local dilemma.

    An example: Commands that affect units should be run where that unit is local, be it on a client machine or on a server.

    To list some of the commands that have been mentioned as "client only" that should actually be done "locally", i.e where that unit is local:<ul>[*] setDammage, getDammage, setFuel, setSkill...[*] addWeapon, addMagazine and so on [*] setUnitPos, getPos[*] animate[*] action (ever had a paradrop fail in MP even though some script does action ["EJECT",plane] ) [/list]
    addMagazineCargo seems to be different from addMagazine, right? (The ammo crate example above has me wondering...)

    addEventHandler can/should be run on all machines that should respond to a certain event. One can imagine having only the machine where a unit is local run a certain event handler. Then again, since some events are broadcast, it may make sense to have all machines add an event handler to a unit, even though it might not be local. What I&#39;m saying here is that the statement "addEventHandler must be run on a client" is not neccesarily true. Take the "killed" event, for example. As of 1.92 this event is not broadcast, so having a "killed EH" attached to a non-local unit would be pointless.

    moveInDriver: Interesting...since that command has two object parameters, I wonder which one of them controls where to run it. From Doolittles experiences it seems that the driver, not the vehicle, decides where to "run it locally".

    Another riddle is the setViewDistance command. This seems like a "client only" thing to do. However, the view distance also has an effect on the AI:s ability to see you. Therefore, my guess is that one would have to run setViewDistance even on a dedicated server. Imagine a open desert battle with client viewdists of 2000 m. Lets say this "setViewDistance 2000" was run on clients only. That has the server running with a view distance of 900 m internally. This would have any AI enemys somewhat "short-sighted".



    In essence: I don&#39;t think one can do a list of commands and categorize them as client and/or server side. The locality aspect has to be reflected too.



    The confidence of ignorance will always overcome indecision of knowledge.

  9.   This is the last Developer post in this thread.   #9
    Quote Originally Posted by (Killswitch @ Sep. 15 2003,09:14)
    In essence: I don&#39;t think one can do a list of commands and categorize them as client and/or server side. The locality aspect has to be reflected too.
    Yes of course, the scope of the commands should also be noted. If you ask me, this should already be in the command reference.
    "Peace can not be kept by force. It can only be achieved by understanding." Albert Einstein

    Please report Arma 3 bugs in the Bug Tracker

  10. #10
    Quote Originally Posted by (Killswitch @ Sep. 15 2003,15:14)
    moveInDriver: Interesting...since that command has two object parameters, I wonder which one of them controls where to run it. From Doolittles experiences it seems that the driver, not the vehicle, decides where to "run it locally".
    Which makes sense as the vehicle is always local to the driver. That&#39;s why you can&#39;t get out of a truck if the driver&#39;s lagged out, and why a vehicle always flys smoothly for the pilot but may very well be warping for the passengers and everyone else.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •