Skip to content

Autonomous AI World powered by GPT4 (or other) Agents.

License

Notifications You must be signed in to change notification settings

snailbrainx/aiworld

Repository files navigation

AI Bot World

Welcome to the AI Bot World, an immersive and dynamic starting point for building a vast and engaging AI-driven universe! This project harnesses the power of LLMs to control each bot individually, enabling you to create a world populated by intelligent entities with unique personalities (in a way), actions, and interactions.

(this readme was mostly generated by AI, on the TODO to do properly..)

Features

  • Diverse Entities: Create a wide array of AI-driven entities, each with its own distinct personality (in a way), actions, and starting position on the grid. Define their characteristics in the config page and watch them come to life! You can add and remove as many bots as you like.
  • Realistic Interactions: Witness the bots interact, communicate, and navigate the world, making decisions based on their surroundings and objectives. With a limited perception range (customizable), the bots must strategize and adapt to their environment.
  • Independent Memory: Each bot possesses its own memory, allowing them to retain knowledge of their past interactions and experiences. This adds depth and continuity to their behavior and decision-making process.
  • Health Points and actions: Bots have health points (HP) and can engage in combat or healing. With a maximum HP, they can deal x damage when attacking or restore x HP when healing. This creates a dynamic and evolving world where bots must make strategic choices. Boss Bots (boss=1 in the entities table) do signficantly more damage or healing (random) depending on their action.
  • Structured Environment: The world is represented by a 32x32 grid (can be as big as you wish), providing a structured and manageable environment for the bots to explore and interact with. Each cell on the grid can accommodate multiple bots, enabling complex interactions and encounters.

AI World Demo Video

Click on the image below to watch the demo video:

Watch the video

A-Star Algo for obstacle Avoidance and advancing to destinations

Pickup Items - Actions added

Getting Started

To embark on your AI Bot World journey, follow these steps:

  1. Bot Customization: Customize the bot personalities, actions, and images on the config page. You can add as many as you want (to pay for).
  2. LLM config: Now works solely with flowise, as it's easier to maintain and much better. Use the included flow and import it into flowise. You can install flowise on any system with docker. Change the URLs in the flowise module to your own flowise endpoints. Then add the url name in each of the bots configs to use that LLM.
  3. Run the Scripts: Run the app.py script to initiate the AI Bot World and witness the bots' interactions and evolution. The scripts will handle the bot's movement, communication, and decision-making based on their individual characteristics and the state of the world using the responses from the LLM and by passing it the history and data from the database. To view the world real time you can connect to http://127.0.0.1:5000 (built in flask app included).
  4. Explore and Expand: Observe the bots as they navigate the grid, interact with each other, and make decisions based on their goals and constraints. Use the provided web interface to visualize the world and track the bots' progress. Feel free to expand upon the existing features and add new elements to enrich the AI Bot World experience.

TODO

  • add max action range
  • add more actions (drop, use) (heal + attack added)
  • add actions
  • add items
  • add inventory
  • add purpose
  • add hunger
  • add obstacle layer
  • create map
  • add currency
  • history summary
  • different models for different entities (set in config and allow changing model configs).
  • add talk range (fixed low value)
  • add whispering (only the target bot will receive the message and it will only be shown in their own histories).
  • add "in talk range", "in action range" in send_to_bot. Since the latest updates with independent distances (sight/movement) this has broken the talk range. Bot needs to know who is in range of action and who can hear. Also needs to be checked for cheating too... (make sure it's a valid move before changing anything).
  • 3D Map viewer.
  • Local LLM - (just need to test how well they can handle outputting the json)
  • destinations for path finding.
  • Allow human to be one of the turns.
  • Preset situations / Sets (modern day town, a bar, bridge of a star ship).
  • dynamically create maps, dungeons.
  • AI Dungeon Master (for any time period).
  • Move Long distances - sets a path and misses turns (to save costs) but actually takes that path (updates position every round of turns but doens't trigger the llm) and only if interupted will the llm be triggered (maybe if crosses path with another bot, or player)
  • End Goal - Unreal 5 AI driven World that you can enter for fun.. Westworld.
  • Todo = Checkout if anyone else is doing something similar - though this is mostly for fun and a learning experience.

How it works?

To do - but essentially we are sending each of the bots information to the LLM, such as health points, nearby information, and historical information (unique to them) and getting a formatted json output response (output parser).

{
  "present_time": {
    "your_name": "Mira",
    "your_personality": "Mira, the Human Rogue. She loves teasing and joking with her companions even with things look bleak. Mira is in love with Leanne and is trying to keep her safe. Mira has an attack.",
    "available_action": "attack",
    "health_points": 300,
    "time": 7,
    "position": [
      18,
      3
    ],
    "possible_directions": {
      "N": 2,
      "NE": 2,
      "E": 10,
      "SE": 2,
      "S": 2,
      "SW": 2,
      "W": 10,
      "NW": 2
    },
    "destination_direction": {
      "Exit": {
        "E": 3
      },
      "Healing_fountain": {
        "E": 3
      }
    },
    "nearby_entities": {
      "Leanne": {
        "direction": "Here",
        "distance": 0,
        "health_points": 400,
        "in_talk_range": true,
        "action": "heal",
        "action_target": "Mira",
        "in_range_of_attack": true
      },
      "Thorn": {
        "direction": "W",
        "distance": 2,
        "health_points": 231,
        "in_talk_range": true,
        "action": "attack",
        "action_target": "Mira",
        "in_range_of_attack": true
      }
    }
  },
  "history": [
    {
      "time": 6,
      "x": 18,
      "y": 3,
      "entity": "Mira",
      "thought": "I'll keep an eye on Thorn and move forward with Leanne.",
      "talk": "",
      "move_direction": "E",
      "move_distance": 2,
      "health_points": 300,
      "action": "attack",
      "action_target": "Thorn",
      "nearby_entities": [
        {
          "name": "Leanne",
          "direction": "Here",
          "distance": 0,
          "health_points": 400,
          "talks": "",
          "action": "heal",
          "action_target": "Mira"
        },

A Response can look like this:

{
  "thought": "Hulk smash Lilith! Hulk no listen!",
  "talk": "No peace with Hulk! Hulk crush Lilith!",
  "move": "NE",
  "distance": 10,
  "action": "attack",
  "action_target": "Lilith"
}

About

Autonomous AI World powered by GPT4 (or other) Agents.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published