MassEntity Overview & MassGameplay Overview
(另含 mass-entity-in-unreal-engine 目录页、overview-of-mass-gameplay-in-unreal-engine)
- MassEntity: gameplay-focused framework for data-oriented calculations.
- Fragment: atomic piece of data (Transform, Velocity, LOD Index). Collection instance associated with an ID = Entity. Built by Fragment composition; compositions can change at runtime. Fragments and Entities are data-only, no logic.
- Archetype: collection of Entities of identical composition. Entities in an Archetype organized in memory Chunks for best performance.
- Processors: stateless classes supplying logic; use EntityQuery to specify Fragment types; get batches regardless of entity identifiers.
- Tag: Fragment with no data; presence is data. ChunkFragment: per-Chunk data (e.g. LOD).
- MassCommandBuffer: composition changes during processing would move entity between archetypes; commands batch-processed at end of current processing batch.
- EntityView: safe access to other entities not currently processed. Serial processing is most efficient.
- Subsystems are World subsystems. MassEntity Manager creates/hosts archetypes, add/remove fragments, moves entities. Entity Templates from MassEntityConfig assets with Traits; parent inheritance. Trait = Fragments + Processors supplying functionality (Avoidance, Look-At, StateTree).
- MassGameplay: Representation (per LOD: high-res Actor, low-res Actor, ISM (vertex animation; experimental), none; pools actors), Spawner (MassSpawner Actor, Entity Definition, Distribution Generator), LOD (High/Medium/Low/Off; distances and max counts; significance 0.0–3.0; Visualization LOD with frustum, Simulation LOD for load balancing and variable update frequency, Replication LOD per viewer), Replication (experimental; one-way server→client; needs C++ for custom values), StateTree (configures data so right Processors run), Signals (named signal without payload; framework mostly pulling pattern), Movement, SmartObject.