<< All versions

Skill v1.0.1

currentAutomated scan100/100
gamekit-agent/gamekit-cli/adding-enemies

2 files

──Details
PublishedOctober 1, 2026 at 05:40 AM
Content Hashsha256:d9d16a3ff3665d36...
Git SHAf70d518681d7
Bump Typepatch
Compare with v1.0.0
──Files
Files (1 file, 2.7 KB)
SKILL.md2.7 KBactive
SKILL.md · 117 lines · 2.7 KB

version: "1.0.1" description: Creating enemies, NPCs, and AI-controlled characters


Adding Enemies and NPCs

Use this skill when the user wants enemies, hostile creatures, NPCs, or AI-controlled characters.

Trigger Phrases

  • "enemy", "enemies", "bad guy", "monster"
  • "NPC", "character that moves on its own"
  • "AI", "chase", "patrol", "attack"
  • "zombie", "robot", "guard", etc.

Implementation Checklist

  1. Create Enemy GameObject
  • Visual representation (often red-tinted for enemies)
  • Appropriate collider (trigger for damage zones)
  • Tag as "Enemy" for identification
  1. Add AI Behavior
  • Choose pattern based on description:
  • Chase: Move toward player
  • Patrol: Move between waypoints
  • Stationary: Turret-style, doesn't move
  • Wander: Random movement
  1. Add Combat (if applicable)
  • Health system
  • Damage dealing (trigger collider)
  • Death behavior (destroy, ragdoll, respawn)
  1. Multiplayer Setup (Normcore)
  • Add RealtimeView
  • Add RealtimeTransform
  • Consider ownership: server-authoritative or first-hit-owns
  1. Spawning
  • Create prefab in Resources/
  • Set up spawner if needed (waves, continuous)

AI Patterns

Simple Chase

csharp
void Update()
{
if (target == null) target = GameObject.FindWithTag("Player")?.transform;
if (target != null)
{
Vector3 dir = (target.position - transform.position).normalized;
transform.position += dir * speed * Time.deltaTime;
transform.LookAt(target);
}
}

Patrol Between Points

csharp
public Transform[] waypoints;
private int currentWaypoint = 0;
void Update()
{
Transform wp = waypoints[currentWaypoint];
transform.position = Vector3.MoveTowards(transform.position, wp.position, speed * Time.deltaTime);
if (Vector3.Distance(transform.position, wp.position) < 0.5f)
currentWaypoint = (currentWaypoint + 1) % waypoints.Length;
}

Chase + Patrol Hybrid

csharp
void Update()
{
float distToPlayer = Vector3.Distance(transform.position, player.position);
if (distToPlayer < detectionRange)
ChasePlayer();
else
Patrol();
}

Health & Damage

csharp
public class EnemyHealth : MonoBehaviour
{
public int maxHealth = 3;
private int health;
void Start() => health = maxHealth;
public void TakeDamage(int amount)
{
health -= amount;
if (health <= 0) Die();
}
void Die()
{
// Spawn particles, play sound
Destroy(gameObject);
}
}

Output to User

Explain behavior simply:

  • "I added enemies that will chase you when you get close"
  • "They have 3 health - shoot them 3 times to defeat them"
  • "New enemies spawn every 5 seconds from the edges"
← v1.0.0All versions