# Areas of Interest

**Areas of interest** (or **queries**) are not only a way to optimise, but a fundamental tool for Clients to specify what part(s) of the online world they are interested in.

With them, the Replication Server can filter the information to send based on each Client's interest, and thus greatly optimise network traffic.

<figure><img src="https://content.gitbook.com/content/QLuEkuU7DLr3jX7gVtzJ/blobs/88FZ1nGoOcWhW7b07tME/LiveQueries.jpg" alt=""><figcaption><p>In the left window, Player2 is not visible because it's outside of Player1's LiveQueries</p></figcaption></figure>

At the moment, coherence offers two ways to express this interest: [**LiveQuery**](https://docs.coherence.io/1.4/manual/components/coherence-live-query) and [**TagQuery**](https://docs.coherence.io/1.4/manual/components/coherence-tag-query).

* With [**LiveQueries**](https://docs.coherence.io/1.4/manual/components/coherence-live-query) the filtering is volume-based, kind of like moving a torch to look around in a dark cave.
* With [**TagQueries**](https://docs.coherence.io/1.4/manual/components/coherence-tag-query) even distant objects can be seen, provided they have the right tag.

{% hint style="warning" %}
You **need at least one** query in your scene, or you won't see anything update over the network.
{% endhint %}

When a non-authoritative object **falls outside** of all queries, it gets **destroyed** (or returned to an object pool). When it gets back in, it gets reinstantiated (or taken out of the pool). If the right properties are synced, the object's state will be automatically restored by coherence, making the player feel like that object never disappeared.

{% hint style="info" %}
Queries only filter network entities that are **non-authoritative**. Your own entities will never be destroyed for falling outside of a query.
{% endhint %}

## Additive filtering

When using queries and adding more than one, they act in an **additive** way.

So for instance, two overlapping **LiveQueries** will define a bigger area.

Similarly, a **LiveQuery** + a **TagQuery** will add up, looking for entities both within a range but also for the ones that have a certain tag, regardless of position.

{% hint style="info" %}
Non-additive filtering will come in a future version of coherence.
{% endhint %}

## Runtime changes

It is a very common pattern to **move** a LiveQuery around, following a player character or the camera, to ensure the visible objects are updated.

In addition to this, queries can be **turned on/off** (simply by disabling the GameObject that hosts them), or **their properties can be changed** at runtime (like radius, position, or tag), making for a very dynamic tool to optimise bandwidth.

## Queries are personal

Queries are per-Client, meaning that each Client (or Simulator!) has its own queries and thus sees different parts of the simulation.

{% hint style="success" %}
Queries can also be used for cheat prevention, see [Server authoritative setup](https://docs.coherence.io/1.4/manual/authority/server-authoritative-setup) for more information.
{% endhint %}
