thedivergentai/gd-agentic-skills

godot-turn-system

Expert blueprint for turn-based combat with turn order, action points, phase management, and timeline systems for strategy/RPG games.

First seen Feb 10, 2026

Installation

$ npx skills add thedivergentai/gd-agentic-skills --skill godot-turn-system

Summary

  • Expert blueprint for turn-based combat with turn order, action points, phase management, and timeline systems for strategy/RPG games.
  • Covers speed-based initiative, interrupts, and simultaneous turns.
  • Use when implementing turn-based combat OR tactical systems.
  • Keywords turn-based, initiative, action points, phase, round, turn order, combat.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from thedivergentai/gd-agentic-skills · top by installs.

npx skills add thedivergentai/gd-agentic-skills

Browse all from thedivergentai/gd-agentic-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 678
License LICENSE
Default branch main
Open issues 0
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 10,638 B
  • docs SUMMARY.md 368 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 236 installs

SKILL.md

NEVER Do (Expert Anti-Patterns)

Order & Determinism

  • NEVER recalculate turn order every action; strictly sort once per round or ONLY when a speed-relevant stat changes to prevent O(n log n) lag.
  • NEVER use random tie-breaking for initiative; strictly use a secondary static attribute (Agility, ID, or persistent "luck") for deterministic replays.
  • NEVER modify an active turn-order queue while iterating it; strictly iterate over a duplicate() or apply queue modifications after the loop.
  • NEVER broadcast global turn state changes using immediate callgroup(); strictly use callgroupflags(SceneTree.GROUPCALL_DEFERRED, ...) to prevent frame spikes when notifying hundreds of units.
  • NEVER rely on the Node hierarchy as the source of truth; strictly use a Dictionary board state for logical grid coordinates.

Logic & Action Economy

  • NEVER deduct Action Points (AP) before validation; strictly call canperformaction(cost) before applying current_ap -= cost to prevent exploits.
  • NEVER hardcode phase transitions (if phase == 0); strictly use an enum + match or a dedicated State Machine for Draw/Main/End phases.
  • NEVER emit "Turn Ended" before internal cleanup; strictly reset AP and tick status effects BEFORE signaling the next turn.
  • NEVER use exact floating-point equality (==) for AP checks; strictly use >= or isequalapprox() for robust comparisons.

Tactical Grid & UI

  • NEVER use generic AStar2D for tile grids; strictly use AStarGrid2D for 10x faster pathfinding and native diagonal handling.
  • NEVER forget to call update() on AStarGrid2D after changing obstacle states; if you toggle setpointsolid(), the grid MUST refresh before the next query.
  • NEVER lock the main thread with while loops for input; strictly use the await keyword or signals to yield execution back to the Tree.
  • NEVER handle turn decisions with isactionpressed(); strictly use isactionjust_pressed() for discrete, frame-locked menu input.
  • NEVER skip turn timeouts in networked games; strictly implement a server-side timer with a default "pass" action to prevent griefing. See Networked Turn Timeout golden path below.

Decision Tree — Pick a Turn Model

Need Choose MANDATORY script
Discrete rounds (chess / tactics / card phases) Round + initiative queue + AP phases [turnsystempatterns.gd](scripts/turnsystempatterns.gd)
Continuous gauges (FF-style ATB) Per-actor gauge fill in _process [activetimebattle.gd](scripts/activetimebattle.gd)
Timeline / CTB with interrupts & prediction Event timeline + predictive UI [timelineturnmanager.gd](scripts/timelineturnmanager.gd)

Do NOT invent a fourth model inline. Read the matching script before coding.

Expert Components (scripts/)

  • [turnsystempatterns.gd](scripts/turnsystempatterns.gd) — Match-based phase machines, UndoRedo, AStarGrid2D board helpers.
  • [activetimebattle.gd](scripts/activetimebattle.gd) — ATB gauges, pause-on-ready, async action handoff.
  • [timelineturnmanager.gd](scripts/timelineturnmanager.gd) — Timeline / CTB with interrupts and pre-visualization.
  • [turnpredictor.gd](scripts/turnpredictor.gd) — Simulate ATB gauges for timeline UI preview.
  • [combatstatsresource.gd](scripts/combatstatsresource.gd) — Deterministic damage preview Resource for hover UI.

TurnManager Autoload — Interface Contract Only

Keep the Autoload thin. Do not paste full queue math here — implement in the script chosen above.

# turn_manager.gd (AutoLoad) — contract only
extends Node
signal turn_started(combatant: Node)
signal turn_ended(combatant: Node)
signal round_ended
signal turn_timed_out(combatant: Node)  # multiplayer: server default-pass

func start_combat(participants: Array[Node]) -> void: pass
func end_turn() -> void: pass
func request_pass(combatant: Node) -> void: pass  # default action on timeout

Networked Turn Timeout (Golden Path)

Referenced from NEVER: server owns the clock; clients never decide "pass."

  1. On turn_started, server starts a one-shot Timer / SceneTreeTimer (authoritative).
  2. On timeout: server calls requestpass(current) (or auto-end-turn), then emits turntimed_out.
  3. Clients only render the countdown; never mutate the turn queue locally.
  4. Pair with godot-multiplayer-networking for host-auth RPC.

Action Points (Contract)

func can_perform_action(cost: int) -> bool:
    return current_action_points >= cost

func perform_action(cost: int) -> bool:
    if not can_perform_action(cost):
        return false
    current_action_points -= cost
    return true

Phases: prefer enum Phase { DRAW, MAIN, END } + match, or route to godot-state-machine-advanced. Full ATB / timeline math lives in the MANDATORY scripts — do not duplicate Elite snippets here.

Deep recipes (on demand)

LLM-ignorance rule: if a general agent would not know it before reading, it lives here or in scripts/ — never delete, only move.

Topic Reference
ATB / prediction / previews [elite-turn-patterns.md](references/elite-turn-patterns.md)

Reference

Progressive disclosure: open Official Documentation links only when researching a specific API;
load Related Skills when routing work to a peer domain — do not preload the whole lattice.

Official Documentation

  • Idle and Physics Processing — When turn ticks belong in process vs physicsprocess vs pure event steps.
  • Using signals — Turn-start / turn-end / unit-acted events without polling gauges.
  • Resources — Initiative/speed stats as Resources for sim and UI prediction.
  • Singletons (Autoload) — TurnManager ownership boundaries.
  • GDScript basicsawait sequencing for multi-phase turns.
  • Object — Signal connect flags for turn bus listeners.
  • SceneTree — Pausing gameplay while menus resolve turn choices.
  • Timer — Optional realtime turn clocks without busy loops.
  • Tween — Animating ATB gauges and turn handoff juice.
  • AnimationPlayer — Action animations that must finish before the next turn.
  • MultiplayerAPI — Authoritative turn order in networked matches.
  • JSON — Deterministic turn replay / seed logs for balance labs.

Related Skills

Prerequisites

Complements

Downstream / consumers

Master

  • godot-master — Library router and mirrored module entry for turn systems.