game-ai
Ce qu’il fait
Explique comment faire décider aux personnages du jeu quoi faire, comment ils se déplacent et comment ils trouvent un chemin autour des obstacles. Elle s'adresse aux développeurs qui créent des ennemis, des gardes ou des groupes de personnages en mouvement.
Quand l’utiliser
- ✓Quand vous construisez une ronde, une poursuite ou une garde pour un ennemi.
- ✓Quand vous devez choisir entre une machine à états, un arbre de comportement ou la direction pour un personnage.
- ✓Quand un ennemi doit trouver un chemin autour des murs pour atteindre le joueur.
Lien du skill
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/disciplines/game-ai/SKILL.mdCopiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.
Comment l’utiliser
Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.
Message prêt à coller
Pour Claude Code, Codex ou Cursor : lancez-la dans le dossier du projet et le skill est installé.
Téléchargez le SKILL.md et placez-le dans le dossier de skills de votre agent.
Exemple de demande à votre IA
“Je veux que mon garde ennemi patrouille, me poursuive quand il me voit, et retourne à son poste quand je m'échappe. Quelle approche d'IA dois-je utiliser ?”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
L'agent recommande une machine à états simple pour quelques états clairs, un arbre de comportement pour de nombreux comportements priorisés, ou la notation pour des choix gradués. Il sépare les décisions, le mouvement et la recherche de chemin pour que chaque partie soit plus facile à modifier.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis GitHub.
Game AI: decisions, steering, and pathfinding
Build believable NPC behavior from three separable layers: decide (what to do), steer (how to move there), and path (how to route around the map). Keep them decoupled — a behavior tree picks a target, the pathfinder produces waypoints, steering follows them. This skill teaches the engine-neutral algorithms; bind them to your engine via the related skills below.
When to use
- Use when implementing enemy/NPC logic: patrols, chase/flee, guard states, group movement, or "find a path to the player".
- Use to choose between an FSM (few clear states), a behavior tree (many reactive behaviors with priorities), or steering (smooth local movement).
- Use when integrating pathfinding: A* on a grid/graph, or driving an engine navmesh agent.
When not to use: for the engine's concrete navmesh/agent API and baking,
use unity-navmesh, unreal-behavior-trees, or Godot's NavigationAgent2D/3D
(see that engine skill). For movement/collision feel, use physics-tuning. For
spawning waves along lanes, see the tower-defense genre skill.
Core workflow
- Pick the decision model by complexity. 2–5 states with obvious transitions → FSM. Many behaviors, priorities, interruption, reuse → behavior tree. Continuous "how strongly do I want each option" → utility scoring.
- Separate decision from motion. The decision layer outputs an intent (target position, action). Steering or pathfinding turns intent into motion.
- Path on the right graph. Grid tiles, waypoint graph, or a baked navmesh. Fewer nodes = faster A*. Prefer the engine's navmesh for 3D; A* on a grid for tile games.
- Steer along the path, not straight to the goal — follow the next waypoint, advancing when close, so agents round corners.
- Recompute paths sparingly. Pathfind on a timer or when the goal moves a tile, not every frame. Cache the path; only the waypoint index advances.
- Verify by observation. Watch the agent: does it reach the goal, get stuck on corners, oscillate between states? Draw the path and current state on screen while tuning.
Patterns
1. Finite state machine (one state object, explicit transitions)
# Godot 4.7, one class per file.
# state.gd: each state is a small object with enter/update/exit.
class_name State extends RefCounted
func enter(_agent) -> void: pass
func update(_agent, _dt: float) -> State: return null # return a state to transition
func exit(_agent) -> void: pass
# chase.gd: returns Patrol when the player escapes sight range.
class_name Chase extends State
func update(agent, dt: float) -> State:
if not agent.can_see(agent.target):
return Patrol.new() # transition by returning the next state
agent.move_toward(agent.target.position, dt)
return null # null = stay in this state
# enemy.gd: the agent owns `current` and ticks it once per frame.
var current: State = Patrol.new() # call current.enter(self) in _ready()
func tick(dt: float) -> void:
var next := current.update(self, dt)
if next != null:
current.exit(self)
next.enter(self)
current = next
Keep transition logic inside states (or in a table), never as a growing pile
of if flags. One state owns one behavior; that is what keeps an FSM readable.
2. Behavior tree tick (composite nodes return a status)
# A node's tick() returns SUCCESS, FAILURE, or RUNNING (still working this frame).
enum Status { SUCCESS, FAILURE, RUNNING }
# Sequence: run children in order; stop at the first non-SUCCESS (logical AND).
func sequence_tick(children, agent, dt) -> int:
for child in children:
var s = child.tick(agent, dt)
if s != Status.SUCCESS:
return s # FAILURE or RUNNING short-circuits the sequence
return Status.SUCCESS
# Selector: try children until one succeeds or is RUNNING (logical OR / fallback).
func selector_tick(children, agent, dt) -> int:
for child in children:
var s = child.tick(agent, dt)
if s != Status.FAILURE:
return s # SUCCESS or RUNNING stops the search
return Status.FAILURE
A guard AI reads top-down: Selector[ Sequence[CanSeePlayer?, Chase], Patrol ]
— chase if visible, otherwise patrol. See references/behavior-trees.md for
leaf nodes, decorators (Inverter, Cooldown), and a
Questions fréquentes
Qu'est-ce que la direction ?
La direction est un mouvement local fluide, comme aller vers une cible ou se regrouper en troupeau.
Couvre-t-elle le système de navigation de mon moteur ?
L'API de navigation propre au moteur est couverte par des compétences liées au moteur, vers lesquelles celle-ci renvoie.
A* est-il inclus ?
Oui. La compétence couvre A* sur une grille ou un graphe pour trouver des chemins.
Détails
Description originale de l’auteur
Design NPC and enemy decision-making with finite state machines, behavior trees, steering behaviors, and A* pathfinding — engine-neutral algorithms that pair with the detected engine's navigation API. Use when building enemy AI, an FSM or behavior tree, steering/flocking, or pathfinding, or when the user mentions state machine, behavior tree, blackboard, A*, navmesh, seek, or patrol/chase.
Popularité
- Étoiles GitHub
- 6.6k
- Position au classement
- #13796
- Licence
- Apache-2.0
- Mis à jour
- 28/10/2026
Commentaires
- …
Autres skills de ce dépôt
router
6.6kAide votre agent à choisir la bonne compétence de développement de jeu pour une demande, en détectant votre moteur et le type de tâche.
ai-behavior-trees-utility-ai
6.6kAide votre agent à construire un arbre de comportement et une IA par utilité pour des ennemis qui choisissent leurs actions selon priorité et score.
audio-design
6.6kApprend à votre agent le mixage audio de jeu : bus, volume en décibels, baisse sous les dialogues, musique adaptative et variation des effets sonores.
camera-systems
6.6kAide votre agent à construire des caméras de jeu qui suivent en douceur, restent dans le niveau, et pivotent ou regardent autour en 3D.
Skills similaires
diffs
394kPermet à votre agent de produire un diff réel et partageable de vos modifications, sous forme de lien ou d'image, plutôt qu'un résumé écrit à la main.
coding-agent
394kAide votre agent à confier une tâche de programmation plus importante à Codex, Claude Code ou OpenCode comme travailleur en arrière-plan, puis à suivre sa progression.
gh-issues
394kAide votre agent à trouver des tickets GitHub, choisir ceux à traiter et ouvrir des pull requests avec des correctifs, y compris le suivi des commentaires de relecture.