Banner Image

Module Functional.Tiresias

Functional - TIRESIAS - manages AI behaviour.


The #TIRESIAS class is working in the back to keep your large-scale ground units in check.

Features:

  • Designed to keep CPU and Network usage lower on missions with a lot of ground units.
  • Does not affect ships to keep the Navy guys happy.
  • Does not affect OpsGroup type groups.
  • Distinguishes between SAM groups, AAA groups and other ground groups.
  • Exceptions can be defined to keep certain actions going.
  • Works coalition-independent in the back
  • Easy setup.

Missions:

TIRESIAS


Author : *applevangelist *

Global(s)

Global TIRESIAS

Tiresias, Greek demi-god and shapeshifter, blinded by the Gods, works as oracle for you. (Wiki)


TIRESIAS Concept

  • Designed to keep CPU and Network usage lower on missions with a lot of ground units.
#TIRESIAS TIRESIAS

Tiresias, Greek demi-god and shapeshifter, blinded by the Gods, works as oracle for you. (Wiki)


TIRESIAS Concept

  • Designed to keep CPU and Network usage lower on missions with a lot of ground units.
  • Does not affect ships to keep the Navy guys happy.
  • Does not affect OpsGroup type groups.
  • Distinguishes between SAM groups, AAA groups and other ground groups.
  • Exceptions can be defined in SET_GROUP objects to keep certain actions going.
  • Works coalition-independent in the back
  • Easy setup.

Setup

Setup is a one-liner:

     local blinder = TIRESIAS:New()

Optionally you can set up exceptions, e.g. for convoys driving around

     local exceptionset = SET_GROUP:New():FilterCoalitions("red"):FilterPrefixes("Convoy"):FilterStart()
     local blinder = TIRESIAS:New()
     blinder:AddExceptionSet(exceptionset)

Options

     -- Setup different radius for activation around helo and airplane groups (applies to AI and humans)
     blinder:SetActivationRanges(10,25) -- defaults are 10, and 25

     -- Setup engagement ranges for AAA (non-advanced SAM units like Flaks etc) and if you want them to be AIOff
     blinder:SetAAARanges(60,true) -- defaults are 60, and true

Type(s)

Fields and Methods inherited from TIRESIAS Description

TIRESIAS.AAARange

TIRESIAS.AAASet

TIRESIAS:AddExceptionSet(Set)

[USER] Add a SET_GROUP of GROUP objects as exceptions.

TIRESIAS.ClassName

TIRESIAS.Coalition

TIRESIAS.ExceptionSet

TIRESIAS.FlightSet

TIRESIAS.GroundSet

TIRESIAS.HeloSwitchRange

TIRESIAS.Interval

TIRESIAS:New()

[USER] Create a new Tiresias object and start it up.

TIRESIAS.OpsGroupSet

TIRESIAS.PlaneSwitchRange

TIRESIAS.SAMSet

TIRESIAS:SetAAARanges(FiringRange, SwitchAAA)

[USER] Set AAA Ranges - AAA equals non-SAM systems which qualify as AAA in DCS world.

TIRESIAS:SetActivationRanges(HeloMiles, PlaneMiles)

[USER] Set activation radius for Helos and Planes in Nautical Miles.

TIRESIAS:Start()

Triggers the FSM event "Start".

TIRESIAS:Stop()

Triggers the FSM event "Stop".

TIRESIAS.SwitchAAA

TIRESIAS.VehicleSet

TIRESIAS:_EventHandler(EventData)

[INTERNAL] Event handler function

TIRESIAS._FilterAAA(Group)

[INTERNAL] Filter Function

TIRESIAS._FilterNotAAA(Group)

[INTERNAL] Filter Function

TIRESIAS._FilterNotSAM(Group)

[INTERNAL] Filter Function

TIRESIAS._FilterSAM(Group)

[INTERNAL] Filter Function

TIRESIAS:_InitGroups()

[INTERNAL] Init Groups

TIRESIAS:_SwitchOnGroups(group, radius)

[INTERNAL] Switch Groups Behaviour

TIRESIAS:__Start(delay)

Triggers the FSM event "Start" after a delay.

TIRESIAS:__Stop(delay)

Triggers the FSM event "Stop" after a delay.

TIRESIAS.debug

TIRESIAS.lid

TIRESIAS:onafterStart(From, Event, To)

[INTERNAL] FSM Function

TIRESIAS:onafterStatus(From, Event, To)

[INTERNAL] FSM Function

TIRESIAS:onafterStop(From, Event, To)

[INTERNAL] FSM Function

TIRESIAS:onbeforeStatus(From, Event, To)

[INTERNAL] FSM Function

TIRESIAS.version

Fields and Methods inherited from FSM Description

TIRESIAS:AddEndState(State)

Adds an End state.

TIRESIAS:AddProcess(From, Event, Process, ReturnEvents)

Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.

TIRESIAS:AddScore(State, ScoreText, Score)

