godot-resources
ما الذي تفعله
تُظهر هذه المهارة كيفية حفظ معلومات اللعبة مثل العناصر والإحصائيات في ملفات موارد Godot بدلًا من وضعها في الكود. وهي مناسبة لمن يريدون تعديل بيانات اللعبة دون إعادة كتابة السكربتات.
متى تستخدمها
- ✓عندما تريد حفظ العناصر أو الإحصائيات أو إعدادات الأعداء كملفات بيانات في Godot.
- ✓عندما تحتاج إلى إنشاء ملفات موارد بصيغة tres. أو res. في مشروع Godot.
- ✓عندما تريد تحميل بيانات اللعبة عند الحاجة، أو تعديل مورد مشترك بأمان أثناء التشغيل.
رابط المهارة
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/godot/godot-resources/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“اجعل لعبة Godot الخاصة بي تسمح لي بإضافة أسلحة جديدة بتعديل ملف، دون كتابة كود.”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
تشرح المهارة كيفية إنشاء أنواع موارد مخصصة لها حقول قابلة للتحرير، وحفظها كملفات، والإشارة إليها من المشاهد، وتحميلها عند الحاجة.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Godot Resources (4.x)
Model game data as reusable, Inspector-editable Resource objects instead of hard-coded
values, and load/save them as .tres/.res. Targets Godot 4.7.
When to use
- Use when representing items, stats, enemy configs, dialogue lines, or level metadata as
data; authoring
.tresfiles in the Inspector; or loading/saving custom resources.
When not to use: nodes/scene structure → godot-nodes-scenes; saving the player's
runtime progress (engine-agnostic save format/slots) → save-systems; the C# variant of
this pattern → godot-csharp.
Core workflow
- Subclass
Resourcewithclass_nameand@exportfields. It now appears in the "New Resource" dialog and as an@exporttype, editable in the Inspector. - Create instances as
.tresfiles in the FileSystem dock (text, diff-friendly) or.res(binary, smaller/faster). Edit their fields in the Inspector — no code needed. - Reference resources from nodes via
@export var data: ItemResource, or arrays@export var loot: Array[ItemResource]. - Load at runtime with
preload(constant path) orload/ResourceLoader.load(variable path). Use threaded loading for large assets. - Duplicate before mutating a shared resource at runtime, or every node using it changes too (resources are shared references).
- Save generated/edited resources with
ResourceSaver.save.
Patterns
1. A custom data resource
# item.gd
extends Resource
class_name ItemResource
@export var id: StringName = &""
@export var display_name: String = "Item"
@export_multiline var description: String = ""
@export var icon: Texture2D
@export var max_stack: int = 99
@export var value: int = 0
Create sword.tres from this class in the FileSystem dock and fill it in the Inspector.
2. Consume resources from a node
extends Node
@export var starting_items: Array[ItemResource] = [] # drag .tres files in the Inspector
func _ready() -> void:
for item in starting_items:
print("Have: %s (x%d max)" % [item.display_name, item.max_stack])
3. Duplicate before mutating shared data
func give_unique_copy(template: ItemResource) -> ItemResource:
# true = deep: copies nested arrays/dictionaries and *embedded* sub-resources, but
# sub-resources saved in their own .tres stay shared. Use
# template.duplicate_deep(Resource.DEEP_DUPLICATE_ALL) to copy those as well.
var copy: ItemResource = template.duplicate(true)
copy.value += 5 # mutating the copy won't touch the template .tres
return copy
4. Save and load a resource at runtime
func save_config(cfg: Resource) -> void:
ResourceSaver.save(cfg, "user://config.tres") # user:// = writable app data dir
func load_config() -> Resource:
if ResourceLoader.exists("user://config.tres"):
return ResourceLoader.load("user://config.tres")
return null
Pitfalls
- Resources are shared by reference. A single
.tresassigned to many nodes is the same object — mutating it changes all of them (and re-saving the file). Callduplicate(true)for per-instance state. - A deep copy still changes the original's sub-resource →
duplicate(true)only copies sub-resources embedded in the file; one saved as its own.tres(e.g. a sharedstats.tresinsidegoblin.tres) is still the same object. Useduplicate_deep(Resource.DEEP_DUPLICATE_ALL)when those must be copied too. class_namerequired to instance from the editor. Without it the class won't appear in the "New Resource" dialog or as an@exporttype.res://is read-only in exported games. Write runtime data touser://, neverres://.ResourceSaver.savetores://only works in the editor.- Storing nodes in a Resource doesn't serialize them. Resources hold data, not live
scene nodes. Reference scenes via
PackedScene, not node instances. - Cyclic resource references (A holds B holds A) can fail to save/load cleanly — keep data graphs acyclic or use IDs/lookups.
preloadvsload.preloadneeds a constant path and loads with the script;loadaccepts a variable path at runtime. UseResourceLoader.exists()beforeloadto avoid errors on missing files.- Don't put secrets in
.tres— they ship in plain text inside the export.
References
- For threaded/background loading (
load_threaded_request), `
الأسئلة الشائعة
ما هو مورد Godot؟
المورد كائن بيانات يمكن حفظه في ملف ومشاركته بين المشاهد.
لماذا أنسخ المورد قبل تغييره؟
لأن الموارد مراجع مشتركة، فتغيير نسخة مشتركة واحدة يغيّرها في كل مكان تُستخدم فيه.
هل هذه المهارة لحفظ تقدم اللاعب؟
ليس تحديدًا. يغطي حفظ تقدم اللاعب مهارة منفصلة للحفظ.
التفاصيل
الوصف الأصلي من المؤلف
Design data-driven Godot 4.7 games with custom Resource classes: define typed data with class_name + @export, save/load .tres/.res files, instance and duplicate resources, and load on demand with ResourceLoader (incl. threaded loading). Use when modeling items/stats/configs as data in a Godot project, creating .tres resources, or working with custom Resource subclasses and ResourceLoader/ResourceSaver.
الشعبية
- نجوم GitHub
- 6.6k
- الترتيب
- #13827
- الترخيص
- Apache-2.0
- آخر تحديث
- 28/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
router
6.6kيساعد وكيلك على اختيار مهارة تطوير الألعاب المناسبة لطلبك، بعد التعرف على المحرك ونوع المهمة التي تحتاجها.
ai-behavior-trees-utility-ai
6.6kيساعد وكيلك على بناء شجرة سلوك ونظام ذكاء اصطناعي بالتقييم لأعداء اللعبة والشخصيات، فتختار الإجراء حسب الأولوية والنقاط.
audio-design
6.6kيعلّم وكيلك مزج صوت اللعبة: المسارات، والديسيبل، وخفض الموسيقى تحت الحوار، والموسيقى المتكيفة، وتنويع المؤثرات الصوتية.
camera-systems
6.6kيساعد وكيلك على بناء كاميرات للألعاب تتبع اللاعب بسلاسة، وتبقى داخل حدود المرحلة، وتدور حول الشخصية أو تنظر حولها في ثلاثة أبعاد.
مهارات مشابهة
diffs
394kيتيح لوكيلك إنتاج فرق تعديلات حقيقي يمكن مشاركته، كرابط عرض أو ملف صورة، بدلاً من ملخص مكتوب يدوياً.
coding-agent
394kيساعد وكيلك على تسليم مهمة برمجة كبيرة إلى Codex أو Claude Code أو OpenCode كعامل في الخلفية، ثم متابعة تقدمها.
gh-issues
394kيساعد وكيلك على إيجاد مشكلات GitHub واختيار ما ستعمل عليه، وفتح طلبات سحب بالإصلاحات، ومتابعة تعليقات المراجعة.