|
From: Tommi L. <tom...@hu...> - 2001-02-09 12:12:19
|
I have put together a couple of architecture diagrams based on
discussion with various people (Brent,Brian,Cyanide, Speed Bump... the
list is endless.) I hope these diagrams will raise discussion and weak
points of the design will be found.
The requirements for Shepherd are so far the following:
1. Hand out references of EntityAccessors to modules.
2. Be capable of preserving game state by sending all relevant data to
Echo and dynamicaly
load and save entities like character entities.
3. Serve efficiently game algorithms like id search, spatial search,
collision detection ...
4. Manage memory efficiently.
5. Take care of consistency. (Reference counting - Proxy Acces Design
Pattern)
6. Do simple kinematics.
7. Debugging information and messaging functionality.
We have agreed that at least two kinds of data structures need to be
implemented in shepherd. Namely data structure organized according to
EntityID and another organized according to 3d location&dimensions of
entity. The shepherd design based on this is given in the following UML
diagram. The design on these two data structures is proceeding
relatively fast:
[Image]
The answer to consistency question is given in the following diagram
using proxy-accessor design pattern (thanks Brian). Everytime a module
requests for information an EntityAccessor is created pointing to
requested entity. This adds reference count of the requested entity and
when EntityAccessor is destructed reference count is decreased. Entity
will have protected methods available only via EntityAccessor thus
enforcing reference counting. EntityAccessor will not have many data
members and it is low memory consumption object. To gain performance
EntityAccessors could be recycled and EntityCache would contain
EntityAccessor factory with stock of EntityAccessors. When
EntityAccessor is not needed anymore it is returned to factory. We will
need 1 extra function call per function call to entity. Do we want to
pay this for enforced consistency?.
[Image]
One more important question is the design of plugin data for entity.
Someone was working on it and I hope he could
fill that hole soonish.
These all were proposals and combination of ideas from various people.
If I have misunderstood an idea or badly used it or you have better one
please post your thoughts now.
regards,
Tommi Laukkanen (Morgenes)
|