Chuyển đến nội dung
Skillpedia
Giao diện (UI/UX)6.6k · #13798

game-ui-ux

Skill này làm gì

Skill này bao quát cấu trúc menu và HUD của game để chúng hiển thị đúng ở nhiều độ phân giải và dùng được với bàn phím, chuột và tay cầm. Nó dành cho nhà phát triển làm thanh máu, menu chính, màn hình tạm dừng và kho đồ.

Khi nào nên dùng

  • ✓Khi bạn đang xây dựng HUD hiển thị máu, đạn hoặc điểm số.
  • ✓Khi menu bị vỡ ở các kích thước màn hình khác nhau hoặc không dùng được với tay cầm.
  • ✓Khi bạn muốn tổ chức màn hình tiêu đề, game, tạm dừng và cài đặt thành một ngăn xếp.

Liên kết skill

https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/disciplines/game-ui-ux/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/disciplines/game-ui-ux/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Menu tạm dừng của tôi bị vỡ trên màn hình rộng và tôi không dùng được nó bằng tay cầm. Bạn có thể sắp xếp lại bố cục và điều hướng không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent chuyển bố cục sang neo và container thay vì vị trí pixel cố định, thêm xử lý tỉ lệ và vùng an toàn, rồi thiết lập điều hướng tiêu điểm cho tay cầm. Nó cũng kết nối HUD với sự kiện trong game để HUD chỉ cập nhật khi có thay đổi.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Game UI/UX

Build HUDs and menus that stay correct on a phone, an ultrawide monitor, and a TV across a gamepad and a mouse. This skill owns the engine-neutral UI architecture — responsive layout, scaling, focus navigation, screen flow, and how UI talks to game state — and defers the concrete widget API to the engine UI skill.

When to use

  • Use when building a HUD (health/ammo/score), a menu (main/pause/settings), an inventory or shop screen, or any overlay, and you want it to scale and navigate correctly.
  • Use to fix UI that breaks at other resolutions/aspect ratios, ignores notches/safe areas, can't be used with a controller, or is wired to game state by per-frame polling.
  • Use to structure screen flow (title → game → pause → settings) as a stack, not flag soup.

When not to use: for the engine's concrete UI nodes/components and styling, use godot-ui-control or Unity UI (UGUI/UI Toolkit). For visual punch (button pop, damage numbers, shake) use game-feel. For branching conversation UI use dialogue-systems. For translating UI strings, that is localization (see references/ and input-systems for rebinding screens). For card/board layout specifics, the card-game genre composes this skill.

Core workflow

  1. Pick a layout model: anchors + containers, never absolute pixels. Anchor elements to edges/corners/center and let containers (rows, columns, grids) flow children. Absolute (x, y) positions break at the first new resolution.
  2. Choose a scaling strategy for the whole UI: a reference resolution that scales to fit (most games), plus a policy for extra width/height on other aspect ratios (letterbox, expand, or anchor HUD corners outward).
  3. Respect the safe area. Inset critical UI from screen edges so notches, rounded corners, and TV overscan don't clip it.
  4. Make every screen keyboard/gamepad navigable. Set an initial focused control per screen, define focus order/neighbors, and show a clear focus highlight. Mouse and focus must coexist.
  5. Model screens as a stack. Push (pause over game), pop (resume), with input + visibility handed to the top screen. This makes overlays and "back" trivial.
  6. Drive the HUD from events, not polling. The HUD subscribes to health_changed, score_changed, etc. and updates only when they fire — it does not read game state every frame.
  7. Verify across screens and devices. Resize the window, switch aspect ratios, unplug the mouse and navigate by gamepad only, and confirm focus, scaling, and safe-area insets. Report what you actually observed at which resolutions.

Patterns

1. Anchors + containers, not absolute coordinates

# Godot 4.7. Anchor a HUD label to the TOP-LEFT; let a container flow a row of hearts.
func _ready() -> void:
    $Score.set_anchors_preset(Control.PRESET_TOP_LEFT)   # sticks to the corner at any size
    # An HBoxContainer auto-lays-out children left-to-right; never position hearts by hand.
    for i in lives:
        $Hearts.add_child(make_heart())                   # HBoxContainer spaces them for you
# Unity 6.3 LTS uGUI: set RectTransform anchors to the corner; use a HorizontalLayoutGroup.
# RIGHT: anchors + layout groups. WRONG: rect.anchoredPosition = new Vector2(640, 360) (1080p-only).

2. Scale to a reference resolution (one UI, many screens)

# Godot 4.7 — Project Settings > Display > Window > Stretch:
#   Mode = "canvas_items", Aspect = "expand", reference size e.g. 1920x1080.
#   UI scales to the window; "expand" reveals extra space you anchor HUD corners into.
# Unity 6.3 LTS — Canvas > CanvasScaler:
#   UI Scale Mode = "Scale With Screen Size", Reference Resolution = 1920x1080,
#   Match = 0.5 (blend width/height) — pick 1.0 if your HUD is height-critical.
# Unity 6.3 LTS — UI Toolkit: the same three settings live on the PanelSettings asset
#   (Scale Mode = Scale With Screen Size, Reference Resolution, Screen Match Mode/Match).

3. Safe-area inset for notches / overscan

# Godot 4.7. Inset a MarginContainer to the OS safe rect. Only Android and iOS report a real
# safe area; elsewhere Godot returns the screen's usable rect, so desktop margins are ~0.
func _apply_safe_area() -> void:
    var safe := Rect2(DisplayServer.get_display_safe_area())           # screen pixels
    var win := Rect2(Rect2i(DisplayServer.window_get_position(), DisplayServer.window_get_size()))
    var inner := safe.intersection(
Câu hỏi thường gặp

Skill có bao quát hiệu ứng hình ảnh như số sát thương không?

Không. Phần đánh bóng hình ảnh như hiệu ứng nút bấm hay số sát thương thuộc về skill game feel.

Ngăn xếp màn hình là gì?

Đó là cách chuyển giữa màn hình tiêu đề, game, tạm dừng và cài đặt mà không bị rối cờ trạng thái.

Nó có dịch văn bản UI không?

Việc dịch được coi là bản địa hóa, và skill chỉ đến phần đó trong tài liệu tham khảo của nó.

Chi tiết

Mô tả gốc của tác giả

Design and build game UI/UX — HUDs, menus, and overlays — that survive every screen: anchor- based responsive layout, resolution/aspect scaling and safe areas, keyboard/gamepad focus navigation, a screen/menu state stack, and event-driven (not polled) HUD updates. Engine- neutral patterns that pair with the detected engine's UI skill. Use when the user mentions HUD, health bar, main menu, pause menu, settings screen, UI layout, anchors, UI scaling, aspect ratio, safe area, controller/keyboard menu navigation, or wiring UI to game state.

repo: gamedev-skills/awesome-gamedev-agent-skills

Độ phổ biến

Sao GitHub
6.6k
Vị trí xếp hạng
#13798
Giấy phép
Apache-2.0
Cập nhật
28/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự