重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
godot-genre-rts by thedivergentai/gd-agentic-skills
npx skills add https://github.com/thedivergentai/gd-agentic-skills --skill godot-genre-rts平衡策略、微操和性能的 RTS 游戏专家蓝图。
NavigationObstacle 替换静态单位。_process();严格使用中央UnitManager 或仅在需要时使用 _physics_process。WorkerThreadPool 并错开路径更新。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
Array[Command]is_equal_approx() 以实现确定性触发。RefCounted 或 Resource 对象的类型化选择集,以实现确定性序列化和网络代码。Dictionary 或 JSON 状态实现命令模式,用于游戏保存和多人游戏回放。MeshInstance3D 节点渲染数千个单位;严格使用 MultiMeshInstance 和 INSTANCE_CUSTOM 数据来驱动独特的 GPU 端状态动画(行走/攻击/颜色)。WorkerThreadPool 将缓冲区推送到 RenderingServer.multimesh_set_buffer()。CSGShape3D 作为建筑放置的虚影;严格使用优化的静态 ArrayMesh 几何体。| 阶段 | 技能 | 目的 |
|---|---|---|
| 1. 控制 | godot-input-handling, camera-rts | 选择框,摄像机平移/缩放 |
| 2. 单位 | navigation-server, state-machines | 寻路,避障,状态(闲置/移动/攻击) |
| 3. 系统 | fog-of-war, building-system | 地图可见性,网格放置 |
| 4. AI | behavior-trees, utility-ai | 敌方指挥官逻辑 |
| 5. 优化 | ui-minimap, godot-particles | 战略概览,战斗反馈 |
处理鼠标输入以选择单位。
# selection_manager.gd
extends Node2D
var selected_units: Array[Unit] = []
var drag_start: Vector2
var is_dragging: bool = false
@onready var selection_box: Panel = $SelectionBox
func _unhandled_input(event):
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT:
if event.pressed:
start_selection(event.position)
else:
end_selection(event.position)
elif event is InputEventMouseMotion and is_dragging:
update_selection_box(event.position)
func end_selection(end_pos: Vector2):
is_dragging = false
selection_box.visible = false
var rect = Rect2(drag_start, end_pos - drag_start).abs()
if Input.is_key_pressed(KEY_SHIFT):
# Add to selection
pass
else:
deselect_all()
# Query physics server for units in rect
var query = PhysicsShapeQueryParameters2D.new()
var shape = RectangleShape2D.new()
shape.size = rect.size
query.shape = shape
query.transform = Transform2D(0, rect.get_center())
# ... execute query and add units to selected_units
for unit in selected_units:
unit.set_selected(true)
func issue_command(target_position: Vector2):
for unit in selected_units:
unit.move_to(target_position)
单位需要健壮的状态管理来处理命令和自动攻击。
# unit.gd
extends CharacterBody2D
class_name Unit
enum State { IDLE, MOVE, ATTACK, HOLD }
var state: State = State.IDLE
var command_queue: Array[Command] = []
@onready var nav_agent: NavigationAgent2D = $NavigationAgent2D
func move_to(target: Vector2):
nav_agent.target_position = target
state = State.MOVE
func _physics_process(delta):
if state == State.MOVE:
if nav_agent.is_navigation_finished():
state = State.IDLE
return
var next_pos = nav_agent.get_next_path_position()
var direction = global_position.direction_to(next_pos)
velocity = direction * speed
move_and_slide()
### 3. Group Movement & Flocking
Instead of moving all units directly to a single point (clumping), use **Relative Offsets**:
- Calculate the **Center of Mass** for the selected group.
- On click, calculate each unit's **Relative Offset** from the center.
- Issue `target_position + unit_offset` to each unit to maintain formation.
一个用于隐藏未探索区域的系统。通常使用纹理和着色器实现。
网格方法 : "可见性"值的二维数组。
视口纹理 : 一个 SubViewport,在黑色背景上为单位绘制白色圆圈。然后,此纹理在全屏 ColorRect 覆盖层的着色器中用作遮罩。
shader_type canvas_item; uniform sampler2D visibility_texture; uniform vec4 fog_color : source_color;
void fragment() { float visibility = texture(visibility_texture, UV).r; COLOR = mix(fog_color, vec4(0,0,0,0), visibility); }
允许玩家链接命令 (Shift-点击)。
Array 中。当一个命令完成时,弹出下一个。ResourceNode (树木/金矿) 和 DropoffPoint (城镇中心)。NavigationAgent2D 内置的 RVO (互惠速度障碍) (属性 avoidance_enabled, radius)。MultiMeshInstance2D,并对大量单位在 Server 节点上运行逻辑,而不是在每个单独的脚本中。NavigationAgent2D 内置了 RVO 避障。确保调用 set_velocity() 并使用 velocity_computed 信号进行实际移动!_process。让一个中央 UnitManager 遍历活动单位以节省函数调用开销。Units, Buildings, Resources) 以便于选择过滤。每周安装量
55
仓库
GitHub 星标数
62
首次出现
2026年2月10日
安全审计
安装于
codex53
opencode53
gemini-cli52
kimi-cli51
github-copilot51
amp51
Expert blueprint for RTS games balancing strategy, micromanagement, and performance.
NavigationObstacle._process() on hundreds of individual units; strictly use a central UnitManager or _physics_process only when required.WorkerThreadPool and stagger path updates.Array[Command] and implement a "Force Move/Attack" bypass.is_equal_approx() for deterministic triggers.RefCounted or Resource objects for deterministic serialization and netcode.Dictionary or JSON states for save-game and multiplayer playback.MeshInstance3D nodes; strictly use MultiMeshInstance with INSTANCE_CUSTOM data to drive unique GPU-side state animations (walking/attacking/color).WorkerThreadPool to push buffers to RenderingServer.multimesh_set_buffer().CSGShape3D for building placement ghosts; strictly use optimized static ArrayMesh geometry.| Phase | Skills | Purpose |
|---|---|---|
| 1. Controls | godot-input-handling, camera-rts | Selection box, camera panning/zoom |
| 2. Units | navigation-server, state-machines | Pathfinding, avoidance, states (Idle/Move/Attack) |
| 3. Systems | fog-of-war, building-system | Map visibility, grid placement |
| 4. AI | , |
Handles mouse input for selecting units.
# selection_manager.gd
extends Node2D
var selected_units: Array[Unit] = []
var drag_start: Vector2
var is_dragging: bool = false
@onready var selection_box: Panel = $SelectionBox
func _unhandled_input(event):
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT:
if event.pressed:
start_selection(event.position)
else:
end_selection(event.position)
elif event is InputEventMouseMotion and is_dragging:
update_selection_box(event.position)
func end_selection(end_pos: Vector2):
is_dragging = false
selection_box.visible = false
var rect = Rect2(drag_start, end_pos - drag_start).abs()
if Input.is_key_pressed(KEY_SHIFT):
# Add to selection
pass
else:
deselect_all()
# Query physics server for units in rect
var query = PhysicsShapeQueryParameters2D.new()
var shape = RectangleShape2D.new()
shape.size = rect.size
query.shape = shape
query.transform = Transform2D(0, rect.get_center())
# ... execute query and add units to selected_units
for unit in selected_units:
unit.set_selected(true)
func issue_command(target_position: Vector2):
for unit in selected_units:
unit.move_to(target_position)
Units need robust state management to handle commands and auto-attacks.
# unit.gd
extends CharacterBody2D
class_name Unit
enum State { IDLE, MOVE, ATTACK, HOLD }
var state: State = State.IDLE
var command_queue: Array[Command] = []
@onready var nav_agent: NavigationAgent2D = $NavigationAgent2D
func move_to(target: Vector2):
nav_agent.target_position = target
state = State.MOVE
func _physics_process(delta):
if state == State.MOVE:
if nav_agent.is_navigation_finished():
state = State.IDLE
return
var next_pos = nav_agent.get_next_path_position()
var direction = global_position.direction_to(next_pos)
velocity = direction * speed
move_and_slide()
### 3. Group Movement & Flocking
Instead of moving all units directly to a single point (clumping), use **Relative Offsets**:
- Calculate the **Center of Mass** for the selected group.
- On click, calculate each unit's **Relative Offset** from the center.
- Issue `target_position + unit_offset` to each unit to maintain formation.
A system to hide unvisited areas. Usually implemented with a texture and a shader.
Grid Approach : 2D array of "visibility" values.
Viewport Texture : A SubViewport drawing white circles for units on a black background. This texture is then used as a mask in a shader on a full-screen ColorRect overlay.
shader_type canvas_item; uniform sampler2D visibility_texture; uniform vec4 fog_color : source_color;
void fragment() { float visibility = texture(visibility_texture, UV).r; COLOR = mix(fog_color, vec4(0,0,0,0), visibility); }
Allow players to chain commands (Shift-Click).
Array. When one finishes, pop the next.ResourceNode (Tree/GoldMine) and DropoffPoint (TownCenter).NavigationAgent2D (properties avoidance_enabled, radius).MultiMeshInstance2D for rendering thousands of units if needed, and run logic on a Server node rather than individual scripts for mass units.NavigationAgent2D has built-in RVO avoidance. Make sure to call set_velocity() and use the velocity_computed signal for the actual movement!_process on every unit. Have a central UnitManager iterate through active units to save function call overhead.Units, Buildings, Resources) for easy selection filters.Weekly Installs
55
Repository
GitHub Stars
62
First Seen
Feb 10, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex53
opencode53
gemini-cli52
kimi-cli51
github-copilot51
amp51
GSAP 框架集成指南:Vue、Svelte 等框架中 GSAP 动画最佳实践
3,700 周安装
behavior-treesutility-ai| Enemy commander logic |
| 5. Polish | ui-minimap, godot-particles | Strategic overview, battle feedback |