claude-code-arcane 2.2.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +104 -55
- package/agents/career/career-strategist.md +88 -0
- package/agents/career/cv-reviewer.md +81 -0
- package/agents/career/hiring-manager.md +68 -0
- package/agents/career/mock-interviewer.md +76 -0
- package/agents/freelance/client-screener.md +84 -0
- package/agents/freelance/discovery-call.md +65 -0
- package/agents/freelance/pipeline-strategist.md +99 -0
- package/agents/freelance/proposal-reviewer.md +82 -0
- package/agents/game/ue-blueprint-specialist.md +125 -0
- package/agents/game/ue-gas-specialist.md +133 -0
- package/agents/game/ue-umg-specialist.md +131 -0
- package/dist/cli.js +57 -13
- package/docs/RELEASE-SETUP.md +1 -1
- package/docs/SKILLS-CATALOG.md +67 -4
- package/docs/USER-GUIDE.md +77 -72
- package/docs/agent-hierarchy.md +21 -1
- package/docs/presentations/build_arcane_deck.py +2 -2
- package/docs/presentations/build_arcane_deck_12.py +2 -2
- package/hooks/detect-unreal.sh +90 -0
- package/package.json +2 -2
- package/profiles/freelance.yaml +43 -0
- package/profiles/job-hunt.yaml +5 -2
- package/profiles/unreal-dev.yaml +97 -0
- package/rules/drafter-reviewer.md +16 -3
- package/rules/freelance-guardrails.md +53 -0
- package/rules/gamedev/unreal-code.md +125 -0
- package/skills/career-registry/SKILL.md +95 -0
- package/skills/career-registry/scripts/career_registry.py +488 -0
- package/skills/client-screen/SKILL.md +83 -0
- package/skills/client-screen/references/red-flags.md +95 -0
- package/skills/cover-letter/SKILL.md +4 -3
- package/skills/cv-tailor/SKILL.md +11 -2
- package/skills/freelance-deliver/SKILL.md +90 -0
- package/skills/freelance-hunt/SKILL.md +126 -0
- package/skills/freelance-hunt/references/templates/Connects.md +39 -0
- package/skills/freelance-hunt/references/templates/Contrato.md +60 -0
- package/skills/freelance-hunt/references/templates/Propuesta.md +66 -0
- package/skills/freelance-kickoff/SKILL.md +94 -0
- package/skills/freelance-pipeline/SKILL.md +109 -0
- package/skills/freelance-pipeline/scripts/import_history.py +425 -0
- package/skills/freelance-profile/SKILL.md +93 -0
- package/skills/freelance-proposal/SKILL.md +112 -0
- package/skills/freelance-scan/SKILL.md +196 -0
- package/skills/freelance-scan/references/dedup.md +35 -0
- package/skills/freelance-scan/references/platforms.md +167 -0
- package/skills/freelance-scan/scripts/freelance_search.py +1077 -0
- package/skills/install-mcp/SKILL.md +135 -46
- package/skills/install-mcp/references/unreal-operations.md +55 -0
- package/skills/interview-prep/SKILL.md +11 -3
- package/skills/job-aplicar/SKILL.md +5 -1
- package/skills/job-hunt/SKILL.md +17 -0
- package/skills/job-outcome/SKILL.md +15 -1
- package/skills/job-upskill/SKILL.md +10 -2
- package/skills/ue-actor-component-architecture/SKILL.md +509 -0
- package/skills/ue-actor-component-architecture/references/actor-lifecycle.md +301 -0
- package/skills/ue-actor-component-architecture/references/component-types.md +592 -0
- package/skills/ue-ai-navigation/SKILL.md +526 -0
- package/skills/ue-ai-navigation/references/behavior-tree-patterns.md +392 -0
- package/skills/ue-ai-navigation/references/behavior-tree-workflow.md +107 -0
- package/skills/ue-ai-navigation/references/custom-bttask.md +104 -0
- package/skills/ue-ai-navigation/references/eqs-reference.md +423 -0
- package/skills/ue-animation-system/SKILL.md +521 -0
- package/skills/ue-animation-system/references/anim-notify-reference.md +486 -0
- package/skills/ue-animation-system/references/locomotion-setup.md +550 -0
- package/skills/ue-async-threading/SKILL.md +433 -0
- package/skills/ue-async-threading/references/thread-safety-guide.md +213 -0
- package/skills/ue-async-threading/references/threading-patterns.md +345 -0
- package/skills/ue-audio-system/SKILL.md +527 -0
- package/skills/ue-audio-system/references/audio-setup-patterns.md +700 -0
- package/skills/ue-blueprints/SKILL.md +134 -0
- package/skills/ue-blueprints/references/communication.md +82 -0
- package/skills/ue-character-movement/SKILL.md +475 -0
- package/skills/ue-character-movement/references/cmc-extension-patterns.md +335 -0
- package/skills/ue-character-movement/references/movement-pipeline.md +189 -0
- package/skills/ue-cpp-foundations/SKILL.md +533 -0
- package/skills/ue-cpp-foundations/references/components-and-gc.md +107 -0
- package/skills/ue-cpp-foundations/references/container-patterns.md +544 -0
- package/skills/ue-cpp-foundations/references/delegate-patterns.md +497 -0
- package/skills/ue-cpp-foundations/references/gameplay-classes-cpp.md +136 -0
- package/skills/ue-cpp-foundations/references/property-specifiers.md +306 -0
- package/skills/ue-data-assets-tables/SKILL.md +527 -0
- package/skills/ue-data-assets-tables/references/asset-loading-patterns.md +306 -0
- package/skills/ue-data-assets-tables/references/data-driven-design.md +378 -0
- package/skills/ue-editor-tools/SKILL.md +523 -0
- package/skills/ue-editor-tools/references/detail-customization-patterns.md +395 -0
- package/skills/ue-editor-tools/references/editor-module-setup.md +480 -0
- package/skills/ue-game-features/SKILL.md +477 -0
- package/skills/ue-game-features/references/experience-system.md +222 -0
- package/skills/ue-game-features/references/game-feature-patterns.md +308 -0
- package/skills/ue-gameplay-abilities/SKILL.md +518 -0
- package/skills/ue-gameplay-abilities/references/ability-task-reference.md +391 -0
- package/skills/ue-gameplay-abilities/references/gameplay-effect-reference.md +397 -0
- package/skills/ue-gameplay-abilities/references/gas-setup-patterns.md +369 -0
- package/skills/ue-gameplay-framework/SKILL.md +466 -0
- package/skills/ue-gameplay-framework/references/framework-class-map.md +243 -0
- package/skills/ue-input-system/SKILL.md +394 -0
- package/skills/ue-input-system/references/cpp-setup.md +131 -0
- package/skills/ue-input-system/references/enhanced-input-workflow.md +117 -0
- package/skills/ue-input-system/references/input-action-reference.md +731 -0
- package/skills/ue-mass-entity/SKILL.md +476 -0
- package/skills/ue-mass-entity/references/mass-entity-patterns.md +319 -0
- package/skills/ue-mass-entity/references/mass-fragment-reference.md +119 -0
- package/skills/ue-materials-rendering/SKILL.md +526 -0
- package/skills/ue-materials-rendering/references/material-parameter-reference.md +216 -0
- package/skills/ue-materials-rendering/references/post-process-settings.md +383 -0
- package/skills/ue-module-build-system/SKILL.md +487 -0
- package/skills/ue-module-build-system/references/build-cs-reference.md +418 -0
- package/skills/ue-module-build-system/references/common-build-errors.md +381 -0
- package/skills/ue-naming-conventions/SKILL.md +142 -0
- package/skills/ue-naming-conventions/references/asset-name-modifiers.md +233 -0
- package/skills/ue-naming-conventions/references/content-structure.md +83 -0
- package/skills/ue-networking-replication/SKILL.md +452 -0
- package/skills/ue-networking-replication/references/replication-patterns.md +526 -0
- package/skills/ue-networking-replication/references/rpc-decision-guide.md +393 -0
- package/skills/ue-niagara-effects/SKILL.md +531 -0
- package/skills/ue-niagara-effects/references/niagara-data-interfaces.md +491 -0
- package/skills/ue-niagara-effects/references/niagara-parameter-types.md +153 -0
- package/skills/ue-niagara-effects/references/niagara-workflow.md +115 -0
- package/skills/ue-packaging/SKILL.md +116 -0
- package/skills/ue-physics-collision/SKILL.md +423 -0
- package/skills/ue-physics-collision/references/collision-channel-setup.md +218 -0
- package/skills/ue-physics-collision/references/trace-patterns.md +499 -0
- package/skills/ue-procedural-generation/SKILL.md +505 -0
- package/skills/ue-procedural-generation/references/pcg-node-reference.md +381 -0
- package/skills/ue-procedural-generation/references/procedural-mesh-patterns.md +940 -0
- package/skills/ue-project-context/SKILL.md +305 -0
- package/skills/ue-sequencer-cinematics/SKILL.md +506 -0
- package/skills/ue-sequencer-cinematics/references/sequencer-patterns.md +629 -0
- package/skills/ue-serialization-savegames/SKILL.md +524 -0
- package/skills/ue-serialization-savegames/references/save-system-architecture.md +705 -0
- package/skills/ue-state-trees/SKILL.md +489 -0
- package/skills/ue-state-trees/references/state-tree-mass-integration.md +184 -0
- package/skills/ue-state-trees/references/state-tree-patterns.md +321 -0
- package/skills/ue-testing-debugging/SKILL.md +520 -0
- package/skills/ue-testing-debugging/references/automation-test-patterns.md +387 -0
- package/skills/ue-testing-debugging/references/profiling-commands.md +357 -0
- package/skills/ue-ui-umg-slate/SKILL.md +431 -0
- package/skills/ue-ui-umg-slate/references/common-ui-setup.md +484 -0
- package/skills/ue-ui-umg-slate/references/widget-types.md +487 -0
- package/skills/ue-world-level-streaming/SKILL.md +518 -0
- package/skills/ue-world-level-streaming/references/streaming-patterns.md +414 -0
- package/templates/gamedev/unreal-project-context.md +107 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# Mass Entity Patterns
|
|
2
|
+
|
|
3
|
+
Code templates for Mass Entity framework. All signatures source-verified from UE headers.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Custom Fragment and Tag Definitions
|
|
8
|
+
|
|
9
|
+
```cpp
|
|
10
|
+
#include "MassEntityTypes.h"
|
|
11
|
+
|
|
12
|
+
// Per-entity mutable fragment
|
|
13
|
+
USTRUCT()
|
|
14
|
+
struct FHealthFragment : public FMassFragment
|
|
15
|
+
{
|
|
16
|
+
GENERATED_BODY()
|
|
17
|
+
UPROPERTY(EditAnywhere)
|
|
18
|
+
float Current = 100.f;
|
|
19
|
+
UPROPERTY(EditAnywhere)
|
|
20
|
+
float Max = 100.f;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Zero-size tag (no data members allowed)
|
|
24
|
+
USTRUCT()
|
|
25
|
+
struct FPoisonedTag : public FMassTag
|
|
26
|
+
{
|
|
27
|
+
GENERATED_BODY()
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Shared fragment — one instance per archetype, mutable
|
|
31
|
+
USTRUCT()
|
|
32
|
+
struct FSquadSharedFragment : public FMassSharedFragment
|
|
33
|
+
{
|
|
34
|
+
GENERATED_BODY()
|
|
35
|
+
UPROPERTY(EditAnywhere)
|
|
36
|
+
int32 SquadID = 0;
|
|
37
|
+
UPROPERTY(EditAnywhere)
|
|
38
|
+
FLinearColor SquadColor = FLinearColor::White;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Const shared fragment — immutable after archetype creation
|
|
42
|
+
USTRUCT()
|
|
43
|
+
struct FMeshConfigFragment : public FMassConstSharedFragment
|
|
44
|
+
{
|
|
45
|
+
GENERATED_BODY()
|
|
46
|
+
UPROPERTY(EditAnywhere)
|
|
47
|
+
TSoftObjectPtr<UStaticMesh> Mesh;
|
|
48
|
+
UPROPERTY(EditAnywhere)
|
|
49
|
+
float LODDistance = 5000.f;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Chunk fragment — per memory chunk, not per entity
|
|
53
|
+
USTRUCT()
|
|
54
|
+
struct FChunkLODFragment : public FMassChunkFragment
|
|
55
|
+
{
|
|
56
|
+
GENERATED_BODY()
|
|
57
|
+
int32 CurrentLOD = 0;
|
|
58
|
+
};
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## UMassProcessor Subclass Template
|
|
64
|
+
|
|
65
|
+
```cpp
|
|
66
|
+
// MyMovementProcessor.h
|
|
67
|
+
#pragma once
|
|
68
|
+
#include "MassProcessor.h"
|
|
69
|
+
#include "MyMovementProcessor.generated.h"
|
|
70
|
+
|
|
71
|
+
UCLASS()
|
|
72
|
+
class UMyMovementProcessor : public UMassProcessor
|
|
73
|
+
{
|
|
74
|
+
GENERATED_BODY()
|
|
75
|
+
public:
|
|
76
|
+
UMyMovementProcessor();
|
|
77
|
+
protected:
|
|
78
|
+
virtual void ConfigureQueries(const TSharedRef<FMassEntityManager>& EntityManager) override;
|
|
79
|
+
virtual void Execute(FMassEntityManager& EntityManager,
|
|
80
|
+
FMassExecutionContext& Context) override;
|
|
81
|
+
private:
|
|
82
|
+
FMassEntityQuery MovementQuery;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// MyMovementProcessor.cpp
|
|
86
|
+
#include "MyMovementProcessor.h"
|
|
87
|
+
#include "MassCommonFragments.h"
|
|
88
|
+
#include "MassMovementFragments.h"
|
|
89
|
+
|
|
90
|
+
UMyMovementProcessor::UMyMovementProcessor()
|
|
91
|
+
{
|
|
92
|
+
ProcessingPhase = EMassProcessingPhase::PrePhysics;
|
|
93
|
+
ExecutionFlags = static_cast<int32>(
|
|
94
|
+
EProcessorExecutionFlags::Server |
|
|
95
|
+
EProcessorExecutionFlags::Standalone);
|
|
96
|
+
ExecutionOrder.ExecuteInGroup = UE::Mass::ProcessorGroupNames::Movement;
|
|
97
|
+
bRequiresGameThreadExecution = false;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
void UMyMovementProcessor::ConfigureQueries(const TSharedRef<FMassEntityManager>& EntityManager)
|
|
101
|
+
{
|
|
102
|
+
MovementQuery.AddRequirement<FTransformFragment>(
|
|
103
|
+
EMassFragmentAccess::ReadWrite, EMassFragmentPresence::All);
|
|
104
|
+
MovementQuery.AddRequirement<FMassVelocityFragment>(
|
|
105
|
+
EMassFragmentAccess::ReadOnly, EMassFragmentPresence::All);
|
|
106
|
+
MovementQuery.AddTagRequirement<FDeadTag>(EMassFragmentPresence::None);
|
|
107
|
+
RegisterQuery(MovementQuery);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
void UMyMovementProcessor::Execute(FMassEntityManager& EntityManager,
|
|
111
|
+
FMassExecutionContext& Context)
|
|
112
|
+
{
|
|
113
|
+
MovementQuery.ForEachEntityChunk(Context,
|
|
114
|
+
[](FMassExecutionContext& Context)
|
|
115
|
+
{
|
|
116
|
+
const int32 Num = Context.GetNumEntities();
|
|
117
|
+
TArrayView<FTransformFragment> Transforms =
|
|
118
|
+
Context.GetMutableFragmentView<FTransformFragment>();
|
|
119
|
+
TConstArrayView<FMassVelocityFragment> Velocities =
|
|
120
|
+
Context.GetFragmentView<FMassVelocityFragment>();
|
|
121
|
+
const float DT = Context.GetDeltaTimeSeconds();
|
|
122
|
+
|
|
123
|
+
for (int32 i = 0; i < Num; ++i)
|
|
124
|
+
{
|
|
125
|
+
Transforms[i].GetMutableTransform().AddToTranslation(
|
|
126
|
+
Velocities[i].Value * DT);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Observer Processor Template
|
|
135
|
+
|
|
136
|
+
```cpp
|
|
137
|
+
// HealthAddedObserver.h
|
|
138
|
+
#pragma once
|
|
139
|
+
#include "MassObserverProcessor.h"
|
|
140
|
+
#include "HealthAddedObserver.generated.h"
|
|
141
|
+
|
|
142
|
+
UCLASS()
|
|
143
|
+
class UHealthAddedObserver : public UMassObserverProcessor
|
|
144
|
+
{
|
|
145
|
+
GENERATED_BODY()
|
|
146
|
+
public:
|
|
147
|
+
UHealthAddedObserver()
|
|
148
|
+
{
|
|
149
|
+
ObservedType = FHealthFragment::StaticStruct();
|
|
150
|
+
ObservedOperations = EMassObservedOperationFlags::AddElement;
|
|
151
|
+
}
|
|
152
|
+
protected:
|
|
153
|
+
virtual void ConfigureQueries(const TSharedRef<FMassEntityManager>& EntityManager) override;
|
|
154
|
+
virtual void Execute(FMassEntityManager& EntityManager,
|
|
155
|
+
FMassExecutionContext& Context) override;
|
|
156
|
+
private:
|
|
157
|
+
FMassEntityQuery ObserverQuery;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// HealthAddedObserver.cpp
|
|
161
|
+
void UHealthAddedObserver::ConfigureQueries(const TSharedRef<FMassEntityManager>& EntityManager)
|
|
162
|
+
{
|
|
163
|
+
ObserverQuery.AddRequirement<FHealthFragment>(
|
|
164
|
+
EMassFragmentAccess::ReadWrite, EMassFragmentPresence::All);
|
|
165
|
+
ObserverQuery.AddRequirement<FTransformFragment>(
|
|
166
|
+
EMassFragmentAccess::ReadOnly, EMassFragmentPresence::All);
|
|
167
|
+
RegisterQuery(ObserverQuery);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
void UHealthAddedObserver::Execute(FMassEntityManager& EntityManager,
|
|
171
|
+
FMassExecutionContext& Context)
|
|
172
|
+
{
|
|
173
|
+
ObserverQuery.ForEachEntityChunk(Context,
|
|
174
|
+
[](FMassExecutionContext& Context)
|
|
175
|
+
{
|
|
176
|
+
TArrayView<FHealthFragment> Healths =
|
|
177
|
+
Context.GetMutableFragmentView<FHealthFragment>();
|
|
178
|
+
for (int32 i = 0; i < Context.GetNumEntities(); ++i)
|
|
179
|
+
{
|
|
180
|
+
// Initialize health on fragment addition
|
|
181
|
+
Healths[i].Current = Healths[i].Max;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## FMassEntityView Usage
|
|
190
|
+
|
|
191
|
+
```cpp
|
|
192
|
+
void ApplyDamage(FMassEntityManager& EntityManager,
|
|
193
|
+
FMassEntityHandle Target, float Damage)
|
|
194
|
+
{
|
|
195
|
+
if (!EntityManager.IsEntityValid(Target))
|
|
196
|
+
{
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
FMassEntityView View(EntityManager, Target);
|
|
201
|
+
|
|
202
|
+
if (View.GetFragmentDataPtr<FHealthFragment>() == nullptr)
|
|
203
|
+
{
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
FHealthFragment& Health = View.GetFragmentData<FHealthFragment>();
|
|
208
|
+
Health.Current = FMath::Max(0.f, Health.Current - Damage);
|
|
209
|
+
|
|
210
|
+
// Check tag presence
|
|
211
|
+
if (!View.HasTag<FDeadTag>() && Health.Current <= 0.f)
|
|
212
|
+
{
|
|
213
|
+
// Add tag outside processor — direct mutation is safe here
|
|
214
|
+
EntityManager.AddTagToEntity(Target, FDeadTag::StaticStruct());
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Important:** Never store `FMassEntityView` across frames. Create a fresh view each time.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Deferred Command Patterns
|
|
224
|
+
|
|
225
|
+
Use inside `ForEachEntityChunk` -- never mutate entities directly during iteration:
|
|
226
|
+
|
|
227
|
+
```cpp
|
|
228
|
+
Query.ForEachEntityChunk(Context,
|
|
229
|
+
[](FMassExecutionContext& Context)
|
|
230
|
+
{
|
|
231
|
+
auto Entities = Context.GetEntities();
|
|
232
|
+
auto Healths = Context.GetFragmentView<FHealthFragment>();
|
|
233
|
+
|
|
234
|
+
for (int32 i = 0; i < Context.GetNumEntities(); ++i)
|
|
235
|
+
{
|
|
236
|
+
if (Healths[i].Current <= 0.f)
|
|
237
|
+
{
|
|
238
|
+
// Tag for death processing
|
|
239
|
+
Context.Defer().AddTag<FDeadTag>(Entities[i]);
|
|
240
|
+
|
|
241
|
+
// Remove fragment
|
|
242
|
+
Context.Defer().RemoveFragment<FHealthFragment>(Entities[i]);
|
|
243
|
+
|
|
244
|
+
// Swap tags atomically
|
|
245
|
+
Context.Defer().SwapTags<FAliveTag, FDeadTag>(Entities[i]);
|
|
246
|
+
|
|
247
|
+
// Add fragment with initial data using FMassCommandAddFragmentInstances<T>
|
|
248
|
+
// Template args are the fragment types; call Add(Entity, FragmentValue) pattern
|
|
249
|
+
Context.Defer().PushCommand<FMassCommandAddFragmentInstances<FHealthFragment>>(
|
|
250
|
+
Entities[i], FHealthFragment{});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**Execution order:** Create -> Add -> Remove -> ChangeComposition -> Set -> Destroy
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Custom Trait Template
|
|
261
|
+
|
|
262
|
+
```cpp
|
|
263
|
+
// MyHealthTrait.h
|
|
264
|
+
#pragma once
|
|
265
|
+
#include "MassEntityTraitBase.h"
|
|
266
|
+
#include "MyHealthTrait.generated.h"
|
|
267
|
+
|
|
268
|
+
UCLASS(meta = (DisplayName = "Health"))
|
|
269
|
+
class UMyHealthTrait : public UMassEntityTraitBase
|
|
270
|
+
{
|
|
271
|
+
GENERATED_BODY()
|
|
272
|
+
public:
|
|
273
|
+
UPROPERTY(EditAnywhere, Category = Health)
|
|
274
|
+
float DefaultHealth = 100.f;
|
|
275
|
+
|
|
276
|
+
UPROPERTY(EditAnywhere, Category = Health)
|
|
277
|
+
float DefaultMaxHealth = 100.f;
|
|
278
|
+
|
|
279
|
+
protected:
|
|
280
|
+
virtual void BuildTemplate(
|
|
281
|
+
FMassEntityTemplateBuildContext& BuildContext,
|
|
282
|
+
const UWorld& World) const override
|
|
283
|
+
{
|
|
284
|
+
// Add fragment and set initial values using AddFragment_GetRef
|
|
285
|
+
FHealthFragment& HealthDefaults = BuildContext.AddFragment_GetRef<FHealthFragment>();
|
|
286
|
+
HealthDefaults.Current = DefaultHealth;
|
|
287
|
+
HealthDefaults.Max = DefaultMaxHealth;
|
|
288
|
+
|
|
289
|
+
// Add a tag
|
|
290
|
+
BuildContext.AddTag<FAliveTag>();
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Assign traits to `UMassEntityConfigAsset` in the editor. `AMassSpawner` references the config asset and controls spawn count and spatial distribution.
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## ISM Representation Setup
|
|
300
|
+
|
|
301
|
+
Representation uses `UMassVisualizationTrait` on entity config assets. The trait adds `FMassRepresentationFragment` (per-entity) and `FMassRepresentationParameters` (const shared) to the archetype.
|
|
302
|
+
|
|
303
|
+
Key configuration on the trait:
|
|
304
|
+
- Static mesh assignment per LOD significance range
|
|
305
|
+
- LOD distance thresholds (`EMassLOD::High/Medium/Low/Off`)
|
|
306
|
+
- Actor classes for `EMassRepresentationType::HighResSpawnedActor` and `LowResSpawnedActor` (close-up detail)
|
|
307
|
+
|
|
308
|
+
Force game-thread execution for processors touching ISM:
|
|
309
|
+
|
|
310
|
+
```cpp
|
|
311
|
+
// In your processor's shared fragment traits specialization:
|
|
312
|
+
template<>
|
|
313
|
+
struct TMassSharedFragmentTraits<FMyVisualizationFragment>
|
|
314
|
+
{
|
|
315
|
+
static constexpr bool GameThreadOnly = true;
|
|
316
|
+
};
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
`UMassRepresentationSubsystem` manages ISM component pools and handles LOD transitions between `StaticMeshInstance`, `HighResSpawnedActor`, and `LowResSpawnedActor` representation types.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Mass Fragment Reference
|
|
2
|
+
|
|
3
|
+
Built-in fragment types, shared fragments, and trait classes from the Mass Entity framework. All types verified from UE source headers.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Per-Entity Fragments
|
|
8
|
+
|
|
9
|
+
| Fragment | Header | Key Fields | Purpose |
|
|
10
|
+
|----------|--------|------------|---------|
|
|
11
|
+
| `FTransformFragment` | `MassCommonFragments.h` | `FTransform Transform` | Entity world transform (location, rotation, scale) |
|
|
12
|
+
| `FMassVelocityFragment` | `MassMovementFragments.h` | `FVector Value` | Linear velocity vector |
|
|
13
|
+
| `FMassForceFragment` | `MassMovementFragments.h` | `FVector Value` | Applied force vector (consumed by velocity processor) |
|
|
14
|
+
| `FAgentRadiusFragment` | `MassCommonFragments.h` | `float Radius` | Agent collision/avoidance radius |
|
|
15
|
+
| `FMassMoveTargetFragment` | `MassNavigationFragments.h` | `FVector Center`, `float DesiredSpeed`, `FMassMovementAction Action` | Navigation move target with speed and action |
|
|
16
|
+
| `FMassRepresentationFragment` | `MassRepresentationFragments.h` | `EMassRepresentationType CurrentRepresentation`, `EMassRepresentationType PrevRepresentation` | Current and previous visual representation state |
|
|
17
|
+
| `FMassRepresentationLODFragment` | `MassRepresentationFragments.h` | `TEnumAsByte<EMassLOD::Type> LOD`, `TEnumAsByte<EMassLOD::Type> PrevLOD`, `EMassVisibility Visibility`, `float LODSignificance` | Per-entity LOD level and visibility state |
|
|
18
|
+
|
|
19
|
+
### FTransformFragment
|
|
20
|
+
|
|
21
|
+
The most common fragment. Stores a full `FTransform` with location, rotation, and scale. Access with `GetTransform()` (const) and `GetMutableTransform()` (mutable).
|
|
22
|
+
|
|
23
|
+
### FMassVelocityFragment / FMassForceFragment
|
|
24
|
+
|
|
25
|
+
Both store an `FVector Value` field. Forces are consumed by the velocity integration processor each frame. Velocity is then consumed by movement processors that update `FTransformFragment`.
|
|
26
|
+
|
|
27
|
+
### FMassMoveTargetFragment
|
|
28
|
+
|
|
29
|
+
Used by navigation and crowd systems. Contains the desired move target position, speed, and a movement action enum indicating the current navigation intent (move, stand, animate).
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Chunk Fragments
|
|
34
|
+
|
|
35
|
+
Chunk fragments (`FMassChunkFragment`) store per-memory-chunk data shared across all entities in a chunk. `FMassRepresentationLODFragment` is NOT a chunk fragment — it is a per-entity `FMassFragment` (see Per-Entity Fragments above). Use `AddChunkFragment<T>()` in `BuildContext` only for types that inherit `FMassChunkFragment`.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Shared Fragments (Per-Archetype)
|
|
40
|
+
|
|
41
|
+
| Fragment | Type | Header | Key Fields |
|
|
42
|
+
|----------|------|--------|------------|
|
|
43
|
+
| `FMassRepresentationParameters` | Const Shared | `MassRepresentationFragments.h` | `EMassRepresentationType LODRepresentation[EMassLOD::Max]`, `float NotVisibleUpdateRate`, `bKeepLowResActors` |
|
|
44
|
+
| `FMassMovementParameters` | Const Shared | `MassMovementFragments.h` | `float MaxSpeed`, `float MaxAcceleration`, `float DefaultDesiredSpeed` |
|
|
45
|
+
|
|
46
|
+
### FMassRepresentationParameters
|
|
47
|
+
|
|
48
|
+
Immutable const shared fragment configuring visual representation for an archetype. Defines `LODRepresentation[EMassLOD::Max]` which maps each LOD level to an `EMassRepresentationType` (e.g. `StaticMeshInstance`, `HighResSpawnedActor`, `LowResSpawnedActor`, or `None`). Also controls update rate for non-visible entities and actor retention behavior. Set via `UMassVisualizationTrait`.
|
|
49
|
+
|
|
50
|
+
### FMassMovementParameters
|
|
51
|
+
|
|
52
|
+
Immutable const shared fragment defining movement constraints for an archetype. Contains `MaxSpeed`, `MaxAcceleration`, `DefaultDesiredSpeed`, and movement style configurations. No `MaxDeceleration` field exists — deceleration is handled implicitly via force/velocity integration. Used by movement processors to generate desired velocities.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Trait Classes
|
|
57
|
+
|
|
58
|
+
Traits are `UMassEntityTraitBase` subclasses that add fragments to entity templates during `BuildTemplate()`.
|
|
59
|
+
|
|
60
|
+
| Trait | Header | Fragments Added | Purpose |
|
|
61
|
+
|-------|--------|----------------|---------|
|
|
62
|
+
| `UMassAssortedFragmentsTrait` | `MassEntityConfigAsset.h` | User-specified list | Add arbitrary fragments/tags via editor list |
|
|
63
|
+
| `UMassVisualizationTrait` | `MassVisualizationTrait.h` | `FMassRepresentationFragment`, `FMassRepresentationParameters` | ISM visualization setup with LOD |
|
|
64
|
+
| `UMassReplicationTrait` | `MassReplicationTrait.h` | Replication fragments | Network replication support |
|
|
65
|
+
|
|
66
|
+
### UMassAssortedFragmentsTrait
|
|
67
|
+
|
|
68
|
+
The simplest trait. Exposes an editable list of fragment `UScriptStruct` types in the editor. Each listed type is added to the entity archetype. Use for adding custom fragments without writing a custom trait class.
|
|
69
|
+
|
|
70
|
+
### UMassVisualizationTrait
|
|
71
|
+
|
|
72
|
+
Configures ISM-based rendering. Adds both the per-entity `FMassRepresentationFragment` and the const shared `FMassRepresentationParameters`. Configure mesh assets via `StaticMeshInstanceDesc` and LOD distances via `LODParams` directly on the trait in the entity config editor. Note: this class is soft-deprecated; prefer `UMassMovableVisualizationTrait` or `UMassStationaryVisualizationTrait` for new work.
|
|
73
|
+
|
|
74
|
+
### UMassReplicationTrait
|
|
75
|
+
|
|
76
|
+
Enables Mass entity replication for multiplayer. Adds the necessary replication fragments and registers entities with the Mass replication system. Requires the MassReplication plugin module.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## MassCrowd Fragments
|
|
81
|
+
|
|
82
|
+
| Type | Kind | Purpose |
|
|
83
|
+
|------|------|---------|
|
|
84
|
+
| `FMassCrowdTag` | Tag | Marks entity as part of the crowd system |
|
|
85
|
+
| `FMassCrowdLaneTrackingFragment` | Fragment | Tracks current ZoneGraph lane and position along it |
|
|
86
|
+
|
|
87
|
+
### MassCrowd Integration
|
|
88
|
+
|
|
89
|
+
Entities tagged with `FMassCrowdTag` are processed by `UMassCrowdSubsystem`. The lane tracking fragment maintains the entity's current lane ID, distance along the lane, and lane-relative offset.
|
|
90
|
+
|
|
91
|
+
ZoneGraph lanes define navigation paths as connected directed graphs. The crowd system handles:
|
|
92
|
+
- Lane assignment and transitions
|
|
93
|
+
- Density-based speed modulation
|
|
94
|
+
- Waiting slot allocation at intersections
|
|
95
|
+
- Avoidance between crowd agents
|
|
96
|
+
|
|
97
|
+
`UMassCrowdSubsystem` is thread-safe (`TMassExternalSubsystemTraits<UMassCrowdSubsystem>::GameThreadOnly = false`) and can be accessed from parallel processors via `AddSubsystemRequirement`.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## EMassRepresentationType Values
|
|
102
|
+
|
|
103
|
+
| Value | Description |
|
|
104
|
+
|-------|-------------|
|
|
105
|
+
| `StaticMeshInstance` | Instanced static mesh (most efficient, distant) |
|
|
106
|
+
| `HighResSpawnedActor` | Full actor spawned for high LOD (close-up, full gameplay) |
|
|
107
|
+
| `LowResSpawnedActor` | Reduced actor for low-res LOD |
|
|
108
|
+
| `None` | No visual representation |
|
|
109
|
+
|
|
110
|
+
## EMassLOD Values
|
|
111
|
+
|
|
112
|
+
| Value | Typical Usage |
|
|
113
|
+
|-------|--------------|
|
|
114
|
+
| `High` | Close to camera, actor representation |
|
|
115
|
+
| `Medium` | Mid-range, full ISM detail |
|
|
116
|
+
| `Low` | Far range, simplified ISM |
|
|
117
|
+
| `Off` | Beyond render distance, simulation only |
|
|
118
|
+
|
|
119
|
+
LOD transitions are managed by the representation system. Entities promoted to `HighResSpawnedActor` at high LOD significance gain full gameplay capabilities (collision, animation, interaction). When demoted back to `StaticMeshInstance` at lower LODs, the actor is returned to a pool.
|