alecthomas / alecthomas/entityx

UUIDCollisionResolver

Đang mở
#227 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C++
Star
2.3k
Fork
301
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I'm trying to integrate cereal serialization library with entityx

Also I have read https://github.com/alecthomas/entityx/issues/117, https://github.com/alecthomas/entityx/issues/14 and https://github.com/alecthomas/entityx/issues/25

I got four basic ideas:
1. We should use custom UUID component instead of Entity id
2. For serialization we should check manually if entity has specific components (and, well, iterate through all of them)
3. (because of 2) We should manually decide what components should be registered and how components should be serialized/deserialized
4. To iterate over all alive entities we must use entities_for_debugging(). It marked "not very fast, so should only be used for debugging", but well I don't see any other alternatives for serialization

My big question is: how elegantly implement UUIDCollisionResolver? I mean, UUIDGenerator automatically attaches UUID component for every new Entity, and when we try to deserialize some entities from external file here is high probability that UUIDs of that entities are already taken

Also, some components can store UUID in themselves, so UUID must be replaced with a correct one too

To be more specific, lets say we have such components:
```cpp
struct UUID
{
//UUID(...) {...}

uint32_t value;
};

struct TreeNode
{
//TreeNode(...) {...}

std::string name;
};

struct Transform
{
//Transform(...) {...}

glm::vec3 position;
glm::vec3 scale;
glm::vec3 rotation;

bool is_dirty;
glm::mat4 cache;

UUID parent;
std::list childs;
};
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.