# Managing bots

Change a bot's settings, decide what happens when it dies, and retire or delete it.

import { AccordionItem, Accordions } from '@prosefly/astro-components';

Server operators manage bots with the `/aiplayer` command (or `/aip`). This page covers everyday management, and the
[commands reference](/ai-players/reference/commands/) lists every option.

## Changing a bot's settings

You can change most things about a bot while it's playing, with `/aiplayer set`:

| Command                                          | What it changes |
| :----------------------------------------------- | :-------------- |
| `/aiplayer set Steve style aiplayers:boomer`     | Its [play style](/ai-players/guide/play-styles/). |
| `/aiplayer set Steve difficulty aiplayers:hard`  | Its [difficulty](/ai-players/guide/difficulty/). |
| `/aiplayer set Steve faction red`                | Its [faction](/ai-players/guide/factions/) (`none` to leave it). |
| `/aiplayer set Steve role guard`                 | Its [role in the faction](/ai-players/guide/factions/#faction-roles): `miner`, `farmer`, `guard`, `raider` or `free`. |
| `/aiplayer set Steve skin Technoblade`           | Its skin, copied from any Minecraft account (`default` for the default skin). This also deletes a custom skin uploaded from the [client add-on](/ai-players/guide/client-add-on/#custom-skins); `set Steve custom_skin none` deletes only that. |
| `/aiplayer set Steve respawn permadeath`         | What happens when it dies (see below). |
| `/aiplayer set Steve cheats true`                | Whether it gets its difficulty's [cheats](/ai-players/guide/difficulty/#cheats). |

## When a bot dies

A bot that dies drops its items, shows a death message and, by default, respawns a few seconds later at its bed
or at the world spawn, like you would. Its memory, faction, role, base and orders survive the death, and
it walks back for what it dropped when the spot is close enough.

You can change this per bot:

- **`respawn`**: the bot comes back after dying (the default).
- **`permadeath`**: the bot dies for good. It's retired (see below) instead of respawning.
- **`inherit`**: the bot follows the server-wide default from the
  [server configuration](/ai-players/reference/server-config/).

:::warning[Hardcore worlds]
In hardcore, a bot that respawns becomes a spectator, like a real player would. Set your bots to `permadeath`
on hardcore worlds.
:::

## Retiring, bringing back and deleting bots

| Command                          | What happens |
| :------------------------------- | :----------- |
| `/aiplayer remove Steve`         | Steve leaves the game and is **retired**. It stays in `/aiplayer list`, with its inventory, memory and faction kept. |
| `/aiplayer respawn Steve`        | Brings a retired bot back into the game, right where it left. |
| `/aiplayer remove Steve purge`   | Deletes Steve for good, including its inventory, memory, statistics, advancements and custom skin. Spawning a new Steve later creates a brand-new bot. |

:::note
Vanilla's `/kick` and `/ban` don't work on bots. Use `/aiplayer remove` instead.
:::

## How many bots can I have?

By default a server can run up to 8 bots at the same time. Server owners can change this limit in the
[server configuration](/ai-players/reference/server-config/). Every bot uses about as much server power as an
extra player, so start small and add more if your server keeps up. The AI's own time is capped per tick, and you can
tune how fast bots think with the [bot clock](/ai-players/reference/server-config/#the-bot-clock).

## How bots show up for players

- **Tab list:** bots are listed like any other player. Server owners can hide them.
- **Server list:** bots count toward the online player count, but show up as "Anonymous Player" in the hover
  list, unless the server owner changes that.
- **Player limit:** bots don't take up slots, so a full server of bots still lets real players in.
- **Advancements:** bots earn advancements like players, but their achievements aren't announced in chat.

All of these can be changed in the [server configuration](/ai-players/reference/server-config/).

## Technical details

<Accordions>
  <AccordionItem title="Skins">
    Skins are looked up from Mojang by account name in the background. They're cached in
    `config/aiplayers/skin-cache/` for `skin_cache_days` (7 by default), so servers without internet access keep
    showing them. A name that isn't a valid Minecraft account name, or a lookup that fails, falls back to the
    default skin. Without a skin argument, a bot gets one from the `default_skins` list in the config, chosen by
    hashing its name. An operator with the [client add-on](/ai-players/guide/client-add-on/#custom-skins) can also
    upload a PNG of their own for a bot. Players with the add-on see it, and vanilla clients keep seeing the Mojang
    or default skin. `info` shows `custom skin: 1a2b3c4d (slim)` while the bot wears one.
  </AccordionItem>
  <AccordionItem title="What's saved, and where">
    Inventory, position, health, hunger, experience and statistics are saved in the bot's vanilla player data
    (`<world>/playerdata/`). Everything else (the bot's settings, its memory, its base and its faction) lives in
    the world's roster (`<world>/data/aiplayers/roster.dat`). Both are saved with the world.
  </AccordionItem>
  <AccordionItem title="Changing the style of a live bot">
    The new style's numbers (weights, aggression, roaming radius, combat settings and so on) apply right away. The
    list of objectives a bot has is built when it spawns, though, so a switch to a style that adds a new kind of
    activity (like the arrow stockpile of a bow user) fully applies after the bot's next respawn or a server
    restart.
  </AccordionItem>
  <AccordionItem title="Respawn timing">
    A bot respawns `respawn_delay_ticks` after its death (60 ticks, or three seconds, by default), through the same
    "respawn" button path a real client uses. Reactivating a bot that was saved dead revives it immediately.
  </AccordionItem>
</Accordions>
