Expand description
Component Graph System prototype.
Froggy is all about the smart component storage, unambiguously called Storage.
Components inside it are automatically reference-counted, and could be referenced by a Pointer.
The components are stored linearly, allowing for the efficient bulk data processing.
Storage has to be locked temporarily for either read or write before any usage.
You can find more information about Component Graph System concept on the wiki. Comparing to Entity-Component Systems (ECS), CGS doesn’t have the backwards relation of components to entities. Thus, it can’t process all “entities” by just selecting a subset of components to work on, besides not having the whole “entity” concept. However, CGS has a number of advantages:
- you can share components naturally
- you don’t need to care about the component lifetime, it is managed automatically
- you can have deeper hierarchies of components, with one component referencing the others
- you can have user structures referencing components freely
- there are no restrictions on the component types, and no need to implement any traits
Structs§
- Cursor
- Streaming iterator providing mutable components and a capability to look back/ahead.
- Cursor
Item - Item of the streaming iterator.
- Dead
Component Error - The error type which is returned from upgrading
WeakPointer. - Item
- The item of
Iter. - Iter
- Iterator for reading components.
- IterMut
- Iterator for writing components.
- Pointer
- A pointer to a component of type
T. The component is guaranteed to be accessible for as long as this pointer is alive. You’d need a storage to access the data. - Slice
- A slice of a storage. Useful for cursor iteration.
- Storage
- Component storage type. Manages the components and allows for efficient processing. See also: Pointer
- Weak
Pointer - Weak variant of
Pointer.WeakPointers are used to avoid deadlocking when dropping structures with cycled references to each other. In the following exampleStoragewill stand in memory even after going out of scope, because there is cyclic referencing betweenNodes