This commit is contained in:
Simon Kerler 2024-12-17 00:51:20 +01:00 committed by GitHub
commit c4dd87e806
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 143 additions and 149 deletions

View File

@ -0,0 +1,24 @@
.. _create_tree::
Creating Behavior Trees
=======================
This chapter describes how to create and debug behavior trees.
Add a Behavior Tree to an agent
-------------------------------
Follow these steps to add a behavior tree to a new or existing agent:
1. Make a scene file for your agent, or open an existing scene.
2. Add a :ref:`BTPlayer<class_BTPlayer>` node to your scene.
3. Select :ref:`BTPlayer<class_BTPlayer>`, and create a new behavior tree in the inspector.
4. Optionally, you can save the behavior tree to a file using the property's context menu.
5. Click the behavior tree property to open it in the LimboAI editor.
Debugging Behavior Trees
------------------------
In Godot Engine, follow to "Bottom Panel > Debugger > LimboAI" tab. With the LimboAI debugger,
you can inspect any currently active behavior tree within the running project. The debugger can be detached
from the main editor window, which can be particularly useful if you have a HiDPI or a secondary display.

View File

@ -1,7 +1,7 @@
.. _custom_tasks: .. _custom_tasks:
Creating custom tasks in GDScript Creating custom tasks
================================= =====================
By default, user tasks should be placed in the ``res://ai/tasks`` By default, user tasks should be placed in the ``res://ai/tasks``
directory. You can set an alternative location for user tasks in the directory. You can set an alternative location for user tasks in the
@ -145,3 +145,47 @@ Example 2: InRange condition
return SUCCESS return SUCCESS
else: else:
return FAILURE return FAILURE
.. _creating_tasks_in_c
Creating tasks in C#
--------------------
You can use the following script template for custom tasks:
.. code:: csharp
using Godot;
using System;
[Tool]
public partial class _CLASS_ : _BASE_
{
public override string _GenerateName()
{
return "_CLASS_";
}
public override void _Setup()
{
}
public override void _Enter()
{
}
public override void _Exit()
{
}
public override Status _Tick(double delta)
{
return Status.Success;
}
public override string[] _GetConfigurationWarnings()
{
return Array.Empty<string>();
}
}

View File

@ -21,47 +21,3 @@ Each provided build comes with a GodotSharp folder, which has packages under
Regarding GDExtension, I can only confirm success with the module version and C#. Regarding GDExtension, I can only confirm success with the module version and C#.
Unfortunately, I haven't had any luck with the GDExtension version yet. Unfortunately, I haven't had any luck with the GDExtension version yet.
If you've had success with GDExtension, please let me know via Discord or email. If you've had success with GDExtension, please let me know via Discord or email.
Creating custom tasks in C#
---------------------------
**🛈 Note:** For more information, check out :ref:`creating custom tasks in GDScript <custom_tasks>`.
You can use the following script template for custom tasks:
.. code:: csharp
using Godot;
using System;
[Tool]
public partial class _CLASS_ : _BASE_
{
public override string _GenerateName()
{
return "_CLASS_";
}
public override void _Setup()
{
}
public override void _Enter()
{
}
public override void _Exit()
{
}
public override Status _Tick(double delta)
{
return Status.Success;
}
public override string[] _GetConfigurationWarnings()
{
return Array.Empty<string>();
}
}

View File

@ -1,31 +0,0 @@
.. _gdextension:
Using GDExtension
=================
**🛈 See also:** `What is GDExtension? <https://docs.godotengine.org/en/stable/tutorials/scripting/gdextension/what_is_gdextension.html#what-is-gdextension>`_
LimboAI can be used as either a C++ module or as a GDExtension shared library.
The module version is the most feature-full and slightly more performant, but
it requires using custom engine builds including the export templates.
**🛈 Note:** Precompiled builds are available on the official
`LimboAI GitHub <https://github.com/limbonaut/limboai#getting-limboai>`_ page.
GDExtension version is more convenient to use, as you don't need a custom engine
build. You can simply download the extension and put it inside your project.
However, it has certain limitations, described in detail in the next section.
Whichever you choose to use, remember, your project will stay compatible with
both and you can transition from one to the other any time.
Limitations of the GDExtension version
--------------------------------------
GDExtension is the most convenient way of using the LimboAI plugin, but it comes
with certain limitations.
* Built-in documentation is not available. The plugin will open online documentation instead when requested.
* Documentation tooltips are not available.
* Handy :ref:`class_BBParam` property editor is not available in the extension due to dependencies on the engine classes that are not available in the Godot API.

