githubEdit

Query-Techniques

Query-Techniques, running queries more efficiently.

Arch has a number of different ways to search and iterate over entities. There are currently exactly 4 ways to issue commands to your entities in queries.

While this may seem a bit complex at first, each of these ways has advantages and disadvantages and is perfect for specific situations. Let us start...

circle-info

All the queries listed below have been kept simple; each variant naturally also has the option of accessing the entity itself or other functionalities.

Query

Firstly, there is the type of query with which all examples were listed. Small and legible, you hardly have to worry.

World.Query(in desc, (ref Position pos, ref Velocity vel) => {
   Move(ref pos, ref vel);
});
circle-check
triangle-exclamation

Inline-Query

As an alternative, we have the slightly faster version, which is also wonderfully reusable by distributing its tasks in structs.

circle-check
triangle-exclamation

Custom enumeration

A little more manual labour, but an incredible amount of flexibility. This gives you the opportunity to design everything according to your wishes!

circle-check
triangle-exclamation

Source-Generation

The last variant is the source-generated queries. These are provided by Arch's rich ecosystemarrow-up-right and can be integrated separately. They generate the code for you as if you had written it manually. Fast, efficient and simple. What more could you want?

circle-check
triangle-exclamation

Last updated