Registering goals
  • Hello all-

    I've found a bit more time to work on my Deathmatch project: viewtopic.php?t=2163

    Basically, I'm building my own simple world (ruleset) from scratch, using the existing cyphesis + ember engines.

    I've been adding objects and behaviors (AI, scripts) based on the existing system. So far that's gone pretty well. I'm working on AI in particular now.

    The learn() mechanism is pretty clever. I like how learn events are turned into general messages that can be passed back and forth between objects--very powerful!

    However, I have hit one bug (or limitation): the current registry of goals relies on the __init__.py file in the goals directory having imported all interesting goals from the directory tree beneath it. Then the NPCMind.py file dynamically constructs python module names and entry points, and eval()'s them.

    There are obviously two issues: a) you can easily get namespace collisions in the current method (so far, no one has used the same name for a goal), and b) goals must be statically registered somehow.

    I'm pretty sure this is a known issue, since there is an obvious comment in the code:

    #CHEAT!: remove eval (this and later)

    How should this work? I figure there should be some sort of registration mechanism where goals are child classes from some base Goal class. Then specific goals can be treated polymorphically and registered at runtime. Does that sound right? Or is there another design in mind for goal registration?

    This isn't blocking me now (I can hack around it) but I was curious what was planned.

    -Thomas
  • To be honest I don't know what was intended as this comment pre-dates my involvement with the code. I am basically happy for this mechanism to stand for now, as it is not much of a limitation and we have much bigger fish to fry.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID