NPCS

**NPCs** or Non-Player Characters are characters that are controlled by Starship EVO.

## Overview

When players start the game, NPCs will be among some of the first beings that they will encounter. NPCs are the most common form of "life" in the Galaxy and will make up the bulk of things players will interact with in both Single Player and Multiplayer Modes.

Any character that the player is not controlling is considered an NPC. They will use similar character models and animations as the player. They will be able to use all the same crafts and equipment the player can use.

## Behavior

NPCs will perform various tasks based on their programing. *Some will be tasked with manning shops and being merchants. Some will be pirates who will be directed to attack the player on sight. It all depends on the role the game needs that particular NPC to fill*.

As of 22w33a, NPCs only exist to pilot Ships around star systems. In the future, they will have a more significant purpose. They will mostly congregate around NPC Stations and fly around them in circles. NPC ships will typically have a physical character to sit in a chair in front of the central yoke and pilot the vessel. The AI only controls ships and cannot yet drive Hovercraft.

### Spawning

NPCs will be able to fly any ship that the player can. When an AI ship spawns, it will attempt to spawn a NPC character model. The NPC will only spawn if:

* A Chair is in front of the primary Yoke.
* The chair is within 1/2 meters of the primary yoke. If there is, the game will generate a random NPC character to sit in the chair.
* The chair and yoke is placed on the same entity as the Starship Computer. Chairs and yokes placed on child entities will not generate an NPC.
* The yoke is not daisy-chained. Daisy-chained yoke setups will not generate an NPC.

Whether or not the NPC ship has a character model spawn in, after a few seconds, the NPC ship will begin to fly around.

The game does not save the positions of spawned AI ships. Upon exiting the game, all AI ships and shipwrecks will despawn. When players relog into the game world, the AI will have generated a new set of vessels to populate star systems. If the player has angered the space police, their attitude will reset.

### General AI

The AI that runs NPC-controlled ships has several general qualities:

* When the AI takes control of a ship, it will trigger the **"Is controlled"** Event Gate trigger from either the yoke or the Starship Computer.
* Vessels without adequate thrust will break the AI and won't respond to anything, even attacks.
	+ Turning on the Space Station Computer's anchor setting will have the same effect.
* The AI can make use of Boost.
* The AI can not use landing Gear
* Vessels belonging to a faction will back each other up in a fight. If one faction member is attacked, all others in the vicinity will join.
* If an AI Ship is near death, it may attempt to flee.

Ship AI Weapon usage:

* The AI will fire weapon systems regardless of what Event Gate triggers when set to: "**Is primary fire pressed,"** **"Is Hotkey 1 Pressed, "** etc.
* Ship AI does not consider Repair Beams and Mining Beams to be weapons and will not use them.
	+ The Turret AI interprets Repair Beams and Mining beams as weapons and will fire upon targets with them.

Ship AI Logic usage:

* Logic systems connected to weapon event gates will also trigger. For example, ABBA circuits that extend out a gun before firing can be used by the AI.
	+ Timer Delayed weapon systems will also work, but only if the initial trigger is an Event Gate listening to a weapon linked to the yoke.
* Event Gates that are configured to trigger when a ship uses movement modes such as boost or lightcruise will trigger when the AI uses them.

Ship AI Turret usage:

* The AI can use manually controlled Turrets.
	+ Governed by the same AI as the ship, they only target what the vessel is targeting.
* If the turret's targeting mode is **"Starship Target"** or **"Auto,"** a separate AI will run the turret alongside the ship AI.

### Passive AI

Passive AIs will fly around star systems. They will typically fly toward the nearest Station and encircle it. If the ship has Lightcruise Engines installed, the AI will use that to travel; if not, they will attempt to fly there with standard Thrusters. When they have arrived at a station there is a chance they will dock to it. They will stay docked for a few seconds before undocking and resume orbiting the station. When attacked, they will defend themselves.

### Aggressive AI

Pirates and enraged space police craft will attack players. They can be found attacking stations or spawned with the **[F8]** battle designer. Aggressive AI will attempt to fight even if the ship it controls does not have any weapons connected to Event Gates.

1. ↑ *Currently not in game*