Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suggestion for reducing size of map files, server/client bandwidth



Tero Haatanen writes:
 > ...
 > Reducing the size of maps is needed since one object is about ~250 bytes,
 > so they eat too much memory in servers side, but I would like it happen
 > so that it won't affect the flexibility of the current map format. It
 > could be done splitting the object struct in many parts and let
 > load_object() decide what parts are needed and if some part isn't
 > needed then using it from archetype. It would not require any changes
 > existing maps, but it would still reduce memory used by server. Also
 > it would have effect reducing the memory used by walls, which is another 
 > big group of dead objects.

The vision follows: Object structure could be split to several
structures containing attributes which belong together or have same
nature. Object structure is only a set of pointers to those attribute
structures. Every attribute structure has a copy-on-write flag or a
reference count, which tells if there are several references in
different objects to same attribute structure. When object is cloned
only pointers are copied and reference counts are increased. In
modifying an attribute the reference count has to be checked and whole
structure cloned. In querying an attribute there are no problems. 
This system could provide some kind of inheritance of objects and save
memory at the cost of speed. It could also clean up code by removing
'archetype' concept, which would only be one of the attribute
structures. Memory management becomes a bit more complex, since there
could be different sized structures.

To implement this every reference to object attribute has to be
changed to fuction or a macro call.

Tero's idea would be faster, but it wouldn't give so much flexibility,
because there has to be then some 'archattributes' which cannot be
modified after loadtime, since they are shared by several objects.
System would also be hardcoded for certain type of objects.

	- Jarkko