[CF-Devel] Technical Object Questions

Mark Wedel mwedel at scruznet.com
Fri Aug 3 14:02:04 CDT 2001


On Fri, 3 Aug 2001, Chachkoff Yann wrote:

>
     
      About the object classes/subclasses...
     
     >
     
      What do you think of a simple "Object tree" ? I was thinking of a hierarchy
     
     >
     
      of objects like this one (it is only an incomplete example !):
     
     
I'd do it a bit differently - I had basically come up with something like:

Object
 - Items (anything that can be picked up carried)
 -- Equipment (anything that can be applied)
 --- armor/weapons/gloves/helmet/rings/etc

 The rationale for that is that way anything that modifies the player
has the same code loop to use.  That ring could add an attacktype, increase
damage, etc.  By in large, all of those have similar abilities.

 -- Spell casting objects (eg potions, scrolls, wands, rods)


>
     
      The common functions used by all objects (query_name for example) could be
     
     >
     
      referenced in the archetype itself (by function pointers). If a specific
     
     >
     
      subclass of object requires a different procedure, simply reference another
     
     >
     
      one in its archetype. This could give more flexibility to the code, because
     
     >
     
      it would allow a clear separation of "What the server should do" (the rules
     
     >
     
      of the game and the global interactions between objects) and "What the
     
     >
     
      objects do" (The server no longer need to know how the object store its
     
     >
     
      datas).
     
     
 Note that one issue here is that this data still needs to get saved to
disk.  My way to handle this would be that the base loader would know
about the command values (name, x and y location, etc), and if it
get a field it did not know about, it would pass that line off to the loader
for that specific object type.


>
     
      I know that it could be a lot of work. I just want to know:
     
     >
     
       - If anyone is against the idea (and the possible objections);
     
     
 The biggest issue is the amount of work (basically, all the archetypes
would need to get changed, and a lot of the code within the program needs
to get changed).  And while it would make the code more extensible, the
immediate effect of all this change is nothing readily apparant to those
who player the game - it just makes future enhancements easier.

 I had started down the road a little, and came to the conclusion that it
was going to be a lot of work, and that there were more important things
to work on.

 Note that the engine/rules split does not necessarily require a redo
of the object layout - just doing that would make such a split more useful
if people do want to develop other rule based systems.

>
     
       - If anyone has an idea for a complete object hierarchy;
     
     
 I have a bit more breakdown.  However, almost anything will probably
get changed as work is done on it, as you realize sub object X also uses
field Z, which subobject Y also uses, so maybe X and Y should get merged,
etc.

>
     
      Maybe reusing the old Advanced Combat System ideas and preliminary code could
     
     >
     
      be interesting for that ?
     
     
 Perhaps.  I never looked at the advanced combat system much.


    
    


More information about the crossfire mailing list