Initialisation Order: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Page refresh) |
Lou Montana (talk | contribs) m (Text replacement - "[[Arma 3 " to "[[Arma 3: ") |
||
(21 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
Whenever a mission is launched (or [[Join In Progress|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). | Whenever a mission is launched (or [[Multiplayer Scripting#Join In Progress|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 [[Multiplayer Scripting#Join In Progress|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. | 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 | [[Event Scripts]] are a key part of a mission's initialisation order and will be utilised often when working with [[SQF Syntax|SQF]]. | ||
{| class=" | {| class="wikitable" style="float: right; margin: 0 0 0.5em 1.5em" | ||
|+ Key | |+ Key | ||
! Item | ! Item | ||
Line 20: | Line 20: | ||
|} | |} | ||
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. | 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. | ||
{{ | {{Feature|informative| | ||
If the server is non-dedicated then it should be considered both a server and client.}} | In multiplayer the following is relevant to every machine including the server and [[Arma 3: Headless Client|headless clients]]. | ||
If the server is non-dedicated then it should be considered both a server and client. | |||
}} | |||
{{Clear}} | {{Clear}} | ||
== | == {{arma3}} == | ||
{| class=" | {| class="wikitable" | ||
|+ Order of Initialisation (From First to Last) | |+ Order of Initialisation (From First to Last) | ||
! Task | ! Task | ||
Line 38: | Line 40: | ||
| Functions with ''recompile'' attribute are recompiled | | Functions with ''recompile'' attribute are recompiled | ||
| All | | All | ||
| {{ | | {{Icon|checked}} | ||
| [[Arma 3 Functions Library]] | | [[Arma 3: Functions Library]] | ||
| | | | ||
| | | | ||
Line 45: | Line 47: | ||
| Functions with ''preInit'' attribute are called | | Functions with ''preInit'' attribute are called | ||
| All | | All | ||
| {{ | | {{Icon|checked}} | ||
| [[Arma 3 Functions Library]] | | [[Arma 3: Functions Library]] | ||
| [[Scheduler#Unscheduled Environment|Unscheduled]] | | [[Scheduler#Unscheduled Environment|Unscheduled]] | ||
| | | | ||
Line 52: | Line 54: | ||
| Object Init Event Handlers are called | | Object Init Event Handlers are called | ||
| All | | All | ||
| {{ | | {{Icon|unchecked}} | ||
| | | | ||
| [[Scheduler#Unscheduled Environment|Unscheduled]] | | [[Scheduler#Unscheduled Environment|Unscheduled]] | ||
Line 58: | Line 60: | ||
|- | |- | ||
| Expressions of Eden Editor entity attributes are called | | Expressions of Eden Editor entity attributes are called | ||
| | | Server | ||
| {{ | | {{Icon|unchecked}} | ||
| [[Eden Editor: Configuring Attributes]] | | [[Eden Editor: Configuring Attributes]] | ||
| [[Scheduler#Unscheduled Environment|Unscheduled]] | | [[Scheduler#Unscheduled Environment|Unscheduled]] | ||
| | | <sqf inline>isPlayer _entity</sqf> does not return [[true]] immediately. Once the entity has become a [[player]], it is transfered to the client. | ||
|- | |- | ||
| Object initialisation fields are called | | Object initialisation fields are called | ||
| All | | All | ||
| {{ | | {{Icon|checked}} | ||
| | | | ||
| [[Scheduler#Unscheduled Environment|Unscheduled]] | | [[Scheduler#Unscheduled Environment|Unscheduled]] | ||
Line 73: | Line 75: | ||
| [[Event Scripts#init.sqs|init.sqs]] is executed | | [[Event Scripts#init.sqs|init.sqs]] is executed | ||
| Singleplayer | | Singleplayer | ||
| | | {{n/a}} | ||
| [[Event Scripts]] | | [[Event Scripts]] | ||
| | | | ||
Line 80: | Line 82: | ||
| [[Event Scripts#init.sqf|init.sqf]] is executed | | [[Event Scripts#init.sqf|init.sqf]] is executed | ||
| Singleplayer | | Singleplayer | ||
| | | {{n/a}} | ||
| [[Event Scripts]] | | [[Event Scripts]] | ||
| [[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 ~ | | [[Scheduler#Scheduled Environment|Scheduled]]<ref name="enginewaits">Note '''in single player''' 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 ~20s (postInit), [[waitUntil]] can cause catastrophic issues, etc.</ref> | ||
| | | | ||
|- | |- | ||
| Expressions of Eden Editor scenario attributes are called | | Expressions of Eden Editor scenario attributes are called | ||
| All | | All | ||
| {{ | | {{Icon|checked}} | ||
| [[Eden Editor: Configuring Attributes]] | | [[Eden Editor: Configuring Attributes]] | ||
| [[Scheduler#Unscheduled Environment|Unscheduled]] | | [[Scheduler#Unscheduled Environment|Unscheduled]] | ||
| [[player]] is not available immediately. | | [[player]] is not available immediately. | ||
|- | |- style="background-color: #95DEF0" | ||
| Persistent functions are called | | Persistent functions are called | ||
| Client | | Client | ||
| {{ | | {{Icon|checked}} | ||
| [[BIS_fnc_MP]] | | [[Arma 3: Remote Execution]], [[BIS_fnc_MP]] | ||
| | | | ||
| | | | ||
Line 101: | Line 103: | ||
| Modules are initialised | | Modules are initialised | ||
| All | | All | ||
| {{ | | {{Icon|unchecked}} | ||
| | | | ||
| | | | ||
Line 108: | Line 110: | ||
| [[Event Scripts#initServer.sqf|initServer.sqf]] is executed | | [[Event Scripts#initServer.sqf|initServer.sqf]] is executed | ||
| Server | | Server | ||
| | | {{n/a}} | ||
| [[Event Scripts]] | | [[Event Scripts]] | ||
| [[Scheduler#Scheduled Environment|Scheduled]] | | [[Scheduler#Scheduled Environment|Scheduled]] | ||
Line 115: | Line 117: | ||
| [[Event Scripts#initPlayerLocal.sqf|initPlayerLocal.sqf]] is executed | | [[Event Scripts#initPlayerLocal.sqf|initPlayerLocal.sqf]] is executed | ||
| Client | | Client | ||
| {{ | | {{Icon|checked}} | ||
| [[Event Scripts]] | | [[Event Scripts]] | ||
| [[Scheduler#Scheduled Environment|Scheduled]] | | [[Scheduler#Scheduled Environment|Scheduled]] | ||
Line 122: | Line 124: | ||
| [[Event Scripts#initPlayerServer.sqf|initPlayerServer.sqf]] is executed on the server | | [[Event Scripts#initPlayerServer.sqf|initPlayerServer.sqf]] is executed on the server | ||
| Client | | Client | ||
| {{ | | {{Icon|checked}} | ||
| [[Event Scripts]] | | [[Event Scripts]] | ||
| [[Scheduler#Scheduled Environment|Scheduled]] | | [[Scheduler#Scheduled Environment|Scheduled]] | ||
Line 129: | Line 131: | ||
| Functions with ''postInit'' attribute are called | | Functions with ''postInit'' attribute are called | ||
| All | | All | ||
| {{ | | {{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 138: | ||
| "BIS_fnc_init" variable is set to true | | "BIS_fnc_init" variable is set to true | ||
| All | | All | ||
| {{ | | {{Icon|checked}} | ||
| [[Arma 2: Functions Library]] | | [[Arma 2: Functions Library]] | ||
| | | | ||
Line 142: | Line 144: | ||
|- style="background-color: #95DEF0" | |- style="background-color: #95DEF0" | ||
| [[Event Scripts#init.sqs|init.sqs]] is executed | | [[Event Scripts#init.sqs|init.sqs]] is executed | ||
| | | Multiplayer | ||
| {{ | | {{Icon|checked}} | ||
| [[Event Scripts]] | | [[Event Scripts]] | ||
| [[Scheduler#Scheduled Environment|Scheduled]] | | [[Scheduler#Scheduled Environment|Scheduled]] | ||
Line 149: | Line 151: | ||
|- style="background-color: #95DEF0" | |- style="background-color: #95DEF0" | ||
| [[Event Scripts#init.sqf|init.sqf]] is executed | | [[Event Scripts#init.sqf|init.sqf]] is executed | ||
| | | Multiplayer | ||
| {{ | | {{Icon|checked}} | ||
| [[Event Scripts]] | | [[Event Scripts]] | ||
| [[Scheduler#Scheduled Environment|Scheduled]] | | [[Scheduler#Scheduled Environment|Scheduled]] | ||
Line 157: | Line 159: | ||
[[Category: | [[Category:Mission Editing]] | ||
[[Category: Scripting Topics]] | [[Category: Scripting Topics]] |
Latest revision as of 10:38, 6 May 2024
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.
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.
Arma 3
Task | Applies To | JIP | Related To | Exec Environment | Notes |
---|---|---|---|---|---|
Functions with recompile attribute are recompiled | All | Arma 3: Functions Library | |||
Functions with preInit attribute are called | All | Arma 3: Functions Library | Unscheduled | ||
Object Init Event Handlers are called | All | Unscheduled | |||
Expressions of Eden Editor entity attributes are called | Server | Eden Editor: Configuring Attributes | Unscheduled | isPlayer _entity does not return true immediately. Once the entity has become a player, it is transfered to the client. | |
Object initialisation fields are called | All | 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 | Eden Editor: Configuring Attributes | Unscheduled | player is not available immediately. | |
Persistent functions are called | Client | Arma 3: Remote Execution, BIS_fnc_MP | |||
Modules are initialised | All | ||||
initServer.sqf is executed | Server | N/A | 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 | Arma 3: Functions Library | Scheduled[1] | ||
"BIS_fnc_init" variable is set to true | All | Arma 2: Functions Library | |||
init.sqs is executed | Multiplayer | Event Scripts | Scheduled | ||
init.sqf is executed | Multiplayer | Event Scripts | Scheduled |
- ↑ 1.0 1.1 Note in single player 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 ~20s (postInit), waitUntil can cause catastrophic issues, etc.