semvec/pypi-packages huggingface dataset:
mindspawner 0.3.2
A Python library to use MindSpawner Game AI
License: Apache-2.0
Requires Python: >=3.6

# MindSpawner

[![PyPI version](https://badge.fury.io/py/mindspawner.svg)](https://pypi.org/project/mindspawner/)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
[![Python Versions](https://img.shields.io/pypi/pyversions/mindspawner.svg)](https://pypi.org/project/mindspawner/)

MindSpawner is a Python library that enables developers to create and control AI-powered agents for games and interactive environments. It provides an easy-to-use interface for managing AI behavior and real-time learning.

## 🚀 Features

- Simple API for integrating AI-driven agents
- WebSocket-based real-time communication
- Lightweight and efficient
- Easy to integrate with game engines and simulations

## 📦 Installation

To install MindSpawner, run the following command:

```bash
pip install mindspawner
```

Then, import it in your Python script:

```python
from mindspawner import MindSpawner
```

---

## 🎮 Adding a Game AI

To create and add a game AI, use the following code:

```python
USER_ID = ""  # Copy your "USER ID"
GAMEAI_ID = ""  # Copy your "GAMEAI ID"
gameai = MindSpawner(USER_ID, GAMEAI_ID)
```

---

## 🤖 Running an AI Agent

To send input data to a specific agent and retrieve its output:

```python
AGENT_ID = ""  # Copy your "AGENT ID"
input_data = { "input1": 100 }

action = gameai.agent(AGENT_ID, input_data)
print(action)
```

### 🔹 Key Points:
- `input_data` is any data that will be provided to the game AI.
- `action` stores the AI's response based on the given input.

---

## 📈 Updating the Game AI

### 🔹 Enhancing AI Performance
If you want to improve the AI's performance, evaluate it numerically and update it as follows:

```python
AGENT_ID = ""  # Copy your "AGENT ID"
score = 100  # Example: number of defeated enemies or goals scored
gameai.update_agent(AGENT_ID, score)
```

- `score` is an integer that evaluates the AI's performance.
- Use game-specific metrics (e.g., enemy defeats, successful actions) to assign a meaningful score.

### 🔹 Adjusting AI Behavior
If you want to fine-tune the AI’s behavior, use the web interface and click the **"Instruct"** button for the agent. You can specify behavior rules such as:

- "Avoid enemies when they get too close."
- "Maintain an aggressive playstyle."

---

## 📜 License

This project is licensed under the **Apache License 2.0** - see the [LICENSE](LICENSE) file for details.