Further methods may be added to BASE whenever there is a need to make "overall" functions available within MOOSE.
+The underlying change log documents the API changes. Please read this carefully. The following notation is used:
+
+
Module Fsm
-
This module contains the FSM class.
+
This module contains the FSM class and derived FSM_ classes.
+
This development is based on a state machine implementation made by Conroy Kyle.
The state machine can be found here: https://github.com/kyleconroy/lua-state-machine
-
I've taken the development and enhanced it to make the state machine hierarchical...
+
I've taken the development and enhanced it (actually rewrote it) to make the state machine hierarchical...
It is a fantastic development, this module.
-
+
+
+
A Finite State Machine (FSM) defines the rules of transitioning between various States triggered by Events.
+
+
+ - A State defines a moment in the process.
+ - An Event describes an action, that can be triggered both internally as externally in the FSM. An Event can be triggered Embedded or Delayed over time.
+
+
+

+
+
An FSM transitions in 4 moments when an Event is being handled.
+Each moment can be catched by handling methods defined by the mission designer,
+that will be called by the FSM while executing the transition.
+These methods define the flow of the FSM process; because in those methods the FSM Internal Events will be fired.
+
+
+ - To catch State moments, create methods starting with OnLeave or OnEnter concatenated with the State name.
+ - To catch Event moments, create methods starting with OnBefore or OnAfter concatenated with the Event name.
+
+
+
* The OnLeave and OnBefore transition methods may return false to cancel the transition.*
+
+

+
+
The FSM creates for each Event two Event trigger methods.
+There are two modes how Events can be triggered, which is embedded and delayed:
+
+
+ - The FSM:Event() creates an Event that will be processed embedded or immediately.
+ - The FSM:__Event( seconds ) creates an Event that will be processed delayed over time, waiting x seconds.
+
+
+

