Skip to content

Struct restriction #1

@chris-rgr

Description

@chris-rgr

Is there any specific reason that components need to be structs? Is that Lex/LeoECS purely being opinionated or am I missing something? Arrays are guaranteed to have a linear layout, even for reference types. Is this due to the indirection via the ItemPool struct?

I know that in an ideal performance-oriented world we'd just have structs filled with value fields, but having to handle references to components via ref is a pain (and potentially prone to errors, because, you know, structs generally shouldn't be passed around as refs most of the time...). So unless I'm missing something, allowing reference types as components wouldn't necessarily negatively impact performance for pools/systems that only utilize structs, right? If so, why not open up the architecture a little and drop the struct enforcing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions