Logo Defold Proto File Editing

Defold Proto File Editing

Tổ chức
indiesoftby
defold-proto-file-editing

Creates and edits Defold resource and component files that use Protobuf Text Format (.collection, .go, .atlas, .sprite, .gui, .collisionobject, .convexshape, .label, .font, .material, .model, .mesh, .particlefx, .sound, .camera, .factory, .collectionfactory, .collectionproxy, .tilemap, .tilesource, .objectinterpolation). Use when asked to create, modify, or configure any Defold proto text format file.

Add to TypingMind

Tổng quan

Nhà phát hànhindiesoftby
Kho mãdefold-agent-config
Tên kỹ năngdefold-proto-file-editing
Sao
104
Bản fork
10
Tệp đi kèm
26
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 26 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được indiesoftby công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Defold Proto File Editing trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/indiesoftby/defold-agent-config/tree/main/.agents/skills/defold-proto-file-editing
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/indiesoftby/defold-agent-config.git /tmp/defold-agent-config
mkdir -p .claude/skills
cp -r /tmp/defold-agent-config/.agents/skills/defold-proto-file-editing .claude/skills/defold-proto-file-editing
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Defold Proto File Editing trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Defold Proto File Editing ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Defold Proto File Editing với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Editing Defold Proto Text Format Files

Creates and edits Defold resource and component files that use Protobuf Text Format.

When to use

This skill covers all Defold file types that are serialized as Protobuf Text Format. It does NOT cover Lua script files (.script, .gui_script, .render_script, .editor_script).

Supported file types

For detailed field references, consult the per-type reference file in references/:

  • references/collection.md — .collection files (game levels, hierarchies)
  • references/gameobject.md — .go files (game object prototypes)
  • references/gui.md — .gui files (GUI scenes)
  • references/atlas.md — .atlas files (texture atlases)
  • references/sprite.md — .sprite files (sprite components)
  • references/collisionobject.md — .collisionobject files (physics)
  • references/convexshape.md — .convexshape files (external convex hull collision shapes)
  • references/label.md — .label files (text in game space)
  • references/font.md — .font files (font resources)
  • references/material.md — .material files (render materials)
  • references/model.md — .model files (3D models)
  • references/mesh.md — .mesh files (custom 3D meshes from buffer data)
  • references/particlefx.md — .particlefx files (particle effects)
  • references/sound.md — .sound files (audio)
  • references/camera.md — .camera files (camera components)
  • references/factory.md — .factory files (object spawning)
  • references/collectionfactory.md — .collectionfactory files (collection spawning)
  • references/collectionproxy.md — .collectionproxy files (world loading)
  • references/tilemap.md — .tilemap files (tile grids)
  • references/tilesource.md — .tilesource files (tile source resources)
  • references/objectinterpolation.md — .objectinterpolation files (extension: interpolation of fixed step movement)

For skill maintenance tasks (updating references, fetching proto schemas), use the defold-skill-maintain skill.

Shaders and materials relationship

Shaders (.vp, .fp, .glsl) are GLSL files and are NOT covered by this skill — use the defold-shaders-editing skill for shader files. However, shaders and materials are tightly coupled:

Data flow from material to shader

  1. Constants declared in vertex_constants / fragment_constants become uniform variables in shaders. Engine-provided constants (CONSTANT_TYPE_VIEW, CONSTANT_TYPE_PROJECTION, etc.) are automatically populated. User constants (CONSTANT_TYPE_USER) can be animated via go.set() / go.animate().

  2. Samplers declared in samplers become sampler2D uniforms. The sampler name in the material must match the uniform name in the shader.

  3. Attributes declared in attributes become vertex in variables. Semantic types like SEMANTIC_TYPE_POSITION, SEMANTIC_TYPE_TEXCOORD provide engine-generated data.

Instancing with mtx_world and mtx_normal