Adds a score for the FSM to be achieved.

TIRESIAS:AddScoreProcess(From, Event, State, ScoreText, Score)

Adds a score for the FSM_PROCESS to be achieved.

TIRESIAS:AddTransition(From, Event, To)

Add a new transition rule to the FSM.

TIRESIAS.CallScheduler

TIRESIAS.Events

TIRESIAS:GetCurrentState()

Get current state.

TIRESIAS:GetEndStates()

Returns the End states.

TIRESIAS:GetProcess(From, Event)

TIRESIAS:GetProcesses()

Returns a table of the SubFSM rules defined within the FSM.

TIRESIAS:GetScores()

Returns a table with the scores defined.

TIRESIAS:GetStartState()

Returns the start state of the FSM.

TIRESIAS:GetState()

Get current state.

TIRESIAS:GetSubs()

Returns a table with the Subs defined.

TIRESIAS:GetTransitions()

Returns a table of the transition rules defined within the FSM.

TIRESIAS:Is(State)

Check if FSM is in state.

TIRESIAS:LoadCallBacks(CallBackTable)

Load call backs.

TIRESIAS:New()

Creates a new FSM object.

TIRESIAS.Scores

TIRESIAS:SetProcess(From, Event, Fsm)

TIRESIAS:SetStartState(State)

Sets the start state of the FSM.

TIRESIAS._EndStates

TIRESIAS._EventSchedules

TIRESIAS._Processes

TIRESIAS._Scores

TIRESIAS._StartState

TIRESIAS._Transitions

TIRESIAS:_add_to_map(Map, Event)

Add to map.

TIRESIAS:_call_handler(step, trigger, params, EventName)

Call handler.

TIRESIAS:_create_transition(EventName)

Create transition.

TIRESIAS:_delayed_transition(EventName)

Delayed transition.

TIRESIAS:_eventmap(Events, EventStructure)

Event map.

TIRESIAS:_gosub(ParentFrom, ParentEvent)

Go sub.

TIRESIAS:_handler(EventName, ...)

Handler.

TIRESIAS:_isendstate(Current)

Is end state.

TIRESIAS:_submap(subs, sub, name)

Sub maps.

TIRESIAS:can(e)

Check if can do an event.

TIRESIAS:cannot(e)

Check if cannot do an event.

TIRESIAS.current

TIRESIAS.endstates

TIRESIAS:is(State, state)

Check if FSM is in state.

TIRESIAS.options

TIRESIAS.subs

  • TIRESIAS class, extends Core.Base#BASE

Field(s)

Function(s)

[USER] Add a SET_GROUP of GROUP objects as exceptions.

Can be done multiple times. Does not work work for GROUP objects spawned into the SET after start, i.e. the groups need to exist in the game already.

Defined in:

TIRESIAS

Parameter:

to add to the exception list.

Return value:

self

[USER] Create a new Tiresias object and start it up.

Defined in:

TIRESIAS

Return value:

self

[USER] Set AAA Ranges - AAA equals non-SAM systems which qualify as AAA in DCS world.

Defined in:

TIRESIAS

Parameters:

#number FiringRange

The engagement range that AAA units will be set to. Can be 0 to 100 (percent). Defaults to 60.

#boolean SwitchAAA

Decide if these system will have their AI switched off, too. Defaults to true.

Return value:

self

[USER] Set activation radius for Helos and Planes in Nautical Miles.

Defined in:

TIRESIAS

Parameters:

#number HeloMiles

Radius around a Helicopter in which AI ground units will be activated. Defaults to 10NM.

#number PlaneMiles

Radius around an Airplane in which AI ground units will be activated. Defaults to 25NM.

Return value:

self

Triggers the FSM event "Start".

Starts TIRESIAS and all its event handlers. Note - :New() already starts the instance.

Defined in:

TIRESIAS

Triggers the FSM event "Stop".

Stops TIRESIAS and all its event handlers.

Defined in:

TIRESIAS

[INTERNAL] Event handler function

Defined in:

TIRESIAS

Parameter:

Return value:

self

[INTERNAL] Filter Function

Defined in:

TIRESIAS

Parameter:

Return value:

#boolean:

isin

[INTERNAL] Filter Function

Defined in:

TIRESIAS

Parameter:

Return value:

#boolean:

isin

[INTERNAL] Filter Function

Defined in:

TIRESIAS

Parameter:

Return value:

#boolean:

isin

[INTERNAL] Filter Function

Defined in:

TIRESIAS

Parameter:

Return value:

#boolean:

isin

[INTERNAL] Init Groups

Defined in:

TIRESIAS

Return value:

self

[INTERNAL] Switch Groups Behaviour

Defined in:

TIRESIAS

Parameters:

#number radius

Radius in NM

Return value:

self

Triggers the FSM event "Start" after a delay.

Starts TIRESIAS and all its event handlers. Note - :New() already starts the instance.

