Search Unity

Flagging for filtering: Better to add/remove empty component or poll over component data int.

Discussion in 'Entity Component System' started by iam2bam, Dec 16, 2018.

  1. iam2bam

    iam2bam

    Joined:
    Mar 9, 2016
    Posts:
    36
    System groups/styles

    Poll
    : Set a CD raised value to flag as event raised. Unset when processing.
    While processing modifies CD in-place, Burst compiled.

    EvQueue: Uses a Queue to store and then apply events to objects using ComponentDataFromEntity.
    No extra components or entities.
    Multiple events per entity.


    Batch: Creates one entity per event to keep the ECS flow.
    Queues events and turns them into "entities with just the one event CD" via
    These event-entities last 1 frame.
    Multiple events per entity.

    Dispatch: Uses a HashMultiMap to map event type to a queue, then applying using ComponentDataFromEntity.
    Jobs by event-type could be sequenced or in parallel.
    No extra components or entities.
    Multiple events per entity.

    Steps

    _Raise: Raise events. Uses Config.instance.eventChance and a random number generator to

    _CreateEvents: (Only for EntEv/Batch SG) All queued events are asigned to newly created entities. These entities last 1 frame.

    _Process: Do processing of the events, modify the object.


    Profiler screenshot

    A screenshot (was going to try all systems with 10M entities each but the allocator exploded crashing Unity:) )



    Here you can see how Dispatch at 10% event volume works ok like a queue (but prefilters by type) and queueing/batching runs as polling for 1%.
     
    NotaNaN and illinar like this.