Difference between revisions of "Conditions and actions"

From Gladiabots Wiki
Jump to: navigation, search
Line 19: Line 19:
 
|-
 
|-
 
|
 
|
|The <code>any</code> and <code>all</code> selectors can only be used for moving, fleeing, tagging and untagging.
+
|valign="top"|The <code>any</code> and <code>all</code> selectors can only be used for moving, fleeing, tagging and untagging.
 
|-
 
|-
 
|valign="top" rowspan="3"|4.
 
|valign="top" rowspan="3"|4.
|'''Check the condition on the selected entity.''' The invert checkbox {{Tooltip|only inverts this condition and not the result of the entire node|See an example to the right.}}.
+
|valign="top"|'''Check the condition on the selected entity.''' The invert checkbox {{Tooltip|only inverts this condition and not the result of the entire node|See an example to the right.}}.
|'''Execute the action on the selected entity.'''
+
|valign="top"|'''Execute the action on the selected entity.'''
 
|-
 
|-
|<code>Any</code> selector: Check if the condition is valid for at least one of the remaining entities.
+
|valign="top"|<code>Any</code> selector: Check if the condition is valid for at least one of the remaining entities.
|When moving or fleeing the <code>any</code> and <code>all</code> selectors result in moving to or fleeing from the [https://forum.gladiabots.com/viewtopic.php?f=2&t=950 weighted] average position of all remaining entities. There is no difference between the <code>any</code> and <code>all</code> selector.
+
|valign="top"|When moving or fleeing the <code>any</code> and <code>all</code> selectors result in moving to or fleeing from the [https://forum.gladiabots.com/viewtopic.php?f=2&t=950 weighted] average position of all remaining entities. There is no difference between the <code>any</code> and <code>all</code> selector.
 
|-
 
|-
|<code>All</code> selector: Check if the condition is valid for all of the remaining entities.
+
|valign="top"|<code>All</code> selector: Check if the condition is valid for all of the remaining entities.
|When tagging or untagging the <code>any</code> and <code>all</code> selectors result in tagging or untagging all remaining entities. There is no difference between the <code>any</code> and <code>all</code> selector.
+
|valign="top"|When tagging or untagging the <code>any</code> and <code>all</code> selectors result in tagging or untagging all remaining entities. There is no difference between the <code>any</code> and <code>all</code> selector.
 
|}
 
|}
  
Line 53: Line 53:
  
 
== Target filters ==
 
== Target filters ==
 
[[File:Target filters and or.png|thumb|none|800px|Yellow: In the filter category '''bot class''' filters are connected with '''''OR''''' (indicated by separate dots).<br>Orange: In the filter category '''tag''' filters are connected with '''''AND''''' (indicated by a line and a single dot).]]
 
  
 
Multiple filters from the same filter category are connected either with '''''OR''''' or with '''''AND''''' between them.
 
Multiple filters from the same filter category are connected either with '''''OR''''' or with '''''AND''''' between them.
Line 66: Line 64:
  
 
* Example: The enemy satisfies the '''bot class''' filters '''''AND''''' the '''tag''' filters.
 
* Example: The enemy satisfies the '''bot class''' filters '''''AND''''' the '''tag''' filters.
 +
 +
[[File:Target filters and or.png|thumb|none|800px|Yellow: In the filter category '''bot class''' filters are connected with '''''OR''''' (indicated by separate dots).<br>Orange: In the filter category '''tag''' filters are connected with '''''AND''''' (indicated by a line and a single dot).<br>Blue: The different filter categories are always connected with '''''AND''''' between them.]]
  
 
== Thoughts to include into this page ==
 
== Thoughts to include into this page ==

Revision as of 06:58, 5 November 2017

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

Basics

A target can be shared between action and condition nodes.
The invert checkbox only inverts the condition and not the result of the entire node. There is no selected enemy (Step 2) therefore "is carrying a resource" and "is not carrying a resource" makes no difference.

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 remaining entity according to the target selector. The any and all selectors are special cases where all remaining entities are selected instead.
The any and all selectors can only be used for moving, fleeing, tagging and untagging.
4. Check the condition on the selected entity. The invert checkbox only inverts this condition and not the result of the entire node. Execute the action on the selected entity.
Any selector: Check if the condition is valid for at least one of the remaining entities. When moving or fleeing the any and all selectors result in moving to or fleeing from the weighted average position of all remaining entities. There is no difference between the any and all selector.
All selector: Check if the condition is valid for all of the remaining entities. When tagging or untagging the any and all selectors result in tagging or untagging all remaining entities. There is no difference between the any and all selector.
Information.png Condition nodes: Checking the condition is the very last step after filtering and selecting took place.

Example

Consider the following condition node:

  1. Target type: Enemy
  2. Target filters: Not carrying resource
  3. Target selector: Closest to me
  4. Condition: Shield is 0 to 25%

The following situation is evaluated like this:

  1. There are 4 entities of target type enemy. Allies, resources and bases are discarded.
  2. There are 3 entities not carrying a resource. The enemy moving to his base is removed from the list.
  3. The distance between the Shotgun and the remaining 3 entities is measured. Only the closest enemy of them is selected.
  4. The condition is only checked for the remaining entity. As this enemy has full shield, the condition is evaluated invalid.
The condition node is evaluated invalid in this situation.

Target filters

Multiple filters from the same filter category are connected either with OR or with AND between them.

  • If there are separate dots on the left of each filter from the same filter category, the filters are joined with OR within that filter category.
    • Example: In the filter category bot class filters are connected with OR. If the enemy is assault class OR machine gun class.
  • If there is a line and a single dot on the left of all filters from the same filter category, the filters are joined with AND within that filter category.
    • Example: In the filter category tag filters are connected with AND. If the enemy is tagged 1 AND not tagged 2.

The different filter categories are always connected with AND between them.

  • Example: The enemy satisfies the bot class filters AND the tag filters.
Yellow: In the filter category bot class filters are connected with OR (indicated by separate dots).
Orange: In the filter category tag filters are connected with AND (indicated by a line and a single dot).
Blue: The different filter categories are always connected with AND between them.

Thoughts to include into this page

Warning.png The rest of the page is a work in progress.
  • Target filters
    • Lists of Filters per Target Type
  • Target selector
    • What a selector selects if there are several possibilities of equal value.
    • Lists of Selectors per Target Type
  • Actions
    • Lists of Actions per Target Type
  • Conditions
    • List of Conditions per Target Type (same as filters?)