Difference between revisions of "BotProgramming Basics"

From Gladiabots Wiki
Jump to: navigation, search
Line 1: Line 1:
Bots can only execute one action at a time. Each bot checks its AI from left to right, searching for the first valid branch leading to an action. Bots are created using the [[AI Editor]].
+
Bots can only execute one action at a time. Each bot checks its AI from left to right, searching for the first valid branch leading to an action. Bots are created using the AI Editor.
 +
 
 +
== AI Editor ==
 +
 
 +
The AI editor is where you design and create your AIs. Each AI is structured in a top-down tree-like structure, called an AI Tree.
 +
 
 +
== AI Tree ==
 +
 
 +
The structure of every AI bot. It is comprised of branches of Nodes.
 +
 
 +
== Nodes ==
 +
 
 +
A Node is an object of the AI Tree that determines the way a bot functions . Nodes come as two types; Actions and Conditions.
 +
 
 +
=== Actions ===
 +
 
 +
Actions are the square-shaped Nodes.
 +
 
 +
=== Conditions ===
 +
 
 +
Conditions are the oval-shaped Nodes. They do not take time to be executed. If they are evaluated as True, the evaluation of the current tree goes on. If they are evaluated as False, the current tree is terminated and the next tree (if any) is evaluated.
 +
 
 +
Conditions are in syntax
 +
<code>Target(Filters)-Condition(Evaluation)</code>
 +
 
 +
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 <i>not</i> executing the action mentioned in the Condition.
 +
 
 +
NOTE:
 +
* Tagging is seen as Idle
 +
* Catch Resource is seen as Moving to Resource + Idle <code>Need Clarification</code>
 +
* Secure Resource is seen as Moving to Base + Idle <code>Need Clarification</code>
 +
* Aiming is seen as Attacking
 +
 
 +
== Connectors ==
 +
 
 +
They are always evaluated as "True". Though they do not execute any computation or action, they have an interesting, though not commonly used or advised, use.
 +
 
 +
Connectors are the GOTOs of AIs. And just like any programming language, GOTOs here too are considered "bad" code. Still, they can save you a lot of work sometimes.
 +
 
 +
== Subtrees / Sub-AIs ==
 +
 
 +
Ever have a group of Nodes that you regularly use, and the same thing is present in your AI again and again? Sub-AIs are used like Macros. You can just make an AI with the commonly used group of Nodes, and then add this as a Sub-AI in your main AI. Sub-AIs tend to improve game performance (more Nodes make the game laggier)
 +
 
 +
You can also use Sub-AIs to make Hybrids out of existing AIs. Remember, Sub-AIs are essentially AIs linking other AIs.

Revision as of 15:13, 3 October 2017

Bots can only execute one action at a time. Each bot checks its AI from left to right, searching for the first valid branch leading to an action. Bots are created using the AI Editor.

AI Editor

The AI editor is where you design and create your AIs. Each AI is structured in a top-down tree-like structure, called an AI Tree.

AI Tree

The structure of every AI bot. It is comprised of branches of Nodes.

Nodes

A Node is an object of the AI Tree that determines the way a bot functions . Nodes come as two types; Actions and Conditions.

Actions

Actions are the square-shaped Nodes.

Conditions

Conditions are the oval-shaped Nodes. They do not take time to be executed. If they are evaluated as True, the evaluation of the current tree goes on. If they are evaluated as False, the current tree is terminated and the next tree (if any) is evaluated.

Conditions are in syntax Target(Filters)-Condition(Evaluation)

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.

NOTE:

  • Tagging is seen as Idle
  • Catch Resource is seen as Moving to Resource + Idle Need Clarification
  • Secure Resource is seen as Moving to Base + Idle Need Clarification
  • Aiming is seen as Attacking

Connectors

They are always evaluated as "True". Though they do not execute any computation or action, they have an interesting, though not commonly used or advised, use.

Connectors are the GOTOs of AIs. And just like any programming language, GOTOs here too are considered "bad" code. Still, they can save you a lot of work sometimes.

Subtrees / Sub-AIs

Ever have a group of Nodes that you regularly use, and the same thing is present in your AI again and again? Sub-AIs are used like Macros. You can just make an AI with the commonly used group of Nodes, and then add this as a Sub-AI in your main AI. Sub-AIs tend to improve game performance (more Nodes make the game laggier)

You can also use Sub-AIs to make Hybrids out of existing AIs. Remember, Sub-AIs are essentially AIs linking other AIs.