Difference between revisions of "BotProgramming Basics"

From Gladiabots Wiki
Jump to: navigation, search
Line 6: Line 6:
  
 
[[File:Example AI.png]]
 
[[File:Example AI.png]]
 +
 +
{{Warning|Rest of the page is a work in progress.}}
  
 
The AI of a bot is shaped like an upside down tree. It can be composed of the following elements:
 
The AI of a bot is shaped like an upside down tree. It can be composed of the following elements:
  
 +
{|class="wikitable"
 +
!Element!!Description
 +
|-
 +
|Root node    ||Each AI contains exactly one root node that defines the AIs starting point. It contains the name of the AI.
 +
|-
 +
|Action node  ||If a rectangular-shaped action node is evaluated true, the described action is executed for the current tick. An action node is considered invalid if the bot {{Tooltip|cannot perform|Attacking a target in close range is invalid if there is no target in close range.}} it.
 +
|-
 +
|Condition node||
 +
|-
 +
|Connector    ||
 +
|-
 +
|Sub-AI        ||
 +
|-
 +
|Link          ||
 +
|}
 +
 +
 +
<!--
 
== ToDo ==
 
== ToDo ==
 +
The oval condition nodes
 
* Conditions (ovals)
 
* Conditions (ovals)
* Actions (rectangles)
 
 
 
If a bot is selected one can see the state of its AI.
 
 
The root node is the starting point of the AI.
 
Links: Nodes can be connected with a link.
 
 
 
Conditions are checked if the condition is valid.
 
Conditions are checked if the condition is valid.
 +
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.
  
An action is considered invalid if the bot cannot perform it. (An attack node with a target in close range is invalid if there is no target in close range.)
 
  
Branches are not executed counterclockwise but checked counterclockwise.
 
 
One can reuse an AI inside another one, by using a Sub-AI node.
 
  
 +
== Connectors ==
 
A connector node can be used to simplify the layout of the AI. A connector will always be considered valid during AI check.
 
A connector node can be used to simplify the layout of the AI. A connector will always be considered valid during AI check.
 +
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 ==
 +
One can reuse an AI inside another one, by using a Sub-AI node.
 +
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.
  
 +
Links: Nodes can be connected with a link.
  
  
 
+
If a bot is selected one can see the state of its AI.
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.
+
Branches are not executed counterclockwise but checked counterclockwise.
 +
and only elements linked to the root node can be evaluated during the execution of the AI
  
 
== AI Editor ==
 
== AI Editor ==
  
The AI editor is where you design your AIs. Each AI is structured in a top-down tree-like structure.
+
Bots are created using the AI Editor.
 +
The AI editor is where you design your AIs.
  
 
== Nodes ==
 
== Nodes ==
  
A Node is a singular object of an AI that determines the way a bot functions . Nodes come as two types; Actions and Conditions.
+
A Node is a singular object of an AI that determines the way a bot functions .
  
=== Actions ===
 
 
Actions are the square-shaped Nodes.
 
  
 
=== Conditions ===
 
=== 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
 
Conditions are in syntax
Line 66: Line 81:
 
* Aiming is seen as Attacking
 
* Aiming is seen as Attacking
  
== Connectors ==
+
Debugging.
 
+
-->
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 23:27, 18 October 2017

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

Basics

The robots in Gladiabots are autonomous and obey their Artificial Intelligence (AI). Bots can only execute one of the possible actions at a time. The AIs task is to determine what action to use in the current situation. Each bot checks its AI counterclockwise, searching for the first valid branch leading to an action.

Example AI.png

Warning.png Rest of the page is a work in progress.

The AI of a bot is shaped like an upside down tree. It can be composed of the following elements:

Element Description
Root node Each AI contains exactly one root node that defines the AIs starting point. It contains the name of the AI.
Action node If a rectangular-shaped action node is evaluated true, the described action is executed for the current tick. An action node is considered invalid if the bot cannot perform it.
Condition node
Connector
Sub-AI
Link