adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] Next steps


From: Kai Sterker
Subject: Re: [Adonthell-devel] Next steps
Date: Wed, 29 Feb 2012 23:16:36 +0100

On Mon, Feb 20, 2012 at 10:49 PM, Kai Sterker <address@hidden> wrote:

> Also want to make the map file format ready for distributed editing.
> Instead of storing objects by their index (which changes as new
> objects are added to the map), a hash would be calculated based on the
> object's filename and path, so that when two developers add the same
> object to the map, both times the same hash will be generated and the
> result can be easily merged.

Had to wrap my head around this for a while, where to put the logic,
where to store the data and how to deal with collisions. Today I think
I've figured it out.

The hash would be generated in mapedit, when first placing a model
onto the map. To calculate the hash, the path relative to the model
directory will be used (with directory separators converted to
unix-style, if required).

At that point, the hash will be stored in the world::placeable, so
that it is available when the map is saved, Conversely, when the map
is loaded, the hash is again stored in the world::placeable so that it
is available on resaving.

That way, the hash itself is only kept in the map file, so there is no
need to worry when copying models or moving them to other locations.
No unintentional duplication of hashes can occur.

In case of collisions, i.e. if mapedit actually generates a hash
already present on the map, it will increment it automatically until
it becomes unique again. This could go wrong if two developers cause a
collision with different objects and then merge their work. But I
assume it's way easier to win the lottery than to achieve that feat
(especially since we haven't a single developer editing maps right now
;-)).


With the plan laid out, the implementation shouldn't be too difficult.
Lots of the underlying code is already there. Most of the logic and
costly operations is kept in the tools. And it does not require
changes to existing models or maps.

Kai



reply via email to

[Prev in Thread] Current Thread [Next in Thread]