Decision Tree Package Save

An open source Unity package for creating Decision Trees with a visual editor. The package comes with some samples to help teach users how to use it and an action manager to handle executing the results of the decision tree.

Project README

banner

Decision Trees for Unity

An open source Unity package for creating Decision Trees with a visual editor. The package comes with some samples to help teach users how to use it and an action manager to handle executing the results of the decision tree. Be sure to checkout the video showcase which shows some features of the editor.

Contents

Features

Run-time Visualisation

runtime visualisation

The visual editor supports runtime visualisation where you can monitor individual trees at runtime and see which actions they are currently executing and have executed. This does require a small bit of setup but that is fully covered in the documentation of this package.

Procedural Descriptions & Titles

procedural descriptions

The visual editor will also include any descriptions you may include by overriding the GetDescription and GetSummary functions. This can help you keep track of what your nodes do at a glance without having to view the fields you have set on the node.

Real-time Erroring

realtime erroring

The visual editor also provides errors to you in real time. Since the GetDescription and GetSummary functions are called in editor, you can attach try-catch statements and check for null values in your node. You can then assign error messages to the node view's error property and have them display in the editor!

Full Flexibility

advanced node creation

Sometimes you need a node that can take other nodes as parameters. This visual editor allows you to add as many parameter nodes to your node that you want. How to do this is outlined in the documentation.

Built-in Action Manager

This package also contains a built in action manager. This is a component that you can add to your AI and it will handle executing through the action queue and running it on the AI that it is attached to through coroutines

Sample Assets

The package contains some sample assets to help you understand how to use this package in your project. Be sure to check it out with the unity package manager and read through the heavily commented sample scripts.

How to Install

There are three methods of installing this package: downloading manually, downloading with git url or downloading by name.

Download Manually

To download manually you can:

  • Clone this repository locally along with this packages dependencies(generic-helpers).
  • Open the package manager in Unity
  • Click the "+" icon and click to add package from disk
  • Click this repository that you have cloned

You should then see this package in your package manager

Download with GitURL

To download with GitURL also requires you to download dependencies locally. Currently Unity doesn't support git dependencies with git packages. This means that you need to make sure you install generic-helpers first.

To install with a GitURL you simply:

  • Open the Unity package manager
  • Click the "+" icon and click to add package from git URL
  • Paste the clone link for this repository (https://github.com/KieranCoppins/Decision-Tree-Package.git)

Remember: do the same with the generic helpers dependancy.

Download by Name

To download by name requires a bit of setup. Effectively, I am going to be re-iterating is from this forum post from step 4.

  • First, you need to log in to the git registry using a personal access token (PAK). This requires npm to be installed and make sure your PAK has packages:read permissions. You can do this by running the command: npm login --scope=@kierancoppins --registry=https://npm.pkg.github.com and entering your github username, PAK for password, and your email.

  • Next, you will need to do what is discussed here. This access token should then get placed into the .npmrc file inside your user's root (For Windows this would be C:/Users/<user>/.npmrc). Then inside this same user root location you need to create a .upmconfig.toml. The contents of this file should be:

    [npmAuth."https://npm.pkg.github.com/@kierancoppins"]
    
    token = "<AUTH TOKEN  _authToken in .npmrc)>"
    
    email = "<EMAIL>"
    
    alwaysAuth = true
    
  • Next, you need to add a scoped registry to your project's package manifest. This is locked in <project-root>/Packages/manifest.json. The scoped registry is:

    "scopedRegistries": [
        {
            "name": "Github Packages",
            "url": "https://npm.pkg.github.com/@kierancoppins",
            "scopes": [
                "com.kierancoppins"
            ]
        }
    ]
    

    Note: You can also add other git packages here too, so if by chance you already have some git packages you can just add com.kierancoppins to your git packages scope.

  • You can then choose to add the package to this json by adding "com.kierancoppins.decision-trees": "^1.0.3" to the dependencies object of the json OR by going into the unity package manager and:

    • Click the "+" icon and click to add package by name
    • Enter: com.kierancoppins.decision-trees. You can also specify a version name, otherwise it will get the latest.

The benefit from doing this is that it's very easy to update this package once its setup. Since dependencies will be downloaded automatically, it allows to use the package manager to update this package.

Open Source Agenda is not affiliated with "Decision Tree Package" Project. README Source: KieranCoppins/Decision-Tree-Package

Open Source Agenda Badge

Open Source Agenda Rating