Lou Montana/Sandbox – User
Jump to navigation
Jump to search
Lou Montana (talk | contribs) (Add the rest of animations) |
Lou Montana (talk | contribs) (Multiplayer Scripting stub) |
||
Line 1: | Line 1: | ||
{{Informative|Future [[Multiplayer Scripting]] page}} | |||
{{SideTOC}} | |||
{{Stub}} | |||
== | == The basics == | ||
* In Multiplayer, players are connected to a server that distributes information among them. | |||
* The server can be either a dedicated machine, or hosted by a player; in the latter it means the server can have a [[player]] unit. | |||
* Players can join a game ''after'' it started: they are considered "[[Join In Progress|JIP]]" and scripting should be adapted to them. | |||
{{Informative|In Singleplayer, the game acts as a player-hosted server ({{Inline code|[[isServer]]}} returns {{Inline code|[[true]]}}).}} | |||
{{Warning|Some commands will '''not''' work in Singleplayer, such as {{Inline code|[[netId]]}}!}} | |||
== | |||
== Locality == | |||
* '''LOCAL''' is an attribute for the machine where the command/script/function is executed. | |||
* '''REMOTE''' is an attribute for all the other machines. All clients are remote to a server, for example. | |||
* [[:Category:Scripting_Commands|commands]] arguments and effects can be either '''local''' or '''global''': | |||
** a '''local''' argument means an argument that is processed on the machine where the command is executed | |||
** a '''global''' argument means any unit, even a remote one | |||
** a '''local''' effect means that the effect will only happen on the machine where the command is executed | |||
** a '''global''' effect means that all the computers will receive it | |||
See [[Locality in Multiplayer]] for more information. | |||
=== Different machines === | |||
* Dedicated Server ({{Inline code|[[isDedicated]]}}) | |||
* Player Server ({{Inline code|[[hasInterface]] && [[isServer]]}}) | |||
* Client ({{Inline code|[[hasInterface]] && not [[isServer]]}}) | |||
* [[Join In Progress|JIP]] Client ({{Inline code|[[didJIP]]}}) | |||
* [[Arma 3 Headless Client|Headless Client]] ({{Inline code|not [[hasInterface]] && not [[isDedicated]]}}) | |||
{{Informative|If you want to target every machine that has a player (Player Server included), use {{Inline code|[[hasInterface]]}}.}} | |||
== PublicVariable commands == | |||
PublicVariable commands allow to send '''global''' variables to specified machines. | |||
* Network reception is guaranteed | |||
* Short variable names should be used for network performance | |||
* These commands shouldn't be used intensely for the same reason | |||
{| | |||
!Command | |||
!Effect | |||
|- | |||
|[[publicVariable]] | |||
|Set/update a variable value from the local machine to all the other machines (including server) | |||
|- | |||
|[[publicVariableServer]] | |||
|Set/update a variable value '''from a client to the server''' | |||
|- | |||
|[[publicVariableClient]] | |||
|Set/update a variable value '''from the local machine''' (not necessarily the server) '''to a specific client''' | |||
|} | |||
=== How it works === | |||
The server has the variable {{Inline code|ABC_Score}} to send to everyone, it then uses {{Inline code|[[publicVariable]] "ABC_Score"}} (do not forget the quotes!)<br /> | |||
This sends the variable name and value to the clients. | |||
* If the variable is not yet declared on their machine, it will declare it as well. | |||
* If the variable already exists, '''the value is overridden''' by the server's value. | |||
== Network commands == | |||
* [[local]] | |||
* [[netId]] | |||
* [[owner]], [[groupOwner]] | |||
* [[remoteExec]] | |||
* [[remoteExecCall]] | |||
== See also == | |||
* [[Arma 3 Headless Client|Headless Client]] | |||
* [[Locality in Multiplayer]] | |||
* [[:Category:Commands_requiring_server_side_execution|Server-only commands]] | |||
[[Category:Sandbox]] | [[Category:Sandbox]] |
Revision as of 00:57, 27 January 2019
Template:SideTOC Template:Stub
The basics
- In Multiplayer, players are connected to a server that distributes information among them.
- The server can be either a dedicated machine, or hosted by a player; in the latter it means the server can have a player unit.
- Players can join a game after it started: they are considered "JIP" and scripting should be adapted to them.
Locality
- LOCAL is an attribute for the machine where the command/script/function is executed.
- REMOTE is an attribute for all the other machines. All clients are remote to a server, for example.
- commands arguments and effects can be either local or global:
- a local argument means an argument that is processed on the machine where the command is executed
- a global argument means any unit, even a remote one
- a local effect means that the effect will only happen on the machine where the command is executed
- a global effect means that all the computers will receive it
See Locality in Multiplayer for more information.
Different machines
- Dedicated Server (
isDedicated
) - Player Server (
hasInterface && isServer
) - Client (
hasInterface && not isServer
) - JIP Client (
didJIP
) - Headless Client (
not hasInterface && not isDedicated
)
PublicVariable commands
PublicVariable commands allow to send global variables to specified machines.
- Network reception is guaranteed
- Short variable names should be used for network performance
- These commands shouldn't be used intensely for the same reason
Command | Effect |
---|---|
publicVariable | Set/update a variable value from the local machine to all the other machines (including server) |
publicVariableServer | Set/update a variable value from a client to the server |
publicVariableClient | Set/update a variable value from the local machine (not necessarily the server) to a specific client |
How it works
The server has the variable ABC_Score
to send to everyone, it then uses publicVariable "ABC_Score"
(do not forget the quotes!)
This sends the variable name and value to the clients.
- If the variable is not yet declared on their machine, it will declare it as well.
- If the variable already exists, the value is overridden by the server's value.
Network commands