pingus-devel
[Top][All Lists]
Advanced

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

WorldObj vs. Groundpieces


From: Ingo Ruhnke
Subject: WorldObj vs. Groundpieces
Date: 16 Sep 2002 12:52:01 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

I have been trying to get Prefabs[1] working for the last few days,
but there is one huge problem left, which can't be solved without some
rewriting of the object creation core:

Currently we create objects like this:

class WorldObjData {
  [...]
  /** Create an WorldObj from the given data object */
  virtual WorldObj* create_WorldObj () =0;

  /** Create an EditorObj from the given data object, caller is
      responible for deleting the pointers in the vector */
  virtual EditorObjLst create_EditorObj () =0;
}

(the World or the Editor calls the function needed and adds the
objects to a list)

Each object is read from file to a WorldObjData object and then
create_WorldObj() or create_EditorObj() is called, disadvantage is
that a Groundpiece is currently not a WorldObj and no WorldObjData. So
grouping a Groundpiece and a WorldObj doesn't work with an object
like:

class WorldObjDataGroup {
  std::vector<WorldObjData*> objs;
  [...]
}

Groundpieces are for historical reason hold completly seperate from
WorldObj's and have there own bookkeeping functions, after all they
are passed over to the SpotMap, which then generates the groundmap out
of them.

My new approach would be to unify the Groundpieces with the WorldObjs,
that would basically only mean to add one functions to the WorldObj,
something like:

class WorldObj {
  /** Let the worldobj do its startup work, like drawing to the 
      collision or gfx map */
  void startup ();
}

draw_collmap () would get obsolete.

I would also like to change:

WorldObj* create_WorldObj ()
EditorObjLst create_EditorObj ();

to

void create_WorldObj (World*);
void create_EditorObj (Editor*);

so that the object could itself add as much WorldObjs or EditorObjs to
the world that it needs, the return of a std::vector<> doesn't really
look good and makes creation of single objects quite clumsy.


After all that could also mean to cleanup the xml file a bit,
currently its like:

<globals>...</globals>
<actions>...</actions>
<hotspot>...</hotspot>
<hotspot>...</hotspot>
<some-other-object>...</>
...

I would like to seperate the objects into there own tree:

<globals>...</globals>
<actions>...</actions>
<objects>
  <hotspot>...</hotspot>
  <hotspot>...</hotspot>
  <some-other-object>...</>  
</objects>


[1] Groups of objects, which one can import/export from/to disk, to
    make level building easier.

-- 
WWW:      http://pingus.seul.org/~grumbel/ 
Games:    http://pingus.seul.org/~grumbel/gamedesigns/
JabberID: address@hidden 
ICQ:      59461927




reply via email to

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