From 4a71d0b94a1851a5495fc2475822ba678b2f8c91 Mon Sep 17 00:00:00 2001 From: Vladyslav Hrytsenko Date: Sat, 8 May 2021 13:36:47 +0300 Subject: [PATCH] docs: updated docs accordingly to new radius system --- docs/defs/entity.md | 48 +------------------------------------------- docs/defs/packing.md | 3 +++ docs/defs/query.md | 3 ++- 3 files changed, 6 insertions(+), 48 deletions(-) diff --git a/docs/defs/entity.md b/docs/defs/entity.md index 69ec4cf..761cc03 100644 --- a/docs/defs/entity.md +++ b/docs/defs/entity.md @@ -316,7 +316,7 @@ Owner, is an artificial concept that represents a relation of the entity to some Making an entity owned allows to do multiple things: * Fetching entities owned by specific user via [librg_world_fetch_owner](defs/query.md#librg_world_fetch_owner) -* Querying nearby entities based of current [radius](librg_entity_radius_set) via [librg_world_query](defs/query.md#librg_world_query) +* Querying nearby entities based of current via [librg_world_query](defs/query.md#librg_world_query) * Setting up global and relational visibility via [librg_entity_visibility_owner_set](#librg_entity_visibility_owner_set) that will be used by query methods * Writing and reading world (serialization and replication) via [librg_world_write](defs/query.md#librg_world_write) methods @@ -362,52 +362,6 @@ int64_t librg_entity_owner_get( ------------------------------ -## librg_entity_radius_set - -Sets current entity visibility radius. - -Visibility radius influences only entities that are owned. -It represents a linear/circular/spherical (depending on world configuration) radius of entity visibility in terms of nearby chunks, -and used whilist general visibility calculations in the [librg_world_query](defs/query.md#librg_world_query) method. -If property set for an entity that is not owned, but the owner is later on changed, it will be still applied, since the value is stored in the internal storage. - -##### Signature -```c -int8_t librg_entity_radius_set( - librg_world *world, - int64_t entity_id, - int8_t observed_chunk_radius -) -``` - -##### Returns - -* In case of success: `LIBRG_OK` -* In case of invalid world: `LIBRG_WORLD_INVALID` -* In case of unknown entity: `LIBRG_ENTITY_UNTRACKED` - ------------------------------- - -## librg_entity_radius_get - -Returns current entity visibility radius. - -##### Signature -```c -int8_t librg_entity_radius_get( - librg_world *world, - int64_t entity_id -) -``` - -##### Returns - -* In case of success: number representing current radius -* In case of invalid world: `LIBRG_WORLD_INVALID` -* In case of unknown entity: `LIBRG_ENTITY_UNTRACKED` - ------------------------------- - ## librg_entity_visibility_global_set Set entity global visibility value. diff --git a/docs/defs/packing.md b/docs/defs/packing.md index 6761c5b..41948a3 100644 --- a/docs/defs/packing.md +++ b/docs/defs/packing.md @@ -9,6 +9,8 @@ However, instead of returning set of results directly to you, it rather builds a and compares it with a previous snapshot (from previous call to this method). This way method is able to keep track which entities are considered to be new, existing or forgotten for each owner within his view radius (based on entities that he owns). +Visibility (Chunk) radius represents a linear/circular/spherical (depending on world configuration) radius of visibility in terms of nearby chunks. + Additionally, an event is fired for each entity within owner's view radius, allowing you to write any additional information specific for this owner or this entity. For more details on events, please refer to the [events](defs/events.md) page. In case you wish to write any additional information, you would need to return length of the data you copied to the buffer. More details in the [example](#example) below. @@ -29,6 +31,7 @@ If the provided space will not be enough, you need to redefine the macro to incr int32_t librg_world_write( librg_world *world, int64_t owner_id, + uint8_t chunk_radius, char *buffer, /* out */ size_t *size, /* in-out */ void *userdata diff --git a/docs/defs/query.md b/docs/defs/query.md index d28c10c..7073a91 100644 --- a/docs/defs/query.md +++ b/docs/defs/query.md @@ -141,7 +141,7 @@ int32_t librg_world_fetch_ownerarray( Method is used for spatial entity filtering. It returns all entities that are "visible" to a provided `owner_id`. -The visibility is calculated based on visibility "radius" of each entity that is owned by that owner, and returned as a single array of unique entries. +Visibility (Chunk) radius represents a linear/circular/spherical (depending on world configuration) radius of visibility in terms of nearby chunks. If entity was not properly placed onto a **valid chunk**, it will be filtered out from the query. Additionally any visibility overrides are applied on per-entity basis, filtering out those entities that should be (in)visible for the given owner. @@ -157,6 +157,7 @@ Additionally any visibility overrides are applied on per-entity basis, filtering int32_t librg_world_query( librg_world *world, int64_t owner_id, + uint8_t chunk_radius, int64_t *entity_ids, /* out */ size_t *entity_amount /* in-out */ )