+
+
1.1) Define the FSM Rules
+
+
The FSM can be defined by using 3 methods:
+
+
+ - FSM.SetStartState(): Define the Start State of the FSM. This is the State the FSM will have when nothing is processed yet.
+ - FSM.AddTransition(): Adds a new possible Transition Rule to the FSM. A Transition will change the State of the FSM upon the defined triggered Event.
+ - FSM.AddProcess(): Adds a new Sub-Process FSM to the FSM. A Sub-Process will start the Sub-Process of the FSM upon the defined triggered Event, with multiple possible States as a result.
+
+
+
+
+
API CHANGE HISTORY
+
+
The underlying change log documents the API changes. Please read this carefully. The following notation is used:
+
+
+ - Added parts are expressed in bold type face.
+ - Removed parts are expressed in italic type face.
+
+
+
YYYY-MM-DD: CLASS:NewFunction( Params ) replaces CLASS:OldFunction( Params )
+YYYY-MM-DD: CLASS:NewFunction( Params ) added
+
+
Hereby the change log:
+
+
+ - 2016-12-18: Released.
+
+
+
+
+
AUTHORS and CONTRIBUTIONS
+
+
Contributions:
+
+
+
+
Authors:
+
+
+ - FlightControl: Design & Programming
+
-
1.1) Add or remove objects from the FSM
Global(s)
diff --git a/docs/Documentation/Spawn.html b/docs/Documentation/Spawn.html
index a4652532b..6017f8d4d 100644
--- a/docs/Documentation/Spawn.html
+++ b/docs/Documentation/Spawn.html
@@ -89,6 +89,7 @@
+
The #SPAWN class allows to spawn dynamically new groups, based on pre-defined initialization settings, modifying the behaviour when groups are spawned.
For each group to be spawned, within the mission editor, a group has to be created with the "late activation flag" set. We call this group the "Spawn Template" of the SPAWN object.
A reference to this Spawn Template needs to be provided when constructing the SPAWN object, by indicating the name of the group within the mission editor in the constructor methods.
@@ -116,6 +117,7 @@ Groups will follow the following naming structure when spawned at run-time:
1.1) SPAWN construction methods
+
Create a new SPAWN object with the SPAWN.New() or the SPAWN.NewWithAlias() methods:
@@ -128,6 +130,7 @@ The initialization methods will modify this list of groups so that when a group
So in principle, the group list will contain all parameters and configurations after initialization, and when groups get actually spawned, this spawning can be done quickly and efficient.
1.2) SPAWN initialization methods
+
A spawn object will behave differently based on the usage of initialization methods, which all start with the Init prefix:
@@ -142,6 +145,7 @@ So in principle, the group list will contain all parameters and configurations a
1.3) SPAWN spawning methods
+
Groups can be spawned at different times and methods:
@@ -159,6 +163,7 @@ So in principle, the group list will contain all parameters and configurations a
You can use the GROUP object to do further actions with the DCSGroup.
1.4) Retrieve alive GROUPs spawned by the SPAWN object
+
The SPAWN class administers which GROUPS it has reserved (in stock) or has created during mission execution.
Every time a SPAWN object spawns a new GROUP object, a reference to the GROUP object is added to an internal table of GROUPS.
SPAWN provides methods to iterate through that internal GROUP object reference table:
@@ -173,6 +178,7 @@ SPAWN provides methods to iterate through that internal GROUP object reference t
The method SPAWN.GetGroupFromIndex() will return the GROUP object reference from the given Index, dead or alive...
1.5) SPAWN object cleaning
+
Sometimes, it will occur during a mission run-time, that ground or especially air objects get damaged, and will while being damged stop their activities, while remaining alive.
In such cases, the SPAWN object will just sit there and wait until that group gets destroyed, but most of the time it won't,
and it may occur that no new groups are or can be spawned as limits are reached.
@@ -184,6 +190,7 @@ This models AI that has succesfully returned to their airbase, to restart their
Check the SPAWN.InitCleanUp() for further info.
1.6) Catch the Group spawn event in a callback function!
+
When using the SpawnScheduled method, new Groups are created following the schedule timing parameters.
When a new Group is spawned, you maybe want to execute actions with that group spawned at the spawn event.
To SPAWN class supports this functionality through the SPAWN.OnSpawnGroup( *function( SpawnedGroup ) end * ) method, which takes a function as a parameter that you can define locally.
@@ -297,7 +304,7 @@ A coding example is provided at the description of the
-
Global(s)
@@ -2496,7 +2502,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
- When the first Spawn executes, all the Groups need to be made visible before start.
+ Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.
diff --git a/docs/Documentation/index.html b/docs/Documentation/index.html
index 27ad96c3c..c9d4166e0 100644
--- a/docs/Documentation/index.html
+++ b/docs/Documentation/index.html
@@ -255,7 +255,7 @@
| Fsm |
- This module contains the FSM class.
+This module contains the FSM class and derived FSM_ classes.
|
diff --git a/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia1.JPG b/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia1.JPG
new file mode 100644
index 000000000..61217a2e1
Binary files /dev/null and b/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia1.JPG differ
diff --git a/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia2.JPG b/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia2.JPG
new file mode 100644
index 000000000..442d4c0e3
Binary files /dev/null and b/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia2.JPG differ
diff --git a/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia3.JPG b/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia3.JPG
new file mode 100644
index 000000000..6aac8cbc0
Binary files /dev/null and b/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia3.JPG differ
diff --git a/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia4.JPG b/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia4.JPG
new file mode 100644
index 000000000..54b039046
Binary files /dev/null and b/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia4.JPG differ
diff --git a/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia5.JPG b/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia5.JPG
new file mode 100644
index 000000000..5341ffd0d
Binary files /dev/null and b/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia5.JPG differ
diff --git a/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia6.JPG b/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia6.JPG
new file mode 100644
index 000000000..cfa208b57
Binary files /dev/null and b/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia6.JPG differ
diff --git a/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia7.JPG b/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia7.JPG
new file mode 100644
index 000000000..6ac282097
Binary files /dev/null and b/docs/Presentations/MOOSE - FSM - 1. Concepts/Dia7.JPG differ