Difference between revisions of "Conditions and actions"

From Gladiabots Wiki
Jump to: navigation, search
Line 5: Line 5:
 
[[File:Actions vs conditions.png|thumb|A target can be shared between action and condition nodes.]]
 
[[File:Actions vs conditions.png|thumb|A target can be shared between action and condition nodes.]]
  
{{Warning|The rest of the page is a work in progress.}}
+
Both condition nodes and action nodes are mainly defined by a target and share almost the same evaluation process:
  
Conditions and actions share almost the same evaluation process:
+
{|class="wikitable"
 +
!width="4%"|Step!!width="48%"|Condition node!!width="48%"|Action node
 +
|-
 +
|valign="top"            |1.||{{C}} colspan="2"|'''Get all the entities''' of the <code>target type</code>.
 +
|-
 +
|valign="top"            |2.||{{C}} colspan="2"|'''Remove all entities not matching''' the <code>target filters</code>. If there is not a single entity left the node is considered invalid.
 +
|-
 +
|valign="top" rowspan="2"|3.||{{C}} colspan="2"|'''Select the best entity''' according to the <code>target selector</code>.
 +
|-
 +
|The <code>any</code> and <code>all</code> selectors are special cases where all remaining entities are selected in step 3.
 +
|The <code>any</code> and <code>all</code> selectors are not allowed for action targeting.
 +
|-
 +
|valign="top" rowspan="3"|4.
 +
|'''Check the condition on the remaining entity.'''
 +
|'''Execute the action upon the remaining entity.'''
 +
|-
 +
|<code>Any</code> selector: Check if the condition is valid for at least one of the entities.
 +
|
 +
|-
 +
|<code>All</code> selector: Check if the condition is valid for all of the entities.
 +
|
 +
|}
  
Conditions follow these steps:
+
{{Information|Condition nodes: '''Checking the condition is the very last step''' after filtering and selecting took place.}}
  
# get all the entities of the <target type>
+
{{Warning|The rest of the page is a work in progress.}}
# only keep the entities matching the <target filters>
+
#* if no entity is returned by previous step, condition is considered invalid
+
# select the best entity according to the <target selector> ("any" is a special case where you keep all the entities from previous step)
+
# check the condition on the remaining entity(ies) (for "any" selector, node is valid if the condition is valid on at least one of the entities)
+
  
Actions follow these steps:
 
 
# get all the entities of the <target type>
 
# only keep the entities matching the <target filters>
 
#* if no entity is returned by previous step, action is considered invalid
 
# select the best entity according to the <target selector> ("any" is not allowed for action targeting)
 
# if action is possible, execute it
 
 
{{Information|Filters are actually applied '''before''' checking the condition.}}
 
  
 
=== Thoughts to include into this page ===
 
=== Thoughts to include into this page ===
 
Conditions are in syntax
 
<code>Target(Filters)-Condition(Evaluation)</code>
 
  
 
Target - The type of Gladiabots Entity (Ally, Enemy, AllyBase, EnemyBase, Resource) to be checked
 
Target - The type of Gladiabots Entity (Ally, Enemy, AllyBase, EnemyBase, Resource) to be checked
Line 37: Line 42:
 
Evaluation - Checking the [Invert] check box makes the Condition evaluate True if the filtered Target is <i>not</i> executing the action mentioned in the Condition.
 
Evaluation - Checking the [Invert] check box makes the Condition evaluate True if the filtered Target is <i>not</i> executing the action mentioned in the Condition.
  
* [https://forum.gladiabots.com/viewtopic.php?f=22&t=126#p1083 Filters and Conditions]
 
 
* [https://forum.gladiabots.com/viewtopic.php?f=22&t=126&p=1087#p1087 explanation of conditions and, similarly, actions]
 
* [https://forum.gladiabots.com/viewtopic.php?f=22&t=126&p=1087#p1087 explanation of conditions and, similarly, actions]
 
* [https://forum.gladiabots.com/viewtopic.php?f=3&t=562&p=6427#p6422 action filters]
 
* [https://forum.gladiabots.com/viewtopic.php?f=3&t=562&p=6427#p6422 action filters]
* [https://forum.gladiabots.com/viewtopic.php?f=8&t=743 any and all]
 
 
* [https://forum.gladiabots.com/viewtopic.php?f=3&t=150&p=1469#p1465 how robots are chosen when more than one robot respect the filters and the conditions in an action or a condition]
 
* [https://forum.gladiabots.com/viewtopic.php?f=3&t=150&p=1469#p1465 how robots are chosen when more than one robot respect the filters and the conditions in an action or a condition]
 
* [https://forum.gladiabots.com/viewtopic.php?f=6&t=236&p=2468#p2465 filter options within a category are in "or" between them, not "and"]
 
* [https://forum.gladiabots.com/viewtopic.php?f=6&t=236&p=2468#p2465 filter options within a category are in "or" between them, not "and"]

Revision as of 02:32, 28 October 2017

Information.png This page needs improvement, you are welcome to contribute.

Basics

A target can be shared between action and condition nodes.

Both condition nodes and action nodes are mainly defined by a target and share almost the same evaluation process:

Step Condition node Action node
1. Get all the entities of the target type.
2. Remove all entities not matching the target filters. If there is not a single entity left the node is considered invalid.
3. Select the best entity according to the target selector.
The any and all selectors are special cases where all remaining entities are selected in step 3. The any and all selectors are not allowed for action targeting.
4. Check the condition on the remaining entity. Execute the action upon the remaining entity.
Any selector: Check if the condition is valid for at least one of the entities.
All selector: Check if the condition is valid for all of the entities.
Information.png Condition nodes: Checking the condition is the very last step after filtering and selecting took place.
Warning.png The rest of the page is a work in progress.


Thoughts to include into this page

Target - The type of Gladiabots Entity (Ally, Enemy, AllyBase, EnemyBase, Resource) to be checked Filters - Criteria that the target has to meet Condition - Action that the Target is executing Evaluation - Checking the [Invert] check box makes the Condition evaluate True if the filtered Target is not executing the action mentioned in the Condition.