View File

@ -0,0 +1,48 @@
Getting LimboAI
===============
LimboAI can be used as either a C++ module or as a GDExtension shared library.
There are some differences between the two. In short, GDExtension version is more
convenient to use but somewhat limited in features. The module version is the most feature-full and slightly more performant, but it requires using custom engine builds including the export templates.
Whichever you choose to use, your project will stay compatible with both and you can switch from one to
the other any time.
Choose the version you'd like to use. The module version provides better editor
experience and performance, while the GDExtension version is more convenient to use.
If you're unsure, start with the GDExtension version.
You can change your decision at any time - both versions are fully compatible.
Get GDExtension version
------------------------
GDExtension is the most convenient way of using the LimboAI plugin, but it comes
with certain limitations:
* Built-in documentation is not available. The plugin will open online documentation instead when requested.
* Documentation tooltips are not available.
* Handy :ref:`class_BBParam` property editor is not available in the extension due to dependencies on the engine classes that are not available in the Godot API.
**🛈 See also:** `What is GDExtension? <https://docs.godotengine.org/en/stable/tutorials/scripting/gdextension/what_is_gdextension.html#what-is-gdextension>`_
Installation instructions:
1. Make sure you're using the latest stable version of the Godot editor.
2. Create a new project for your experiments with LimboAI.
3. In Godot, click AssetLib tab at the top of the screen and search for LimboAI. Download it. LimboAI plugin will be downloaded with the demo project files. Don't mind the errors printed at this point, this is due to the extension library not being loaded just yet.
4. Reload your project with `Project -> Reload project`. There shouldn't be any errors printed now.
5. In the project files, locate a scene file called `showcase.tscn` and run it. It's the demo's entry point.
Get module version
-------------------
Precompiled builds are available on the official
`LimboAI GitHub <https://github.com/limbonaut/limboai#getting-limboai>`_ page,
and in the Asset Library (coming soon!).
Installation instructions:
1. In `GitHub releases <https://github.com/limbonaut/limboai/releases/>`_, download the latest pre-compiled release build for your platform.
2. Download the demo project archive from the same release.
3. Extract the pre-compiled editor and the demo project files.
4. Launch the pre-compiled editor binary, import and open the demo project.
5. Run the project.

View File

@ -1,8 +1,8 @@
.. _hsm: .. _hsm:
State Machines Create State Machines
============== =====================
This guide will show how to set up and use a state machine using :ref:`LimboHSM<class_LimboHSM>`. This guide will show how to set up and use a state machine using :ref:`LimboHSM<class_LimboHSM>`.

View File

