$npx -y skills add teixasalone/UnrealEngine5-Skills --skill ue5-cpp-gameplayUE5.6/UE5.7 gameplay C++ implementation for Actors, Components, DataAssets, and gameplay logic. Use when requests ask to write .h/.cpp pairs, expose UPROPERTY/UFUNCTION to Blueprint, use GameplayTags, or build reusable component-based systems.
| 1 | # Quick Start |
| 2 | - Confirm target class type (`AActor`, `UActorComponent`, `UObject`, `USaveGame`, etc.). |
| 3 | - Define required Blueprint-facing API before implementation. |
| 4 | - Output both header and source files together. |
| 5 | |
| 6 | # UE5.7 API Anchors |
| 7 | - Reflection and UObject anchors: |
| 8 | - `UCLASS`, `USTRUCT`, `UENUM`, `UINTERFACE`, `GENERATED_BODY()` |
| 9 | - `UPROPERTY(...)`, `UFUNCTION(...)` |
| 10 | - Core gameplay type anchors: |
| 11 | - `AActor`, `UActorComponent`, `UDataAsset`, `UGameInstanceSubsystem` |
| 12 | - `TObjectPtr<>` in headers and `TSubclassOf<>` for class references |
| 13 | - Replication anchors: |
| 14 | - `GetLifetimeReplicatedProps(...)` |
| 15 | - `DOREPLIFETIME(...)` in `Net/UnrealNetwork.h` |
| 16 | - `ReplicatedUsing=OnRep_*`, `UFUNCTION(Server/Client/NetMulticast, ...)` |
| 17 | - Gameplay tag anchors: |
| 18 | - `FGameplayTag`, `FGameplayTagContainer` |
| 19 | - explicit tag request/match checks with safe fallback behavior |
| 20 | |
| 21 | # Implementation Stage Contract |
| 22 | - Every gameplay C++ task must define: |
| 23 | - Public header API surface (Blueprint/API visibility) |
| 24 | - Private runtime implementation path (`.cpp`) |
| 25 | - Ownership/lifetime model (constructor, init, teardown) |
| 26 | - Network authority rules (single-player only or replicated flow) |
| 27 | - Validation method (compile assumptions, usage examples, edge-case behavior) |
| 28 | - If any item is missing, the implementation spec is incomplete. |
| 29 | |
| 30 | # Workflow |
| 31 | ## 1) Type and File Shape |
| 32 | - Create type declarations with Unreal macros and UE5 pointer conventions (`TObjectPtr` in headers). |
| 33 | - Produce paired `.h` and `.cpp` with forward declarations in header and concrete includes in source. |
| 34 | - Keep class responsibility narrow and reusable. |
| 35 | |
| 36 | ## 2) Public API Design |
| 37 | - Define Blueprint API (`BlueprintCallable`, `BlueprintPure`, categories, metadata) before implementation. |
| 38 | - Expose minimal callable surface; keep helper methods non-UFUNCTION unless needed. |
| 39 | - Declare clear input/output contracts and failure behavior. |
| 40 | |
| 41 | ## 3) Runtime Implementation |
| 42 | - Implement logic in `.cpp` with null checks, authority guards, and explicit branch behavior. |
| 43 | - Keep tick usage opt-in; prefer event-driven updates. |
| 44 | - Handle initialization order (`BeginPlay`, `InitializeComponent`, or subsystem init) explicitly. |
| 45 | |
| 46 | ## 4) Replication and RPC (When Needed) |
| 47 | - Add replicated properties and `OnRep_*` handlers only for true client-visible state. |
| 48 | - Register properties in `GetLifetimeReplicatedProps(...)` with `DOREPLIFETIME(...)`. |
| 49 | - Use server-authoritative RPC entry points for client requests. |
| 50 | |
| 51 | ## 5) GameplayTags and Data-Driven Hooks |
| 52 | - Use `FGameplayTag`/`FGameplayTagContainer` with explicit tag names. |
| 53 | - Validate required tags at runtime and provide fallback for missing tags. |
| 54 | - Prefer DataAsset-driven config for tunables over hard-coded constants. |
| 55 | |
| 56 | ## 6) Validation Output |
| 57 | - Ensure output includes both files and required includes. |
| 58 | - Confirm Blueprint exposure, replication behavior, and error-handling paths are documented. |
| 59 | - Provide usage snippet or invocation flow when behavior is non-trivial. |
| 60 | |
| 61 | # Constraints |
| 62 | - Always provide matching `.h` and `.cpp` when creating a class. |
| 63 | - Use non-deprecated APIs compatible with UE5.6/UE5.7. |
| 64 | - Keep includes minimal; use forward declarations in headers. |
| 65 | - Avoid hardcoded asset paths unless explicitly requested. |
| 66 | - Prefer `TObjectPtr<>` in UPROPERTY object references in headers. |
| 67 | - Keep server-authoritative checks explicit for any network-affecting gameplay action. |
| 68 | |
| 69 | # Failure Handling |
| 70 | - Symptom: class compiles but is missing from Blueprint. |
| 71 | - Locate: missing `BlueprintType`/`Blueprintable`/`BlueprintCallable` metadata. |
| 72 | - Fix: add required reflection specifiers and regenerate project files/build. |
| 73 | - Symptom: unresolved symbol or include cycles. |
| 74 | - Locate: header include graph and forward declaration misuse. |
| 75 | - Fix: move heavy includes to `.cpp`, keep forward declarations in headers. |
| 76 | - Symptom: replicated property does not update on clients. |
| 77 | - Locate: `GetLifetimeReplicatedProps(...)` and actor/component replication flags. |
| 78 | - Fix: register with `DOREPLIFETIME(...)`, ensure owning actor replicates. |
| 79 | - Symptom: `OnRep_*` never fires. |
| 80 | - Locate: property write path and net role. |
| 81 | - Fix: mutate on server authority path and verify property actually changes. |
| 82 | - Symptom: RPC callable but ignored at runtime. |
| 83 | - Locate: RPC specifier and call site authority. |
| 84 | - Fix: enforce client->server request path and server-side validation. |
| 85 | - Symptom: GameplayTag logic silently fails. |
| 86 | - Locate: invalid tag names or missing tag config. |
| 87 | - Fix: validate tags on startup and guard with explicit fallback behavior. |
| 88 | |
| 89 | # UE5.6 / UE5.7 Compatibility Notes |
| 90 | - Reflection, replication, and GameplayTag APIs above are stable across UE5.6 and UE5.7. |
| 91 | - Favor stable core APIs over editor-only helpers when runtime beha |