For instanced rendering, two special vertex attributes are available without declaring them in the material's attributes section:

  • mtx_world — mat4 world transformation matrix (per-instance)
  • mtx_normal — mat4 normal transformation matrix (per-instance)

When these are declared as vertex in attributes in the shader, Defold automatically enables instanced rendering:

glsl
// model_instanced.vp
in mediump mat4 mtx_world;
in mediump mat4 mtx_normal;

void main() {
    vec4 p = mtx_view * mtx_world * vec4(position.xyz, 1.0);
    var_normal = normalize((mtx_normal * vec4(normal, 0.0)).xyz);
    gl_Position = mtx_proj * p;
}

Requirements for instancing:

  • Material must have vertex_space: VERTEX_SPACE_LOCAL
  • Shader declares mtx_world and/or mtx_normal as in attributes
  • No need to add these to the material's attributes list

Reference examples

Built-in shader examples are in .deps/builtins/materials/:

  • sprite.vp / sprite.fp — 2D sprite rendering (world space)
  • model.vp / model.fp — 3D model rendering (local space, uniforms)
  • model_instanced.vp — 3D model with instancing (uses mtx_world, mtx_normal as attributes)

Bundled scripts

  • scripts/get_image_size.py — Get image dimensions (width × height) from PNG/JPEG files. Pure Python, no external dependencies. Use this when creating collision object box shapes that should match sprite image sizes. See references/collisionobject.md → "Sizing box shapes from sprite images" for the full workflow.
  • scripts/gen_convexshape.py — Generate a .convexshape file from a 2D image's non-transparent silhouette. Uses PIL/Pillow. Computes a convex hull, simplifies to ≤16 points (Box2D limit), centers at origin, and outputs Defold .convexshape format. See references/convexshape.md → "Generating from an image" for usage.
  • scripts/gen_silhouette_chain.py — Generate a .collisionobject file with a chain of rotated TYPE_BOX shapes tracing the contour of any image silhouette (concave, with holes, multi-part). Uses PIL/Pillow. Extracts boundary contour loops, simplifies with RDP, and outputs a .collisionobject with thin rotated boxes along each edge. See references/collisionobject.md → "Silhouette chain from image contour" for usage.

Embedded component type names

When embedding components in .go or .collection files, these are the type string values:

  • "sprite" — Sprite component
  • "label" — Label component
  • "collisionobject" — Collision object
  • "sound" — Sound component
  • "particlefx" — Particle effect
  • "model" — 3D model
  • "mesh" — Mesh
  • "camera" — Camera
  • "factory" — Factory
  • "collectionfactory" — Collection factory
  • "collectionproxy" — Collection proxy
  • "tilegrid" — Tilemap (note: type is "tilegrid", not "tilemap")
  • "objectinterpolation" — Object interpolation (extension)

GUI components (.gui) CANNOT be embedded inline — they must be added as referenced components.

Protobuf Text Format rules

These rules apply to ALL Defold proto text format files:

  1. Default omission: Omit fields that equal their proto default. This keeps files minimal and matches Defold editor output.
  2. Message blocks: Use field_name { ... } with nested key: value pairs.
  3. Floats: Always include decimal point: 1.0, not 1.
  4. Integers: No decimal point: 4, not 4.0.
  5. Strings: Always double-quoted: "text".
  6. Enums: Use the constant name without quotes: BLEND_MODE_ALPHA.
  7. Booleans: true or false, no quotes.
  8. Repeated fields: Each scalar value gets its own line with the field name.
  9. Repeated messages: Each entry gets its own field_name { ... } block.
  10. Field order: Follow the proto field number order.
  11. No trailing commas or semicolons.
  12. Indentation: 2 spaces per nesting level inside message blocks.
  13. Newlines: One empty line between the end of a message block } and the next field. No empty line between consecutive scalar fields.
  14. No blank lines between fields or blocks within the same nesting level (match Defold editor output).

Vector and math type conventions

These types from ddf_math.proto appear across many file types:

dmMath.Vector3 / dmMath.Point3

Components: x, y, z (and d, rarely used). All default to 0.0.

dmMath.Vector3One

Components: x, y, z (and d, rarely used). All default to 1.0.

dmMath.Vector4

Components: x, y, z, w. All default to 0.0.

dmMath.Vector4One

Components: x, y, z, w. All default to 1.0.

dmMath.Vector4WOne

Components: x, y, z, w. x/y/z default to 0.0, w defaults to 1.0.

dmMath.Quat

Components: x, y, z, w. x/y/z default to 0.0, w defaults to 1.0.

Omission rules for vector/math blocks

  • Only include components that differ from their default value.
  • If all components are at defaults, omit the entire block (for optional fields).
  • If the field is required, include the block but leave it empty: position { }.
protobuf
position {
  x: 200.0
  y: 100.0
}
rotation {
  z: 0.7071068
  w: 0.7071068
}

Data string encoding rules

Game objects embedded in .collection files and components embedded in .go files encode their content as multi-line strings in a data field.

Single nesting level (game object with referenced components)

The content is escaped once:

  • Quotes become \"
  • Newlines become \n
protobuf
data: "components {\n"
"  id: \"script\"\n"
"  component: \"/main/main.script\"\n"
"}\n"
""

Double nesting level (game object with embedded components)

The embedded component's data field requires double escaping:

  • Outer quotes: \"
  • Inner quotes (inside component data): \\\"
  • Outer newlines: \n
  • Inner newlines (inside component data): \\n
protobuf
data: "embedded_components {\n"
"  id: \"camera\"\n"
"  type: \"camera\"\n"
"  data: \"aspect_ratio: 1.0\\n"
"fov: 0.7854\\n"
"near_z: -1.0\\n"
"far_z: 1.0\\n"
"orthographic_projection: 1\\n"
"\"\n"
"}\n"
""

Common mistake — closing quote of inner data: The line that closes the inner data string (the \" that ends the embedded component's data value) must use single-escaped newline "\"\n", NOT double-escaped "\"\\n". The closing quote \" is the boundary between nesting levels — after it, you are back at the outer (game object) level, so the newline is single \n. Using \\n here corrupts the game object data and causes a load error.

Note: After the opening data: \"...\\n" line inside double-nested data, subsequent lines of that inner data do NOT have leading whitespace (they start at column 0 of the quoted string).

Multi-line string concatenation blocks end with an empty "" terminator. A single-line data: "" does not need an additional terminator.

Workflow

Creating a new file

  1. Determine the file type and path.
  2. Consult the relevant reference file in references/ for the field structure.
  3. Set all required fields.
  4. Set optional fields only if they differ from defaults.
  5. Follow proto field number order.
  6. Apply all Protobuf Text Format rules above.

Editing an existing file

  1. Read the current file.
  2. Modify only the requested fields.
  3. Preserve existing field values and order.
  4. Apply omission rules: remove fields that become equal to their defaults after editing.
  5. When editing existing files, preserve the existing formatting style.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Defold Proto File Editing làm được gì?

Creates and edits Defold resource and component files that use Protobuf Text Format (.collection, .go, .atlas, .sprite, .gui, .collisionobject, .convexshape, .label, .font, .material, .model, .mesh, .particlefx, .sound, .camera, .factory, .collectionfactory, .collectionproxy, .tilemap, .tilesource, .objectinterpolation). Use when asked to create, modify, or configure any Defold proto text format file.

Vì sao nên dùng Defold Proto File Editing trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Defold Proto File Editing là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Defold Proto File Editing trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/indiesoftby/defold-agent-config/tree/main/.agents/skills/defold-proto-file-editing. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Defold Proto File Editing?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Defold Proto File Editing với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Defold Proto File Editing với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Defold Proto File Editing có miễn phí không?

Kỹ năng này được indiesoftby phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