Defined in:

TIRESIAS

Parameter:

#number delay

Delay in seconds.

Triggers the FSM event "Stop" after a delay.

Stops TIRESIAS and all its event handlers.

Defined in:

TIRESIAS

Parameter:

#number delay

Delay in seconds.

[INTERNAL] FSM Function

Defined in:

TIRESIAS

Parameters:

#string From

#string Event

#string To

Return value:

self

[INTERNAL] FSM Function

Defined in:

TIRESIAS

Parameters:

#string From

#string Event

#string To

Return value:

self

[INTERNAL] FSM Function

Defined in:

TIRESIAS

Parameters:

#string From

#string Event

#string To

Return value:

self

[INTERNAL] FSM Function

Defined in:

TIRESIAS

Parameters:

#string From

#string Event

#string To

Return value:

self

Field(s)

Function(s)

Adds an End state.

Defined in:

Parameter:

#string State

The FSM state.

Set the default #FSM_PROCESS template with key ProcessName providing the ProcessClass and the process object when it is assigned to a Wrapper.Controllable by the task.

Defined in:

Parameters:

#table From

Can contain a string indicating the From state or a table of strings containing multiple From states.

#string Event

The Event name.

An sub-process FSM.

#table ReturnEvents

A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM.

Return value:

The SubFSM.

Adds a score for the FSM to be achieved.

Defined in:

Parameters:

#string State

is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).

#string ScoreText

is a text describing the score that is given according the status.

#number Score

is a number providing the score of the status.

Return value:

#FSM:

self

Adds a score for the FSM_PROCESS to be achieved.

Defined in:

Parameters:

#string From

is the From State of the main process.

#string Event

is the Event of the main process.

#string State

is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).

#string ScoreText

is a text describing the score that is given according the status.

#number Score

is a number providing the score of the status.

Return value:

#FSM:

self

Add a new transition rule to the FSM.

A transition rule defines when and if the FSM can transition from a state towards another state upon a triggered event.

Defined in:

Parameters:

#table From

Can contain a string indicating the From state or a table of strings containing multiple From states.

#string Event

The Event name.

#string To

The To state.

Get current state.

Defined in:

Return value:

#string:

Current FSM state.

Returns the End states.

Defined in:

Return value:

#table:

End states.

Defined in:

Parameters:

From

Event

Returns a table of the SubFSM rules defined within the FSM.

Defined in:

Return value:

#table:

Sub processes.

Returns a table with the scores defined.

Defined in:

Return value:

#table:

Scores.

Returns the start state of the FSM.

Defined in:

Return value:

#string:

A string containing the start state.

Get current state.

Defined in:

Return value:

#string:

Current FSM state.

Returns a table with the Subs defined.

Defined in:

Return value:

#table:

Sub processes.

Returns a table of the transition rules defined within the FSM.

Defined in:

Return value:

#table:

Transitions.

Check if FSM is in state.

Defined in:

Parameter:

#string State

State name.

Return value:

#boolean:

If true, FSM is in this state.

Load call backs.

Defined in:

Parameter:

#table CallBackTable

Table of call backs.

Creates a new FSM object.

Defined in:

Return value:

#FSM:

Defined in:

Parameters:

From

Event

Fsm

Sets the start state of the FSM.

Defined in:

Parameter:

#string State

A string defining the start state.

Add to map.

Defined in:

Parameters:

#table Map

Map.

#table Event

Event table.

Call handler.

Defined in:

Parameters:

#string step

Step "onafter", "onbefore", "onenter", "onleave".

#string trigger

Trigger.

#table params

Parameters.

#string EventName

Event name.

Return value:

Value.

Create transition.

Defined in:

Parameter:

#string EventName

Event name.

Return value:

#function:

Function.

Delayed transition.

Defined in:

Parameter:

#string EventName

Event name.

Return value:

#function:

Function.

Event map.

Defined in:

Parameters:

#table Events

Events.

#table EventStructure

Event structure.

Go sub.

Defined in:

Parameters:

#string ParentFrom

Parent from state.

#string ParentEvent

Parent event name.

Return value:

#table:

Subs.

Handler.

Defined in:

Parameters:

#string EventName

Event name.

...

Arguments.

Is end state.

Defined in:

Parameter:

#string Current

Current state name.

Return values:

#table:

FSM parent.

#string:

Event name.

Sub maps.

Defined in:

Parameters:

#table subs

Subs.

#table sub

Sub.

#string name

Name.

Check if can do an event.

Defined in:

Parameter:

#string e

Event name.

Return values:

#boolean:

If true, FSM can do the event.

#string:

To state.

Check if cannot do an event.

Defined in:

Parameter:

#string e

Event name.

Return value:

#boolean:

If true, FSM cannot do the event.

Check if FSM is in state.

Defined in:

Parameters:

#string State

State name.

state

Return value:

#boolean:

If true, FSM is in this state.

Field(s)

Function(s)