godot-turn-system
БесплатноЗапускает вложенные скриптыНе проверенExpert blueprint for turn-based combat with turn order, action points, phase management, and timeline systems for strategy/RPG games. Covers speed-based…
от thedivergentai★ 1 019 звёзд на GitHubОб этом скилле
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 usecall_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 applyingcurrent_ap -= costto 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>=oris_equal_approx()for robust comparisons.
Tactical Grid & UI
- NEVER use generic
AStar2Dfor tile grids; strictly useAStarGrid2Dfor 10x faster pathfinding and native diagonal handling. - NEVER forget to call
update()onAStarGrid2Dafter changing obstacle states; if you toggleset_point_solid(), the grid MUST refresh before the next query. - NEVER lock the main thread with
whileloops 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 useis_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,
AStarGrid2Dboard 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-shotTimer/SceneTreeTimer(authoritative). - On timeout: server calls
request_pass(current)(or auto-end-turn), then emitsturn_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](https://github.com/thedivergentai/gd-
Установить godot-turn-system в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл godot-turn-system?
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.
Как установить скилл godot-turn-system?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл godot-turn-system запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic