mcpbeat Sign in

Godot Turn System Agent Skill

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.

6k tokens
context cost
the whole folder, loaded on every use
7
files
ships runnable scripts
0
copies elsewhere
how many repositories repackaged it
451
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/thedivergentai/GD-Agentic-Skills --skill godot-turn-system

The instruction itself

19 sections, as written by the author

Godot 4.7 Baseline

  • Expert patterns in this skill target Godot 4.7+ (stable, 2026-06-18).
  • Consult the Godot 4.7 migration guide when upgrading projects from 4.6.
  • NEVER assume 4.6 defaults (stretch mode, audio area_mask, RichTextLabel percent flags) without checking 4.7 migration notes.

Turn System

Turn order calculation, action points, phase management, and timeline systems define turn-based combat.

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 call_group(); strictly use call_group_flags(SceneTree.GROUP_CALL_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 can_perform_action(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 is_equal_approx() 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 set_point_solid(), 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 is_action_pressed(); strictly use is_action_just_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 | turn_system_patterns.gd |

| Continuous gauges (FF-style ATB) | Per-actor gauge fill in _process | active_time_battle.gd |

| Timeline / CTB with interrupts & prediction | Event timeline + predictive UI | timeline_turn_manager.gd |

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

Expert Components (scripts/)

  • turn_system_patterns.gd — Match-based phase machines, UndoRedo, AStarGrid2D board helpers.
  • active_time_battle.gd — ATB gauges, pause-on-ready, async action handoff.
  • timeline_turn_manager.gd — Timeline / CTB with interrupts and pre-visualization.
  • turn_predictor.gd — Simulate ATB gauges for timeline UI preview.
  • combat_stats_resource.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."

  • On turn_started, server starts a one-shot Timer / SceneTreeTimer (authoritative).
  • On timeout: server calls request_pass(current) (or auto-end-turn), then emits turn_timed_out.
  • Clients only render the countdown; never mutate the turn queue locally.
  • 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 |

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 _physics_process 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.
Prerequisites
Complements
Downstream / consumers
Master
  • godot-master — Library router and mirrored module entry for turn systems.

Other skills for the same job

different authors, same section of the catalogue
Internal Comms
by anthropics
vendor ×13

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

6k tokens
Competitive Ads Extractor
by frostant
×10

Extracts and analyzes competitors' ads from ad libraries (Facebook, LinkedIn, etc.) to understand what messaging, problems, and creative approaches are working. Helps inspire and improve your own ad campaigns.

2k tokens
Lead Research Assistant
by frostant
×8

Identifies high-quality leads for your product or service by analyzing your business, searching for target companies, and providing actionable contact strategies. Perfect for sales, business development, and marketing professionals.

2k tokens
Developer Growth Analysis
by frostant
×6

Analyzes your recent Claude Code chat history to identify coding patterns, development gaps, and areas for improvement, curates relevant learning resources from HackerNews, and automatically sends a personalized growth report to your Slack DMs.

4k tokens
App Store Optimization
by alirezarezvani
×3

Complete App Store Optimization (ASO) toolkit for researching, optimizing, and tracking mobile app performance on Apple App Store and Google Play Store

55k tokens scripts
Deeptools
by christophacham
×3

NGS analysis toolkit. BAM to bigWig conversion, QC (correlation, PCA, fingerprints), heatmaps/profiles (TSS, peaks), for ChIP-seq, RNA-seq, ATAC-seq visualization.

21k tokens scripts
Pymatgen
by christophacham
×3

Materials science toolkit. Crystal structures (CIF, POSCAR), phase diagrams, band structure, DOS, Materials Project integration, format conversion, for computational materials science.

26k tokens scripts
Enhance Prompt
by google-labs-code
vendor ×2

Transforms vague UI ideas into polished, Stitch-optimized prompts. Enhances specificity, adds UI/UX keywords, injects design system context, and structures output for better generation results.

3k tokens

How to use it

Copy the folder

Take thedivergentai/godot-turn-system from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.