Initialisation Order: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "{{Checkbox|no}}" to "{{Icon|unchecked}}")
m (Text replacement - "{{Checkbox|yes}}" to "{{Icon|checked}}")
Line 38: Line 38:
| Functions with ''recompile'' attribute are recompiled
| Functions with ''recompile'' attribute are recompiled
| All
| All
| {{Checkbox|yes}}
| {{Icon|checked}}
| [[Arma 3 Functions Library]]
| [[Arma 3 Functions Library]]
|
|
Line 45: Line 45:
| Functions with ''preInit'' attribute are called
| Functions with ''preInit'' attribute are called
| All
| All
| {{Checkbox|yes}}
| {{Icon|checked}}
| [[Arma 3 Functions Library]]
| [[Arma 3 Functions Library]]
| [[Scheduler#Unscheduled Environment|Unscheduled]]
| [[Scheduler#Unscheduled Environment|Unscheduled]]
Line 66: Line 66:
| Object initialisation fields are called
| Object initialisation fields are called
| All
| All
| {{Checkbox|yes}}
| {{Icon|checked}}
|
|
| [[Scheduler#Unscheduled Environment|Unscheduled]]
| [[Scheduler#Unscheduled Environment|Unscheduled]]
Line 87: Line 87:
| Expressions of Eden Editor scenario attributes are called
| Expressions of Eden Editor scenario attributes are called
| All
| All
| {{Checkbox|yes}}
| {{Icon|checked}}
| [[Eden Editor: Configuring Attributes]]
| [[Eden Editor: Configuring Attributes]]
| [[Scheduler#Unscheduled Environment|Unscheduled]]
| [[Scheduler#Unscheduled Environment|Unscheduled]]
Line 94: Line 94:
| Persistent functions are called
| Persistent functions are called
| Client
| Client
| {{Checkbox|yes}}
| {{Icon|checked}}
| [[BIS_fnc_MP]]
| [[BIS_fnc_MP]]
|
|
Line 115: Line 115:
| [[Event Scripts#initPlayerLocal.sqf|initPlayerLocal.sqf]] is executed
| [[Event Scripts#initPlayerLocal.sqf|initPlayerLocal.sqf]] is executed
| Client
| Client
| {{Checkbox|yes}}
| {{Icon|checked}}
| [[Event Scripts]]
| [[Event Scripts]]
| [[Scheduler#Scheduled Environment|Scheduled]]
| [[Scheduler#Scheduled Environment|Scheduled]]
Line 122: Line 122:
| [[Event Scripts#initPlayerServer.sqf|initPlayerServer.sqf]] is executed on the server
| [[Event Scripts#initPlayerServer.sqf|initPlayerServer.sqf]] is executed on the server
| Client
| Client
| {{Checkbox|yes}}
| {{Icon|checked}}
| [[Event Scripts]]
| [[Event Scripts]]
| [[Scheduler#Scheduled Environment|Scheduled]]
| [[Scheduler#Scheduled Environment|Scheduled]]
Line 129: Line 129:
| Functions with ''postInit'' attribute are called
| Functions with ''postInit'' attribute are called
| All
| All
| {{Checkbox|yes}}
| {{Icon|checked}}
| [[Arma 3 Functions Library]]
| [[Arma 3 Functions Library]]
| [[Scheduler#Scheduled Environment|Scheduled]]<ref name="enginewaits"/>
| [[Scheduler#Scheduled Environment|Scheduled]]<ref name="enginewaits"/>
Line 136: Line 136:
| "BIS_fnc_init" variable is set to true
| "BIS_fnc_init" variable is set to true
| All
| All
| {{Checkbox|yes}}
| {{Icon|checked}}
| [[Arma 2: Functions Library]]
| [[Arma 2: Functions Library]]
|
|
Line 143: Line 143:
| [[Event Scripts#init.sqs|init.sqs]] is executed
| [[Event Scripts#init.sqs|init.sqs]] is executed
| Multiplayer
| Multiplayer
| {{Checkbox|yes}}
| {{Icon|checked}}
| [[Event Scripts]]
| [[Event Scripts]]
| [[Scheduler#Scheduled Environment|Scheduled]]
| [[Scheduler#Scheduled Environment|Scheduled]]
Line 150: Line 150:
| [[Event Scripts#init.sqf|init.sqf]] is executed
| [[Event Scripts#init.sqf|init.sqf]] is executed
| Multiplayer
| Multiplayer
| {{Checkbox|yes}}
| {{Icon|checked}}
| [[Event Scripts]]
| [[Event Scripts]]
| [[Scheduler#Scheduled Environment|Scheduled]]
| [[Scheduler#Scheduled Environment|Scheduled]]

Revision as of 02:00, 8 February 2021

Whenever a mission is launched (or joined in Multiplayer) certain tasks are performed to ensure the mission's various components are initialised correctly and that everyone is synced in multiplayer games (particularly JIP players). Initialisation order refers to the order in which those tasks are executed and it is important to take into account when setting up the start of a mission.

Event Scripts are a key part of a mission's initialisation order and will be utilised often when working with SQF.


Key
Item Meaning
Single Player Only
Multiplayer Only
Order is not guaranteed

Take note that the order of initialisation is different in single player and multiplayer environments. If an entry is unmarked then it applies to both.

In multiplayer the following is relevant to every machine including the server and headless clients. If the server is non-dedicated then it should be considered both a server and client.


Arma 3

Order of Initialisation (From First to Last)
Task Applies To JIP Related To Exec Environment Notes
Functions with recompile attribute are recompiled All Checked Arma 3 Functions Library
Functions with preInit attribute are called All Checked Arma 3 Functions Library Unscheduled
Object Init Event Handlers are called All Unchecked Unscheduled
Expressions of Eden Editor entity attributes are called Unchecked Eden Editor: Configuring Attributes Unscheduled They are called on the server. isPlayer _entity; does not return true immediately. Once entity has become a player, the entity is transfered to the client.
Object initialisation fields are called All Checked Unscheduled
init.sqs is executed Singleplayer N/A Event Scripts
init.sqf is executed Singleplayer N/A Event Scripts Scheduled[1]
Expressions of Eden Editor scenario attributes are called All Checked Eden Editor: Configuring Attributes Unscheduled player is not available immediately.
Persistent functions are called Client Checked BIS_fnc_MP
Modules are initialised All Unchecked
initServer.sqf is executed Server N/A Event Scripts Scheduled
initPlayerLocal.sqf is executed Client Checked Event Scripts Scheduled
initPlayerServer.sqf is executed on the server Client Checked Event Scripts Scheduled
Functions with postInit attribute are called All Checked Arma 3 Functions Library Scheduled[1]
"BIS_fnc_init" variable is set to true All Checked Arma 2: Functions Library
init.sqs is executed Multiplayer Checked Event Scripts Scheduled
init.sqf is executed Multiplayer Checked Event Scripts Scheduled
  1. 1.0 1.1 Note that while the environment is Scheduled (canSuspend returns true), the engine seems to wait until the script is done executing, essentially behaving similarly to an Unscheduled environment - infinite loops will freeze the game, uiSleep may pause the game for up to ~20secs (postInit), etc.