본문으로 건너뛰기
Skillpedia
일반 코딩6.6k · #13796

game-ai

하는 일

게임 캐릭터가 무엇을 할지 결정하고, 어떻게 움직이며, 장애물을 피해 경로를 찾는 방법을 설명합니다. 적, 경비병, 무리 지어 움직이는 캐릭터를 만드는 게임 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓적의 순찰, 추격, 경계 행동을 만들고 있을 때.
  • ✓캐릭터에 상태 기계, 행동 트리, 스티어링 중 무엇을 쓸지 고를 때.
  • ✓적이 벽을 피해 플레이어에게 가는 경로를 찾아야 할 때.

스킬 링크

https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/disciplines/game-ai/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/disciplines/game-ai/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 경비병 적이 순찰하다가 나를 보면 쫓아오고, 내가 도망치면 자기 자리로 돌아가게 하고 싶어요. 어떤 AI 방식을 쓰면 좋을까요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 상태가 몇 개뿐이면 간단한 상태 기계를, 우선순위가 많은 행동이면 행동 트리를, 등급이 나뉜 선택이면 점수 계산을 추천합니다. 의사결정, 이동, 경로 찾기를 분리해 각 부분을 쉽게 바꿀 수 있게 합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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

  1. 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.
  2. Separate decision from motion. The decision layer outputs an intent (target position, action). Steering or pathfinding turns intent into motion.
  3. 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.
  4. Steer along the path, not straight to the goal — follow the next waypoint, advancing when close, so agents round corners.
  5. 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.
  6. 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

자주 묻는 질문

스티어링이란 무엇인가요?

목표를 향해 가거나 무리와 함께 움직이는 것처럼 부드럽게 이루어지는 국소적인 이동입니다.

엔진의 내비게이션 시스템도 다루나요?

엔진 자체의 내비게이션 API는 관련 엔진 스킬이 다루며, 이 스킬은 그쪽을 안내합니다.

A*도 포함되나요?

네. 격자나 그래프에서 경로를 찾는 A*를 다룹니다.

상세 정보

작성자의 원본 설명

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.

repo: gamedev-skills/awesome-gamedev-agent-skills

인기도

GitHub 스타
6.6k
순위
#13796
라이선스
Apache-2.0
업데이트
2026. 10. 28.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