Skip to content

Ways to query or obtain all entities of a world #8

@UplinkPhobia

Description

@UplinkPhobia

If I am not mistaken, there is no proper way to simply query all entities in a world, as queries require a filter to include entities.

It would be nice to be able to query all entities, whether with something like

world.Q()  # Same result as a query matching all entities

or even by allowing to iterate over the world object

for entity in world:
    pass

The lack of iterator on worlds also seems to create an infinite loop when one tries to iterate over them. Implementing an iterator or raising an error would make things clearer.

A bit further than that, this raises the question to include or not the global entity of the world. In my opinion, it seems logical that the query would not include it, while the iterator would, as the query "feels" external to the world, while the iterator is internal (someone queries about the world, but iterates on/from the world).

That's my suggestion! I hope it makes sense.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions