godot-project-templates
22
总安装量
5
周安装量
#16550
全站排名
安装命令
npx skills add https://github.com/thedivergentai/gd-agentic-skills --skill godot-project-templates
Agent 安装分布
opencode
5
gemini-cli
5
codex
5
amp
4
kimi-cli
4
Skill 文档
Project Templates
Genre-specific scaffolding, AutoLoad patterns, and modular architecture define rapid prototyping.
Available Scripts
base_game_manager.gd
Expert AutoLoad template for game state management (pause, scene transitions, scoring).
NEVER Do in Project Templates
- NEVER hardcode scene paths â
get_tree().change_scene_to_file("res://levels/level_1.tscn")in 20 places? Nightmare refactoring. Use AutoLoad + constants OR scene registry. - NEVER forget AutoLoad registration â Template includes
game_manager.gdbut not in Project Settings? Script won’t load. MUST add to Project â AutoLoad. - NEVER use
get_tree().pausedwithout groups â Pausing entire tree = pause menu also freezes. Use process mode groups (PROCESS_MODE_PAUSABLEvsPROCESS_MODE_ALWAYS). - NEVER skip Input.MOUSE_MODE_CAPTURED in FPS â FPS template without mouse capture = cursor visible during gameplay. Set in player
_ready(). - NEVER copy-paste templates as-is â Using platformer template for RPG? Leads to architectural debt. UNDERSTAND the structure, then adapt.
Directory Structure
my_platformer/
âââ project.godot
âââ autoloads/
â âââ game_manager.gd
â âââ audio_manager.gd
â âââ scene_transitioner.gd
âââ scenes/
â âââ main_menu.tscn
â âââ game.tscn
â âââ pause_menu.tscn
âââ entities/
â âââ player/
â â âââ player.tscn
â â âââ player.gd
â â âââ player_states/
â âââ enemies/
â âââ base_enemy.gd
â âââ goblin/
âââ levels/
â âââ level_1.tscn
â âââ tilesets/
âââ ui/
â âââ hud.tscn
â âââ themes/
âââ audio/
â âââ music/
â âââ sfx/
âââ resources/
âââ data/
Core Scripts
game_manager.gd:
extends Node
signal game_started
signal game_paused(paused: bool)
signal level_completed
var current_level: int = 1
var score: int = 0
var is_paused: bool = false
func start_game() -> void:
score = 0
current_level = 1
SceneTransitioner.change_scene("res://levels/level_1.tscn")
game_started.emit()
func pause_game(paused: bool) -> void:
is_paused = paused
get_tree().paused = paused
game_paused.emit(paused)
func complete_level() -> void:
current_level += 1
level_completed.emit()
Top-Down RPG Template
Directory Structure
my_rpg/
âââ autoloads/
â âââ game_data.gd
â âââ dialogue_manager.gd
â âââ inventory_manager.gd
âââ entities/
â âââ player/
â âââ npcs/
â âââ interactables/
âââ maps/
â âââ overworld/
â âââ dungeons/
â âââ interiors/
âââ systems/
â âââ combat/
â âââ dialogue/
â âââ quests/
â âââ inventory/
âââ ui/
â âââ inventory_ui.tscn
â âââ dialogue_box.tscn
â âââ quest_log.tscn
âââ resources/
âââ items/
âââ quests/
âââ dialogues/
Core Systems
inventory_manager.gd:
extends Node
signal item_added(item: Resource)
signal item_removed(item: Resource)
var inventory: Array[Resource] = []
func add_item(item: Resource) -> void:
inventory.append(item)
item_added.emit(item)
func remove_item(item: Resource) -> bool:
if item in inventory:
inventory.erase(item)
item_removed.emit(item)
return true
return false
func has_item(item_id: String) -> bool:
for item in inventory:
if item.id == item_id:
return true
return false
3D FPS Template
Directory Structure
my_fps/
âââ autoloads/
â âââ game_manager.gd
â âââ weapon_manager.gd
âââ player/
â âââ player.tscn
â âââ player.gd
â âââ camera_controller.gd
â âââ weapons/
â âââ weapon_base.gd
â âââ pistol/
â âââ rifle/
âââ enemies/
â âââ ai_controller.gd
â âââ soldier/
âââ levels/
â âââ level_1/
â âââ level_2/
âââ ui/
â âââ hud.tscn
â âââ crosshair.tscn
âââ resources/
âââ weapons/
âââ pickups/
Player Controller
player.gd:
extends CharacterBody3D
@export var speed := 5.0
@export var jump_velocity := 4.5
var gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity")
@onready var camera: Camera3D = $Camera3D
@onready var weapon_holder: Node3D = $Camera3D/WeaponHolder
func _ready() -> void:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
func _physics_process(delta: float) -> void:
if not is_on_floor():
velocity.y -= gravity * delta
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = jump_velocity
var input_dir := Input.get_vector("move_left", "move_right", "move_forward", "move_backward")
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * speed
velocity.z = direction.z * speed
else:
velocity.x = move_toward(velocity.x, 0, speed)
velocity.z = move_toward(velocity.z, 0, speed)
move_and_slide()
Input Map Template
# All templates should include these actions:
[input]
move_left=Keys: A, Left, Gamepad Left
move_right=Keys: D, Right, Gamepad Right
move_up=Keys: W, Up, Gamepad Up
move_down=Keys: S, Down, Gamepad Down
jump=Keys: Space, Gamepad A
interact=Keys: E, Gamepad X
pause=Keys: Escape, Gamepad Start
ui_accept=Keys: Enter, Gamepad A
ui_cancel=Keys: Escape, Gamepad B
Usage
- Copy template structure
- Rename project in
project.godot - Register AutoLoads
- Configure Input Map
- Begin development
Reference
Related
- Master Skill: godot-master