Lou Montana/Sandbox – User

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Add Mission Design stub)
m (Update w/ links)
 
(42 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{SideTOC}}
[[Category: Sandbox]]
[[Category: Sandbox]]
{{Feature|informative|To go on [[Initialisation Order]].}}


= Mission Design =
{| class="wikitable sortable align-center align-left-col-1"
|+ Order of Initialisation (use column sorting for respective machine order)
! rowspan="2" class="unsortable" style="text-align: center" | Task
! rowspan="2" | Exec Environment
! rowspan="1" colspan="5" class="unsortable" | Machine
|-
! Single Player
! Dedicated Server
! Hosted Server
! Multiplayer Client
! [[Multiplayer Scripting#Join In Progress|JIP]] MP Client


[[Mission Design]] is an important aspect to consider in order to keep the player(s) entertained.
|-
| [[Arma 3: Functions Library|Functions]] with <syntaxhighlight lang="cpp" inline>recompile</syntaxhighlight> {{Link|Arma 3: Functions Library#Attributes 3|attribute}} are recompiled
| {{n/a}}
| 1 <!-- Single Player -->
| 1 <!-- Dedicated Server -->
| 1 <!-- Hosted Server -->
| 1 <!-- Multiplayer Client -->
| 1 <!-- JIP MP Client -->


# Wanting to play through the whole mission
|-
# Seeing an effect to their actions
| [[Arma 3: Functions Library|Functions]] with <syntaxhighlight lang="cpp" inline>preInit</syntaxhighlight> {{Link|Arma 3: Functions Library#Attributes 3|attribute}} are called
# In the end, having '''a sense of accomplishment'''.
| [[Scheduler#Unscheduled Environment|Unscheduled]]
| 2 <!-- Single Player -->
| 2 <!-- Dedicated Server -->
| 2 <!-- Hosted Server -->
| 2 <!-- Multiplayer Client -->
| 2 <!-- JIP MP Client -->


|-
| Object Init Event Handlers are called
| [[Scheduler#Unscheduled Environment|Unscheduled]]
| 3 <!-- Single Player -->
| 3 <!-- Dedicated Server -->
| 3 <!-- Hosted Server -->
| 3 <!-- Multiplayer Client -->
| {{Icon|unchecked}} <!-- JIP MP Client -->


== Mission Goal ==
|-
| Expressions of [[Eden Editor: Configuring Attributes|Eden Editor entity attributes]] are called<ref name="isPlayer"><sqf inline>isPlayer _entity</sqf> does not return [[true]] immediately. Once the entity has become a [[player]], it is transferred to the client.</ref>
| [[Scheduler#Unscheduled Environment|Unscheduled]]
| 4 <!-- Single Player -->
| 4 <!-- Dedicated Server -->
| 4 <!-- Hosted Server -->
| {{Icon|unchecked}} <!-- Multiplayer Client -->
| {{Icon|unchecked}} <!-- JIP MP Client -->


While the ''mission's'' goal can remain hidden or obscure to the player, his ''current'' goal must be crystal clear. For example, the end goal of "fighting back" can remain hidden, but the first goal of "patrol the camp" must be made obvious so the player is not at loss and feels he has something to accomplish.
|-
| Object initialisation fields are called
| [[Scheduler#Unscheduled Environment|Unscheduled]]
| 5 <!-- Single Player -->
| 5 <!-- Dedicated Server -->
| 5 <!-- Hosted Server -->
| 4 <!-- Multiplayer Client -->
| 3 <!-- JIP MP Client -->


|- style="background-color: #95F0AD"
| [[Event Scripts#init.sqs|init.sqs]] is executed
|
| 6 <!-- Single Player -->
| <!-- Dedicated Server -->
| <!-- Hosted Server -->
| <!-- Multiplayer Client -->
| <!-- JIP MP Client -->


== Action/Reward ==
|- style="background-color: #95F0AD"
| [[Event Scripts#init.sqf|init.sqf]] is executed
| [[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>
| <!-- Single Player -->
| <!-- Dedicated Server -->
| <!-- Hosted Server -->
| <!-- Multiplayer Client -->
| <!-- JIP MP Client -->


The meat of player's interest is here: an achieved goal must reward the player with an evolution: either a reward (new intel, less enemies, easier progress) or a scenario evolution (enemy counterattack, reinforcements incoming, radio update).
|-
| Expressions of [[Eden Editor: Configuring Attributes|Eden Editor scenario attributes]] are called<ref name="playerCommandNotAvailable">[[player]] is not available immediately.</ref>
| [[Scheduler#Unscheduled Environment|Unscheduled]]
| <!-- Single Player -->
| <!-- Dedicated Server -->
| <!-- Hosted Server -->
| <!-- Multiplayer Client -->
| <!-- JIP MP Client -->


|- style="background-color: #95DEF0"
| Persistent functions are called
|
| <!-- Single Player -->
| <!-- Dedicated Server -->
| <!-- Hosted Server -->
| <!-- Multiplayer Client -->
| <!-- JIP MP Client -->


== Multiplayer Specifics ==
|-
| [[Modules]] are initialised
|
| <!-- Single Player -->
| <!-- Dedicated Server -->
| <!-- Hosted Server -->
| <!-- Multiplayer Client -->
| {{Icon|unchecked}} <!-- JIP MP Client -->


* Teamplay and cooperation
|- style="background-color: #DEF0AD"
* Winning over the other team (if PvP)
| [[Event Scripts#initServer.sqf|initServer.sqf]] is executed
| [[Scheduler#Scheduled Environment|Scheduled]]
| <!-- Single Player -->
| <!-- Dedicated Server -->
| <!-- Hosted Server -->
| {{n/a}} <!-- Multiplayer Client -->
| {{n/a}} <!-- JIP MP Client -->


|- style="background-color: #DEF0AD"
| [[Event Scripts#initPlayerLocal.sqf|initPlayerLocal.sqf]] is executed
| [[Scheduler#Scheduled Environment|Scheduled]]
| <!-- Single Player -->
| {{n/a}} <!-- Dedicated Server -->
| <!-- Hosted Server -->
| <!-- Multiplayer Client -->
| <!-- JIP MP Client -->


== Examples ==
|- style="background-color: #DEF0AD"
| [[Event Scripts#initPlayerServer.sqf|initPlayerServer.sqf]] is executed on the server
| [[Scheduler#Scheduled Environment|Scheduled]]
| <!-- Single Player -->
| {{n/a}} <!-- Dedicated Server -->
| ?? <!-- Hosted Server -->
| <!-- Multiplayer Client -->
| <!-- JIP MP Client -->


* destroy the radio antenna then attack the base
|-
* stuff2
| [[Arma 3: Functions Library|Functions]] with <syntaxhighlight lang="cpp" inline>postInit</syntaxhighlight> {{Link|Arma 3: Functions Library#Attributes 3|attribute}} are called
* stuff3
| [[Scheduler#Scheduled Environment|Scheduled]]<ref name="enginewaits"/>
| <!-- Single Player -->
| <!-- Dedicated Server -->
| <!-- Hosted Server -->
| <!-- Multiplayer Client -->
| <!-- JIP MP Client -->


|- style="background-color: #95DEF0"
| [[Event Scripts#init.sqs|init.sqs]] is executed
| [[Scheduler#Scheduled Environment|Scheduled]]
| <!-- Single Player -->
| <!-- Dedicated Server -->
| <!-- Hosted Server -->
| <!-- Multiplayer Client -->
| <!-- JIP MP Client -->


|- style="background-color: #95DEF0"
| [[Event Scripts#init.sqf|init.sqf]] is executed
| [[Scheduler#Scheduled Environment|Scheduled]]
| <!-- Single Player -->
| <!-- Dedicated Server -->
| <!-- Hosted Server -->
| <!-- Multiplayer Client -->
| <!-- JIP MP Client -->


-----
|-
-----
| [[remoteExec]]'s [[Multiplayer Scripting#Join In Progress|JIP]] queue
| {{n/a}}
| {{n/a}} <!-- Single Player -->
| {{n/a}} <!-- Dedicated Server -->
| {{n/a}} <!-- Hosted Server -->
| {{n/a}} <!-- Multiplayer Client -->
| 42 <!-- JIP MP Client -->


|- style="background-color: #EEE"
| ''Scenario going''
| {{n/a}}
| <!-- Single Player -->
| <!-- Dedicated Server -->
| <!-- Hosted Server -->
| <!-- Multiplayer Client -->
| <!-- JIP MP Client -->


|-
| [[Event Scripts#exit.sqf|exit.sqf]]
|
| <!-- Single Player -->
| <!-- Dedicated Server -->
| <!-- Hosted Server -->
| <!-- Multiplayer Client -->
| <!-- JIP MP Client -->


↓ anyone feels like filling the table below…? ↓
|-
| [[Event Scripts#exit.sqs|exit.sqs]]
|
| <!-- Single Player -->
| <!-- Dedicated Server -->
| <!-- Hosted Server -->
| <!-- Multiplayer Client -->
| <!-- JIP MP Client -->


== Vehicles Speed and Fuel Stats ==
|-
| {{Link|Arma 3: Mission Event Handlers#Ended|"Ended" Mission Event Handler}}
|
| <!-- Single Player -->
| <!-- Dedicated Server -->
| <!-- Hosted Server -->
| <!-- Multiplayer Client -->
| <!-- JIP MP Client -->


{| class="bikitable sortable"
!rowspan="2" | Class !! rowspan="2" | Name !! colspan="4" | Full tank consumption time !! colspan="3" | Speed
|-
|-
! Idle !! slow speed !! medium speed !! max speed !! slow speed !! medium speed !! max speed
| {{Link|Arma 3: Mission Event Handlers#MPEnded|"MPEnded" Mission Event Handler}}
|-
|
| B_Truck_01_mover_F || HEMTT || 05:18:00 || 03:15:00 || 03:38:00 || 03:18:00 || 026,83 km/h || 070,94 km/h || 082,85 km/h
| <!-- Single Player -->
|-
| <!-- Dedicated Server -->
| B_MRAP_01_F || Hunter (unarmed) || 04:33:00 || 02:47:00 || 01:56:00 || 01:44:00 || 037,13 km/h || 099,81 km/h || 116,45 km/h
| <!-- Hosted Server -->
|-
| <!-- Multiplayer Client -->
| B_LSV_01_unarmed_F || Prowler (unarmed) || 04:09:00 || 01:38:00 || 01:50:00 || 01:38:00 || 053,96 km/h || 147,06 km/h || 172,47 km/h
| <!-- JIP MP Client -->
|-
 
| B_Quadbike_01_F || Quad || 01:54:00 || 01:09:00 || 01:12:00 || 01:06:00 || 027,14 km/h || 070,77 km/h || 082,20 km/h
|-
| B_APC_Tracked_01_AA_F || IFV-6a Cheetah || 03:11:00 || 02:07:00 || 02:14:00 || 01:56:00 || 023,31 km/h || 046,31 km/h || 061,07 km/h
|-
| B_APC_Wheeled_01_cannon_F || AMV-7 Marshall || 04:55:00 || 02:58:00 || 02:58:00 || 02:34:00 || 036,20 km/h || 060,41 km/h || 113,00 km/h
|-
| B_APC_Tracked_01_CRV_F || CRV-6e Bobcat || 03:11:00 || 02:05:00 || 02:13:00 || 01:55:00 || 023,31 km/h || 046,31 km/h || 061,07 km/h
|}
|}


Code used:
<spoiler><pre>veh = vehicle player;
wantedDelta = 3;
previousPos = [0,0,0];
currentPos = [0,0,0];
previousFuel = 0;
currentFuel = 0;
t = 0;
onEachFrame {
isNil {
vehSpeed = speed veh;
if (t <= time) then {
previousPos = currentPos;
currentPos = getPosATL veh;
distanceDelta = currentPos distance previousPos;
previousFuel = currentFuel;
currentFuel = fuel veh;
fuelLossPerMinute = (previousFuel - currentFuel) * (60 / (wantedDelta + (time - t)));
remainingTime = if (fuelLossPerMinute > 0) then {
[(currentFuel / fuelLossPerMinute) * 60, "HH:MM:SS"] call BIS_fnc_secondsToString;
} else { -1 };
timeToEmpty = if (fuelLossPerMinute > 0) then {
[(1 / fuelLossPerMinute) * 60, "HH:MM:SS"] call BIS_fnc_secondsToString;
} else { -1 };
t = time + wantedDelta;
};


hintSilent format [
== See Also ==
"Speed: %1\nFuel loss: %2\n\nRemaining time: %3\nTime to empty: %4",
vehSpeed,
fuelLossPerMinute,
remainingTime,
timeToEmpty];


copyToClipboard format ["[%1, %2, %3]", typeOf veh, timeToEmpty, vehSpeed];
* [[Arma 3: Functions Library]]<!--
};
* [[Arma 2: Functions Library]] -->
};
* [[Arma 3: Remote Execution]], [[BIS_fnc_MP]] <!-- keep? -->
</pre></spoiler>
* [[Eden Editor: Configuring Attributes|Eden Editor: Configuring Attributes]]
* [[Event Scripts]]
* [[Scheduler]]

Latest revision as of 01:29, 18 March 2024

Order of Initialisation (use column sorting for respective machine order)
Task Exec Environment Machine
Single Player Dedicated Server Hosted Server Multiplayer Client JIP MP Client
Functions with recompile attribute are recompiled N/A 1 1 1 1 1
Functions with preInit attribute are called Unscheduled 2 2 2 2 2
Object Init Event Handlers are called Unscheduled 3 3 3 3 Unchecked
Expressions of Eden Editor entity attributes are called[1] Unscheduled 4 4 4 Unchecked Unchecked
Object initialisation fields are called Unscheduled 5 5 5 4 3
init.sqs is executed 6
init.sqf is executed Scheduled[2]
Expressions of Eden Editor scenario attributes are called[3] Unscheduled
Persistent functions are called
Modules are initialised Unchecked
initServer.sqf is executed Scheduled N/A N/A
initPlayerLocal.sqf is executed Scheduled N/A
initPlayerServer.sqf is executed on the server Scheduled N/A ??
Functions with postInit attribute are called Scheduled[2]
init.sqs is executed Scheduled
init.sqf is executed Scheduled
remoteExec's JIP queue N/A N/A N/A N/A N/A 42
Scenario going N/A
exit.sqf
exit.sqs
"Ended" Mission Event Handler
"MPEnded" Mission Event Handler


See Also

  1. isPlayer _entity does not return true immediately. Once the entity has become a player, it is transferred to the client.
  2. 2.0 2.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.
  3. player is not available immediately.