All Projects → PrismarineJS → Mineflayer Statemachine

PrismarineJS / Mineflayer Statemachine

Licence: mit
A state machine plugin for Mineflayer to aid in designing more complex behavior trees.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Mineflayer Statemachine

Venom
Venom is the most complete javascript library for Whatsapp, 100% Open Source.
Stars: ✭ 3,457 (+10703.13%)
Mutual labels:  bot, ai
Nlpia
Examples and libraries for "Natural Language Processing in Action" book
Stars: ✭ 416 (+1200%)
Mutual labels:  bot, ai
Get Me A Date
😍 Help me get a 💘 date tonight 🌛
Stars: ✭ 228 (+612.5%)
Mutual labels:  bot, ai
Python Sc2
A StarCraft II bot api client library for Python 3
Stars: ✭ 141 (+340.63%)
Mutual labels:  bot, ai
Ailab
Experience, Learn and Code the latest breakthrough innovations with Microsoft AI
Stars: ✭ 6,896 (+21450%)
Mutual labels:  bot, ai
Eddi
Scalable Open Source Chatbot Platform. Build multiple Chatbots with NLP, Behavior Rules, API Connector, Templating. Developed in Java, provided with Docker, orchestrated with Kubernetes or Openshift.
Stars: ✭ 171 (+434.38%)
Mutual labels:  bot, ai
Intelligo
🤖 Chatbot Framework for Node.js.
Stars: ✭ 347 (+984.38%)
Mutual labels:  bot, ai
Neuro
🔮 Neuro.js is machine learning library for building AI assistants and chat-bots (WIP).
Stars: ✭ 126 (+293.75%)
Mutual labels:  bot, ai
Deeppavlov
An open source library for deep learning end-to-end dialog systems and chatbots.
Stars: ✭ 5,525 (+17165.63%)
Mutual labels:  bot, ai
Aws Lex Web Ui
Sample Amazon Lex chat bot web interface
Stars: ✭ 500 (+1462.5%)
Mutual labels:  bot, ai
Mineflayer
Create Minecraft bots with a powerful, stable, and high level JavaScript API.
Stars: ✭ 2,377 (+7328.13%)
Mutual labels:  bot, minecraft
Ecgberht
Starcraft: Brood War bot using BWAPI4J
Stars: ✭ 19 (-40.62%)
Mutual labels:  bot, ai
Pleco
A Rust-based re-write of the Stockfish Chess Engine
Stars: ✭ 137 (+328.13%)
Mutual labels:  bot, ai
Delbot
It understands your voice commands, searches news and knowledge sources, and summarizes and reads out content to you.
Stars: ✭ 191 (+496.88%)
Mutual labels:  bot, ai
Lambdaattack
Minecraft bot for servers. Currently supports stress testing. More features are planned
Stars: ✭ 133 (+315.63%)
Mutual labels:  bot, minecraft
Auto Tinder
🖖 Train an artificial intelligence to play tinder for you
Stars: ✭ 318 (+893.75%)
Mutual labels:  bot, ai
Fishingbot
1.8 - 1.16.5 Fishing bot for Minecraft
Stars: ✭ 119 (+271.88%)
Mutual labels:  bot, minecraft
Minebot
Minebot
Stars: ✭ 119 (+271.88%)
Mutual labels:  bot, minecraft
Commandcenter
Starcraft AI Bot
Stars: ✭ 456 (+1325%)
Mutual labels:  bot, ai
Behaviortree.cpp
Behavior Trees Library in C++. Batteries included.
Stars: ✭ 793 (+2378.13%)
Mutual labels:  ai, state-machine

Mineflayer-StateMachine

This project is a plugin designed for Mineflayer that adds a high level API for writing state machines. As bot AI code can grow very quickly, writing this code in a finite state machine manner can help keep the code base manageable and improve quality of bot behavior trees.


What is it?

Mineflayer-StateMachine is a plugin for Mineflayer. It aims to add a flexible and customizable state machine API on top of Mineflayer to make it easier to write and scale bots.

Writing a complex bot AI can be difficult, especially if it has to be convincing. Finite state machines make this process much eaiser by offloading the fine details into isolated modules which only serve a single function or behavior. These modules can then be connected together in a top level component to customize how these seperate modules should interact and pass around control of the bot and state machine parameters.

Showcase

Videos

Webserver Demo

Mining Demo

Getting Started

This plugin is built using Node and can be installed using:

npm install --save mineflayer-statemachine

This plugin has a relies on mineflayer-pathfinder for movement related behaviors. If these behaviors are used, this plugin must be loaded before starting the state machine object.

Simple Bot

The API for Mineflayer-StateMachine aims to be simple and intuitive, requiring minimal effort to setup a working state machine. The example below creates a three-state finite state machine which find and follow the nearest player, stopping and looking at them when they are close.

// Create your bot
const mineflayer = require("mineflayer");
const bot = mineflayer.createBot({ username: "Player" });

// Load your dependency plugins.
bot.loadPlugin(require('mineflayer-pathfinder').pathfinder);

// Import required behaviors.
const {
    StateTransition,
    BotStateMachine,
    EntityFilters,
    BehaviorFollowEntity,
    BehaviorLookAtEntity,
    BehaviorGetClosestEntity,
    NestedStateMachine } = require("mineflayer-statemachine");
    
// wait for our bot to login.
bot.once("spawn", () =>
{
    // This targets object is used to pass data between different states. It can be left empty.
    const targets = {};

    // Create our states
    const getClosestPlayer = new BehaviorGetClosestEntity(bot, targets, EntityFilters().PlayersOnly);
    const followPlayer = new BehaviorFollowEntity(bot, targets);
    const lookAtPlayer = new BehaviorLookAtEntity(bot, targets);

    // Create our transitions
    const transitions = [

        // We want to start following the player immediately after finding them.
        // Since getClosestPlayer finishes instantly, shouldTransition() should always return true.
        new StateTransition({
            parent: getClosestPlayer,
            child: followPlayer,
            shouldTransition: () => true,
        }),

        // If the distance to the player is less than two blocks, switch from the followPlayer
        // state to the lookAtPlayer state.
        new StateTransition({
            parent: followPlayer,
            child: lookAtPlayer,
            shouldTransition: () => followPlayer.distanceToTarget() < 2,
        }),

        // If the distance to the player is more than two blocks, switch from the lookAtPlayer
        // state to the followPlayer state.
        new StateTransition({
            parent: lookAtPlayer,
            child: followPlayer,
            shouldTransition: () => lookAtPlayer.distanceToTarget() >= 2,
        }),
    ];

    // Now we just wrap our transition list in a nested state machine layer. We want the bot
    // to start on the getClosestPlayer state, so we'll specify that here.
    const rootLayer = new NestedStateMachine(transitions, getClosestPlayer);
    
    // We can start our state machine simply by creating a new instance.
    new BotStateMachine(bot, rootLayer);
});

Documentation

API

Roadmap

Implemented

  • Web View
  • Look at Entity Behavior
  • Nested State Machines
  • Movement Behaviors
  • Mining/Placing Behaviors
  • Get Nearby Entities
  • Equip Items and Armor

To Do

  • Show Targets in Web View
  • Camera Controls in Web View
  • Collection-based Behaviors
  • Fighting-based Behaviors
  • Conversation-based Behaviors

License

This project uses the MIT license.

Contributions

This project is accepting PRs and Issues. See something you think can be improved? Go for it! Any and all help is highly appreciated!

For larger changes, it is recommended to discuss these changes in the issues tab before writing any code. It's also preferred to make many smaller PRs than one large one, where applicable.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].