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 : goto "continue"
?alive _unit : goto "continue"
;blah ... blah do something with them
#continue
_i = _i + 1
?_i < count soldierList : goto "loop"
goto "init"[/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 : exit
hint "Charges set!"
[/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's going on.
Doolittle
HOME 
Reply With Quote
[/list]

