Initialisation Order: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (added scripting topic category)
Line 35: Line 35:
! Related To
! Related To
! Exec Environment
! Exec Environment
! Notes
|-
|-
|Functions with ''recompile'' attribute are recompiled
|Functions with ''recompile'' attribute are recompiled
Line 40: Line 41:
|✔
|✔
|[[Functions Library (Arma 3)]]
|[[Functions Library (Arma 3)]]
|
|
|
|-
|-
Line 47: Line 49:
|[[Functions Library (Arma 3)]]
|[[Functions Library (Arma 3)]]
|[[Scheduler#Unscheduled_Environment|Unscheduled]]
|[[Scheduler#Unscheduled_Environment|Unscheduled]]
|
|-
|-
|Object Init Event Handlers are called
|Object Init Event Handlers are called
Line 53: Line 56:
|
|
|[[Scheduler#Unscheduled_Environment|Unscheduled]]
|[[Scheduler#Unscheduled_Environment|Unscheduled]]
|
|-
|-
|Expressions of Eden Editor entity attributes are called
|Expressions of Eden Editor entity attributes are called
Line 59: Line 63:
|[[Eden Editor: Configuring Attributes]]
|[[Eden Editor: Configuring Attributes]]
|[[Scheduler#Unscheduled_Environment|Unscheduled]]
|[[Scheduler#Unscheduled_Environment|Unscheduled]]
|They are called on the server. <code>[[isPlayer]] _entity;</code> does not return true immediately. Once entity has become a [[player]], the entity is transfered to the client.
|-
|-
|Object initialization fields are called
|Object initialization fields are called
Line 65: Line 70:
|
|
|[[Scheduler#Unscheduled_Environment|Unscheduled]]
|[[Scheduler#Unscheduled_Environment|Unscheduled]]
|
|-
|-
|bgcolor="#95F0AD"| init.sqs is executed
|bgcolor="#95F0AD"| init.sqs is executed
Line 71: Line 77:
|bgcolor="#95F0AD"| [[Event Scripts]]
|bgcolor="#95F0AD"| [[Event Scripts]]
|bgcolor="#95F0AD"|
|bgcolor="#95F0AD"|
|
|-
|-
|bgcolor="#95F0AD"| init.sqf is executed
|bgcolor="#95F0AD"| init.sqf is executed
Line 77: Line 84:
|bgcolor="#95F0AD"| [[Event Scripts]]
|bgcolor="#95F0AD"| [[Event Scripts]]
|bgcolor="#95F0AD"|[[Scheduler#Scheduled_Environment|Scheduled]]<ref name="enginewaits">Note that while the environment is [[Scheduler#Scheduled_Environment|Scheduled]] ([[canSuspend]] returns true), the engine seems to wait until the script is done executing, essentially behaving similarly to an [[Scheduler#Unscheduled_Environment|Unscheduled environment]] - infinite loops will freeze the game, uiSleep may pause the game for up to ~20secs (postInit), etc.</ref>
|bgcolor="#95F0AD"|[[Scheduler#Scheduled_Environment|Scheduled]]<ref name="enginewaits">Note that while the environment is [[Scheduler#Scheduled_Environment|Scheduled]] ([[canSuspend]] returns true), the engine seems to wait until the script is done executing, essentially behaving similarly to an [[Scheduler#Unscheduled_Environment|Unscheduled environment]] - infinite loops will freeze the game, uiSleep may pause the game for up to ~20secs (postInit), etc.</ref>
|
|-
|-
|Expressions of Eden Editor scenario attributes are called
|Expressions of Eden Editor scenario attributes are called
Line 83: Line 91:
|[[Eden Editor: Configuring Attributes]]
|[[Eden Editor: Configuring Attributes]]
|[[Scheduler#Unscheduled_Environment|Unscheduled]]
|[[Scheduler#Unscheduled_Environment|Unscheduled]]
|
|-
|-
|Persistent functions are called
|Persistent functions are called
Line 88: Line 97:
|✔
|✔
|[[BIS_fnc_MP]]
|[[BIS_fnc_MP]]
|
|
|
|-
|-
|Modules are initialized
|Modules are initialized
|All
|All
|
|
|
|
|
Line 101: Line 112:
|bgcolor="#DEF0AD"|[[Event Scripts]]
|bgcolor="#DEF0AD"|[[Event Scripts]]
|bgcolor="#DEF0AD"|[[Scheduler#Scheduled_Environment|Scheduled]]
|bgcolor="#DEF0AD"|[[Scheduler#Scheduled_Environment|Scheduled]]
|
|-
|-
|bgcolor="#DEF0AD"|initPlayerLocal.sqf is executed
|bgcolor="#DEF0AD"|initPlayerLocal.sqf is executed
Line 107: Line 119:
|bgcolor="#DEF0AD"|[[Event Scripts]]
|bgcolor="#DEF0AD"|[[Event Scripts]]
|bgcolor="#DEF0AD"|[[Scheduler#Scheduled_Environment|Scheduled]]
|bgcolor="#DEF0AD"|[[Scheduler#Scheduled_Environment|Scheduled]]
|
|-
|-
|bgcolor="#DEF0AD"|initPlayerServer.sqf is executed on the server
|bgcolor="#DEF0AD"|initPlayerServer.sqf is executed on the server
Line 113: Line 126:
|bgcolor="#DEF0AD"|[[Event Scripts]]
|bgcolor="#DEF0AD"|[[Event Scripts]]
|bgcolor="#DEF0AD"|[[Scheduler#Scheduled_Environment|Scheduled]]
|bgcolor="#DEF0AD"|[[Scheduler#Scheduled_Environment|Scheduled]]
|
|-
|-
|Functions with ''postInit'' attribute are called
|Functions with ''postInit'' attribute are called
Line 119: Line 133:
|[[Functions Library (Arma 3)]]
|[[Functions Library (Arma 3)]]
|[[Scheduler#Scheduled_Environment|Scheduled]]<ref name="enginewaits"/>
|[[Scheduler#Scheduled_Environment|Scheduled]]<ref name="enginewaits"/>
|
|-
|-
|"BIS_fnc_init" variable is set to true
|"BIS_fnc_init" variable is set to true
|All
|All
|✔
|✔
|
|
|
|
|
Line 131: Line 147:
|bgcolor="#95DEF0"|[[Event Scripts]]
|bgcolor="#95DEF0"|[[Event Scripts]]
|bgcolor="#95DEF0"|[[Scheduler#Scheduled_Environment|Scheduled]]
|bgcolor="#95DEF0"|[[Scheduler#Scheduled_Environment|Scheduled]]
|
|-
|-
|bgcolor="#95DEF0"|init.sqf is executed
|bgcolor="#95DEF0"|init.sqf is executed
Line 137: Line 154:
|bgcolor="#95DEF0"|[[Event Scripts]]
|bgcolor="#95DEF0"|[[Event Scripts]]
|bgcolor="#95DEF0"|[[Scheduler#Scheduled_Environment|Scheduled]]
|bgcolor="#95DEF0"|[[Scheduler#Scheduled_Environment|Scheduled]]
|
|}
|}


[[Category: Arma 3: Editing]]
[[Category: Arma 3: Editing]]
[[Category: Scripting_Topics ]]
[[Category: Scripting_Topics ]]

Revision as of 11:10, 4 August 2019

Introduction

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

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

Arma 3

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

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

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.

Order of Initialization
Task Applies To JIP Related To Exec Environment Notes
Functions with recompile attribute are recompiled All Functions Library (Arma 3)
Functions with preInit attribute are called All Functions Library (Arma 3) Unscheduled
Object Init Event Handlers are called All Unscheduled
Expressions of Eden Editor entity attributes are called 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 initialization fields are called All Unscheduled
init.sqs is executed Single Player Event Scripts
init.sqf is executed Single Player Event Scripts Scheduled[1]
Expressions of Eden Editor scenario attributes are called All Eden Editor: Configuring Attributes Unscheduled
Persistent functions are called Client BIS_fnc_MP
Modules are initialized All
initServer.sqf is executed Server Event Scripts Scheduled
initPlayerLocal.sqf is executed Client Event Scripts Scheduled
initPlayerServer.sqf is executed on the server Client Event Scripts Scheduled
Functions with postInit attribute are called All Functions Library (Arma 3) Scheduled[1]
"BIS_fnc_init" variable is set to true All
init.sqs is executed All Event Scripts Scheduled
init.sqf is executed All 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.