Difference between revisions of "BotProgramming Basics"

From Gladiabots Wiki
Jump to: navigation, search
Line 1: Line 1:
 
{{Information|This page needs improvement, you are welcome to contribute.}}
 
{{Information|This page needs improvement, you are welcome to contribute.}}
 +
 +
== Basics ==
 +
 +
<!--
 +
 +
The robots in ''Gladiabots'' are autonomous and obey their Artificial Intelligence (AI).
 +
 +
The AI of a robot is shaped like an upside down tree and composed of 2 kinds of nodes:
 +
* Conditions (ovals)
 +
* Actions (rectangles)
 +
 +
Bots can only execute one action at a time.
 +
 +
Each of them checks its AI counterclockwise, searching for the first valid branch leading to an action.
 +
 +
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.
 +
 +
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.
 +
 +
A connector node can be used to simplify the layout of the AI. A connector will always be considered valid during AI check.
 +
 +
-->
 +
 +
 +
  
 
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.
Line 5: Line 39:
 
== 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.
+
The AI editor is where you design your AIs. Each AI is structured in a top-down tree-like structure.
  
 
== Nodes ==
 
== Nodes ==

Revision as of 06:45, 18 October 2017

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

Basics

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 your AIs. Each AI is structured in a top-down tree-like structure.

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.

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.