@ -1,9 +1,6 @@
LimboAI Documentation LimboAI Documentation
===================== =====================
About
-----
**LimboAI** is an open-source C++ module for **Godot Engine 4** providing a combination of **LimboAI** is an open-source C++ module for **Godot Engine 4** providing a combination of
**Behavior Trees** and **State Machines** for crafting your games AI. It comes with a **Behavior Trees** and **State Machines** for crafting your games AI. It comes with a
behavior tree editor, built-in documentation, visual debugger, and more! While behavior tree editor, built-in documentation, visual debugger, and more! While
@ -18,86 +15,42 @@ of agents in a game (e.g., characters, enemies, entities). They are designed to
make it easier to create complex and highly modular behaviors for your games. make it easier to create complex and highly modular behaviors for your games.
To learn more about behavior trees, check out :ref:`introduction`. To learn more about behavior trees, check out :ref:`introduction`.
**Hierarchical State Machines** are finite state machines that allow any state to host their own
Getting LimboAI sub-state machine. This allows you to tackle your AI's state and transition complexity by breaking down
--------------- one big state machine into multiple smaller ones.
Precompiled builds are available on the official
`LimboAI GitHub <https://github.com/limbonaut/limboai#getting-limboai>`_ page,
and in the Asset Library (coming soon!).
LimboAI can be used as either a C++ module or as a GDExtension shared library.
There are some differences between the two. In short, GDExtension version is more
convenient to use but somewhat limited in features. Whichever you choose to use,
your project will stay compatible with both and you can switch from one to
the other any time. For more information on this topic, see :ref:`gdextension`.
**🛈 Note:** Class reference is available in the side bar.
First steps
-----------
Choose the version you'd like to use. The module version provides better editor
experience and performance, while the GDExtension version is more convenient to use.
If you're unsure, start with the GDExtension version.
You can change your decision at any time - both versions are fully compatible.
For more information, see :ref:`gdextension`.
With GDExtension version
~~~~~~~~~~~~~~~~~~~~~~~~
1. Make sure you're using the latest stable version of the Godot editor.
2. Create a new project for your experiments with LimboAI.
3. In Godot, click AssetLib tab at the top of the screen and search for LimboAI. Download it. LimboAI plugin will be downloaded with the demo project files. Don't mind the errors printed at this point, this is due to the extension library not being loaded just yet.
4. Reload your project with `Project -> Reload project`. There shouldn't be any errors printed now.
5. In the project files, locate a scene file called `showcase.tscn` and run it. It's the demo's entry point.
With module version
~~~~~~~~~~~~~~~~~~~
1. In `GitHub releases <https://github.com/limbonaut/limboai/releases/>`_, download the latest pre-compiled release build for your platform.
2. Download the demo project archive from the same release.
3. Extract the pre-compiled editor and the demo project files.
4. Launch the pre-compiled editor binary, import and open the demo project.
5. Run the project.
Creating your own behavior trees
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Make a scene file for your agent, or open an existing scene.
2. Add a :ref:`BTPlayer<class_BTPlayer>` node to your scene.
3. Select :ref:`BTPlayer<class_BTPlayer>`, and create a new behavior tree in the inspector.
4. Optionally, you can save the behavior tree to a file using the property's context menu.
5. Click the behavior tree property to open it in the LimboAI editor.
.. toctree:: .. toctree::
:hidden: :hidden:
:maxdepth: 1 :maxdepth: 1
:caption: Getting started :caption: Getting started
getting-started/introduction getting-started/getting-limboai
getting-started/custom-tasks
getting-started/using-blackboard
getting-started/accessing-nodes
getting-started/hsm
getting-started/gdextension
getting-started/c-sharp getting-started/c-sharp
getting-started/featured-classes
getting-started/contributing getting-started/contributing
.. toctree::
:hidden:
:maxdepth: 1
:caption: Behavior Trees
behavior-trees/introduction
behavior-trees/create-tree
behavior-trees/custom-tasks
behavior-trees/using-blackboard
behavior-trees/accessing-nodes
.. toctree::
:hidden:
:maxdepth: 1
:caption: Hierarchical State MachineS
hierarchical-state-machines/create-hsm
.. toctree:: .. toctree::
:hidden: :hidden:
:maxdepth: 1 :maxdepth: 1
:caption: Class reference :caption: Class reference
:glob: :glob:
classes/featured-classes
classes/class_* classes/class_*
Debugging behavior trees
~~~~~~~~~~~~~~~~~~~~~~~~
In Godot Engine, follow to "Bottom Panel > Debugger > LimboAI" tab. With the LimboAI debugger,
you can inspect any currently active behavior tree within the running project. The debugger can be detached
from the main editor window, which can be particularly useful if you have a HiDPI or a secondary display.