adonthell-devel
[Top][All Lists]
Advanced

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

[Adonthell-devel] Loading and saving of map in place


From: Kai Sterker
Subject: [Adonthell-devel] Loading and saving of map in place
Date: Sun, 22 Mar 2009 16:09:34 +0100

Finally, another important prerequisite for the map editor is in
place. We can now save and load maps. Worldtest has been changed to
load its map from a file now. This file was generated by saving the
hardcoded map that used to be in worldtest.

There are is one shortcoming, though. Currently, just the names of the
object models and their location(s) on the map are saved. The actual
object state isn't. That means, after loading, each object is back in
its initial state. It's not a big deal right now, as the only object
that can actually change its state is the player character. However,
sooner or later this needs to be improved.

A brief word about the file structure ... although that should
probably go into the Wiki. It contains a series of records similar to
the following:

Object          (filename)
  Type          (OBJECT|CHARACTER|ITEM)
  Anonymous     (0:n anonymous entities)
    {Location}  (0:n locations)
  Shared        (0:n named entities sharing same object)
    Id          (identifier)
    Location    (location)
  Unique        (0:n named entities with unique object instance)
    Id          (identifier)
    Location    (location)

The filename of the object model is the key of each record. First item
of a record is the object type, followed by up to three lists of
object instances:
* Anonymous entities are only identified by their world space
coordinate, so it's practically impossibly to obtain a reference to
them from outside the map.
* Unique entities have unique name and are backed by unique object
instances. They can be retrieved by their name and each of them can
have an individual state.
* Shared entities also have a unique name, but they are backed by the
same object instance. They can be retrieved by their name, but each of
them have the same state.

Have a look at the map file (test/data/test-world.xml) to see how it plays out.


With that code in place, I can start work on the actual editor. Not
sure if I get far today, though.

Kai




reply via email to

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