Search Unity

Is it possible to influence how data is chunked?

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

  1. foxnne

    foxnne

    Joined:
    Apr 18, 2016
    Posts:
    59
    Apologies if this is a dumb question. I'm pretty new to ECS and I'm trying to learn.

    I'd like to build a system that handles very large numbers of grid tiles and positions of objects that act as "colliders" (occupied integer x,y coordinates that prevent objects from moving into specific tiles)

    In my mind the best way to do this would be to create a way to group entities by position into chunks similar to how ecs accesses chunks already. But how would you do this based on position rather than types of components added? And would it truly work?

    It seems like to be helpful, a chunk would need to load all of the objects near another object for collision checks or something similar + the objects right at the border of the chunk incase the object is about to move to another chunk. Also objects would constantly be moving around from chunk to chunk.

    Would the better option be to use a MultiHashmap and check for tiles or collisions using this?

    Thanks, any info would be great