# Play styles

The personalities bots can have, from the peaceful Neutral to the wall-building Turtler and the raiding Flanker, and how to pick one.

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

A **play style** is a bot's personality. It decides what the bot enjoys doing (mining, fighting, farming,
building walls, raiding the neighbors), how far it wanders from home, how brave it is, and what gear it's
aiming for. Two bots with different play styles dropped into the same world end up living very different
lives.

AI Players comes with five play styles. You can also [create your own](#making-your-own).

<CardGrid>
  <Card title="Neutral" icon="lucide:scale">
    The balanced all-rounder and the default. Builds a home, gathers, farms, trades and gears up to diamond. It
    never picks a fight, and only defends itself, its friends and its base.
  </Card>
  <Card title="Rusher" icon="lucide:swords">
    The fighter. Cave mines for iron, makes a shield and a bow, hunts its enemies down and holds long grudges.
    Spends little time on building beyond its first house, and once its iron kit is enchanted it takes its faction
    to the End.
  </Card>
  <Card title="Boomer" icon="lucide:pickaxe">
    The economist. Settles next to a village and trades its way up to bought armor and tools. Strip mines for
    diamonds and ancient debris, travels to the Nether and loots bastions for smithing templates. Upgrades all the
    way to netherite, then goes to the End for the dragon, the egg and an elytra.
  </Card>
  <Card title="Turtler" icon="lucide:shield">
    The homebody. Stays close to home, gears up to diamond, and turns its base into a real fortress: a cobblestone
    wall with towers and doors, lit grounds, a ring of thorny berry bushes, a lava moat, a booby-trapped decoy chest
    and two iron golems on guard.
  </Card>
  <Card title="Flanker" icon="lucide:footprints">
    The sneaky raider. Lives in a hidden base dug into a hill, gears up to diamond, and brews swiftness and
    invisibility potions from the Nether. Scouts enemy bases and waits for nightfall, then tunnels under walls or
    slips past them with ender pearls or a stolen fence post. Empties chests and leaves TNT traps behind.
  </Card>
</CardGrid>

## Neutral

`aiplayers:neutral`, the default for every new bot.

The Neutral bot does a bit of everything, with no favorites. It builds a house, keeps its stockpiles full, farms,
trades with villages it finds and works its way up to diamond tools and armor whenever it comes across exposed
diamonds (it doesn't dig a dedicated mine). It's the only style that never attacks an enemy on sight. It fights
back when attacked, protects its allies and fights enemies who walk into its base, but otherwise it leaves people
alone.

Good for: a friendly neighbor, or a helper in your own faction.

## Rusher

`aiplayers:rusher`

The Rusher wants a fight. After raising its starter hut on stone tools, it puts gear and hunting first. It cave
mines for iron and coal (falling back to a strip mine if no cave is nearby), crafts a shield and iron tools and
armor, and hunts spiders at dusk for a bow and arrows. Then it goes after its enemies. It remembers where it last
saw them for an hour and holds a grudge for half an hour. In combat it uses hit-and-run, breaks shields with an axe
and only retreats when it's quite hurt. It roams far (up to 192 blocks from home) and doesn't care much about
building beyond its first house.

It's one of the two styles that go to [the End](/ai-players/guide/the-end/). Once its iron kit is enchanted and it
has its potions and eyes of ender, it calls its faction and leads the trip, then goes back for the outer islands.

Good for: an opponent in a rival faction, or a bodyguard in yours.

## Boomer

`aiplayers:boomer`

The Boomer builds an economy. It looks for a village and settles right next to it. It gives jobless villagers a
workstation (an armorer and a toolsmith first) and protects them from monsters. If no village is nearby on day
one, it builds a starter hut first and founds its village base later.

It strip mines for diamonds, iron and gold (looking for its iron in a cave by day), keeps a hoard of diamonds and
netherite ingots, sets up an enchanting corner, farms, and trades its surplus with the villagers. While a smith sells (or could sell, once leveled) a piece
of gear it still lacks, it hoards emeralds and buys its next sword, pickaxe or armor piece instead of mining for it
([trading up](/ai-players/guide/trading/#trading-up)).

Once in diamond gear, it builds a portal and travels to [the Nether](/ai-players/guide/nether/) to strip mine
ancient debris and nether gold ore, raid a bastion for a smithing template, and upgrade its kit to full netherite.
When that kit is enchanted, it goes to [the End](/ai-players/guide/the-end/) with its faction, and later goes back
for an elytra. It's slow to anger and rarely hunts.

Good for: watching a bot build a thriving village-side base and reach endgame gear.

## Turtler

`aiplayers:turtler`

The Turtler plays it safe. It stays within 64 blocks of home and spends its time making that home safe:

- a cobblestone fortress wall two blocks high, with an overhang spiders can't climb past
- corner towers with torches, and a wooden door in the middle of each side
- torches everywhere, so nothing spawns in its yard
- a ring of sweet berry bushes outside the wall
- a lava moat along the wall's foot, once it finds a lava pool
- a decoy chest wired to TNT at the far end of its storehouse
- two iron golems it builds itself

It mines in caves for diamonds, iron (including the 72 ingots its golems need) and coal, retreats from fights early
and rarely goes hunting. If a Turtler gets robbed, it holds a grudge, hunts the thief and raids the thief's faction
back. See [Base defenses](/ai-players/guide/defenses/) for the details.

Good for: a peaceful neighbor that's hard to raid.

## Flanker

`aiplayers:flanker`

The Flanker is a sneaky raider. It roams far (up to 256 blocks from home), remembers enemies for two hours and
mines in caves up to diamond gear. When it spots a base of an enemy faction, it scouts the place instead of storming
it. It watches the owners come and go to confirm it's really a base, and remembers its chests and gates. Once in
diamond gear, it makes a quick trip to [the Nether](/ai-players/guide/nether/) (without bothering to carry spare
obsidian) so it can brew swiftness and invisibility potions.

When the odds allow (nobody looking, its gear matching the guard), it waits for dusk and prepares a stone pickaxe
and a stack of blocks. It drinks swiftness on the approach (and invisibility if unarmored), then gets in. When it
can, it digs a tunnel under the wall straight to the chest. Otherwise it goes through a gate, a gap, a fence post
stolen with a pickaxe or an ender pearl throw. It empties the chest with the best loot first, and leaves a TNT trap
on the way out if it came in above ground and carries one. If an enemy spots it, the raid is over and it sprints
home.

Apart from raids it picks almost no fights. The only things it does hunt are endermen, for the two pearls it always
keeps, and creepers, for the gunpowder in its TNT traps. If it ever gets its hands on an elytra (it doesn't go to
the End itself, but it loots whatever a chest holds), it flies its raids and its scouting
([raiding by air](/ai-players/guide/raiding/#by-air)).

Its home is a **hidden base**: a room dug into a hillside behind a sealed tunnel, with nothing standing in the open
for an enemy to find ([hidden bases](/ai-players/guide/bases/#hidden-bases)). See
[Raiding enemy bases](/ai-players/guide/raiding/) for how raids work end to end.

Good for: an enemy faction that's a real threat to your chests.

## Side by side

|                          | Neutral        | Rusher              | Boomer                   | Turtler                  | Flanker                  |
| :----------------------- | :------------- | :------------------ | :----------------------- | :----------------------- | :----------------------- |
| Loves                    | Everything equally | Gear, hunting enemies | Gathering, mining, farming, trading | Fortifying, building | Raiding, exploring, gear |
| Attacks enemies on sight | Never          | Eagerly             | Rarely                   | Rarely                   | Rarely                   |
| Gear goal                | Diamond        | Iron                | Netherite                | Diamond                  | Diamond                  |
| Visits the Nether        | No             | No                  | Yes (debris, bastions)   | No                       | Yes (potions)            |
| Goes to the End          | No             | Yes                 | Yes                      | No                       | No (flies a looted elytra) |
| Roams up to              | 128 blocks     | 192 blocks          | 160 blocks               | 64 blocks                | 256 blocks               |
| Mining                   | Only what it needs | Cave mining     | Strip mining (caves by day for iron) | Cave mining    | Cave mining              |
| Home                     | House          | House               | Next to a village        | Cobblestone fortress     | Hidden room in a hillside |
| Retreats when health is below | 50%       | 35%                 | 50%                      | 60%                      | 50%                      |

## Changing a bot's play style

Pick a style when you spawn the bot, or change it later:

```txt title="Commands"
/aiplayer spawn Ann aiplayers:rusher
/aiplayer set Ann style aiplayers:turtler
```

Run `/aiplayer profile list` to see every play style the server knows, including ones added by data packs.

A bot in a faction can also have a **role** (miner, farmer, guard or raider) that multiplies its style's weights,
so four Turtlers don't all dig four mines and farm four plots. See
[Faction roles](/ai-players/guide/factions/#faction-roles).

## Making your own

Play styles are simple JSON files in a data pack, so you can tweak the shipped ones or invent new personalities
without any coding. You could make a builder that never fights, a miner with a fortified base, a fighter that
settles next to villages, or a raider of your own design. See
[Play style files](/ai-players/reference/play-style-files/) for the format.

## Technical details

<Accordions>
  <AccordionItem title="The presets' numbers">
    | Key                    | Neutral | Rusher | Boomer | Turtler | Flanker |
    | :--------------------- | ------: | -----: | -----: | ------: | ------: |
    | `aggression`           | 0       | 0.8    | 0.1    | 0.2     | 0.3     |
    | `risk_tolerance`       | 0.5     | 0.8    | 0.3    | 0.2     | 0.9     |
    | `roaming_radius`       | 128     | 192    | 160    | 64      | 256     |
    | `grudge_minutes`       | 10      | 30     | 10     | 20      | 10 (default) |
    | `enemy_memory_minutes` | 30      | 60     | 30     | 30      | 120     |
    | `gear_goal`            | diamond | iron   | netherite | diamond | diamond |
    | `retreat_below_health` | 0.5     | 0.35   | 0.5    | 0.6     | 0.5     |
    | `nether.travel`        | false   | false  | true   | false   | true    |
    | `end.travel`           | false   | true   | true   | false   | false   |

    Weights (missing ones are 1.0):

    | Family     | Neutral | Rusher | Boomer | Turtler | Flanker |
    | :--------- | ------: | -----: | -----: | ------: | ------: |
    | `gather`   | 1.0     | 0.5    | 1.5    | 1.0     | 0.6     |
    | `mine`     | 1.0     | 0.5    | 1.5    | 0.8     | 0.5     |
    | `farm`     | 1.0     | 1.0    | 1.3    | 1.0     | 1.0     |
    | `trade`    | 1.0     | 1.0    | 1.2    | 0.5     | 1.0     |
    | `gear`     | 1.0     | 1.5    | 1.2    | 1.0     | 1.2     |
    | `build`    | 1.0     | 0.3    | 0.9    | 1.3     | 0.3     |
    | `fortify`  | 1.0     | 1.0    | 0.5    | 1.5     | 1.0     |
    | `explore`  | 1.0     | 1.0    | 0.7    | 0.3     | 1.2     |
    | `hunt`     | 1.0     | 1.5    | 0.1    | 0.2     | 0.4     |
    | `raid`     | off     | off    | 0.5    | off     | 1.5     |

    `raid` works differently from the other families. Overworld `scout` and `raid` objectives sleep unless the file
    lists the `chest_raid` tactic (and `raid` also requires an explicit `weights.raid`). `loot_bastion` in the
    Nether is weighted by `weights.raid` without needing `chest_raid`. That's how the Boomer's `raid: 0.5` sends it
    into bastions for its netherite template without ever raiding player bases, and why only the Flanker scouts or
    raids enemy factions.

    Other differences:

    - The Rusher hoards arrows, cave mines for iron and coal, has `hit_and_run` and `shield_break_with_axe` on, and
      goes to the End.
    - The Boomer hoards diamonds and netherite ingots, strip mines for `#c:ores/diamond`, `#c:ores/iron`,
      `#c:ores/gold`, `minecraft:ancient_debris` and `minecraft:nether_gold_ore` with `cave_by_day` on, travels to
      the Nether and to the End, and uses the `village_expansion` base style.
    - The Turtler hoards 72 iron ingots (two golems' worth), cave mines for diamond, iron and coal, grows only
      wheat, and has the `fortress` base style, `lighting`, the `berry_bush`, `lava` and `tnt` traps and
      `golems: 2`.
    - The Flanker hoards two ender pearls and one TNT, cave mines for diamond, iron and coal, has `hit_and_run` on,
      uses the `hidden` base style, travels to the Nether (`spare_obsidian: 0`) to brew two swiftness and two
      invisibility potions, and lists all four raid tactics (`chest_raid`, `block_theft`, `ender_pearl`,
      `tnt_trap`) plus `potions`, `invisibility` and `elytra`.

    The full files are in [Play style files](/ai-players/reference/play-style-files/#the-shipped-presets).
  </AccordionItem>
  <AccordionItem title="What aggression does">
    `aggression` (0 to 1) controls how a bot engages enemies on sight. A bot attacks an enemy it can see within
    `aggression × perception_radius` blocks (0.8 × 32 = 25.6 blocks for a Rusher on Normal difficulty). It also
    makes a bot bolder in the gear comparison (see [Combat and safety](/ai-players/guide/combat/)) and drives
    how eagerly it hunts remembered enemies. A bot with aggression 0 never engages or hunts on sight. No amount of
    aggression makes a bot attack a neutral player.
  </AccordionItem>
</Accordions>
