WOW creating new worlds is hard!
  • I've spent some time reading through the cyclient code. If I have it right, this is what happens:

    1) cyclient initializes Python interpreter
    2) cyclient establishes connection to the server
    3) cyclient invokes local Python module to generate/provide all world data

    So basically, cyclient relies on Python scripts to dynamically create all world data (terrain, objects, etc) when it starts? And then cyclient passes this information on to the server?

    I see some of the attraction of that (let scripts dynamically generate a lot of data at startup) but isn't it somewhat counter-intuitive?

    This is what I would have expected:

    1) cyclient establishes connection to the server
    2) cyclient reads local data files and sends them to the server

    That way, you can use any language you want to generate the world data, including a static data file you distribute via CD!

    Or am I reading the code incorrectly?

    -Thomas
  • Having dug into the code some more, I'm now less sure about what is actually happening.

    Is this it?

    1) cyclient connects to server
    2) cyclient reads local python files, sends them all to the server
    3) server (cyphesis) runs python files provided by the client

    It looks like the local python files have information about the terrain, objects, and behaviors (AI and UI). This logic must actually execute on the server.

    Is that the case? Basically all local python files are shipped up to the server? Or are they actually executed locally?
  • Is there documentation anywhere on how the world is populated? I don't think I should be reverse-engineering all of this, but I haven't been able to find any documentation online or in the cyphesis source distribution.

    It appears that the startup sequence works roughly like this:

    1) config file specifies which python module to load first (typically this is define_world.py)
    2) define_world.py is the "root" file which describes how everything in the world is set up.

    But it seems very complicated. For instance, where are the actual objects defined? For instance, the "castle_house" object, of which several are listed in the define_world.py file. How does the client (ember) know how to render that?

    Is there documentation on any of this anywhere?

    Thanks-

    -Thomas
  • Hello all-

    Still more questions! I am planning on writing some programs to help generate world content, so any pointers/tutorials on how cyclient/ember works would be very helpful.

    I've dug around some more in the startup code, and I guess it works like this:

    1) define_world.py says "put object 'foo' at position x,y,z'
    2) 'foo' has an entry somewhere in modeldefinitions, so ember knows how to render it
    3) somewhere, there is a foo.mesh file compiled from Ogre XML

    In the modeldefinitions file, what are the "parts" entries for?

    Again, any sort of walkthrough on how to create worlds (in cyphesis) and render them (in ember) would be very helpful.

    Thanks-

    -Thomas
  • Sorry I haven't replied earlier. Been out and about quite a bit.

    Here is roughly how the code works.

    Most of the python scripts are loaded into the server. It reads them from disk at startup. They cannot yet be uploaded over a network connection. The only python file cyclient really uses is define_world.py where it looks for a function to run to populate the world. Both the file and the name of the function can be specified on the commandline.

    It would be possible to populate the world from a file full of entity data, but much of the define_world script is programming NPC behavior, and the file full of entity data cannot handle that yet. cyclient creates entities in the world using standard Atlas messages, so any tool can connect to a server and do this, as log as it can log in with enough privs.

    Object (or entity) types are defined in .xml files in the data directory of the source tree. Currently there are two, basic.xml and mason.xml. The objects in these files define classes of objects that are created on the server. There are three types. Entity classes define types of entity that can exist in the world, operation definitions define messages that can be passed around between entities, and task classes define processes the players can perform to modify the world. Collectively these three kinds of classes are referred to as rules. The rules are loaded into the server at startup either from the Database, or directly from files if no Database is configured.

    The clients ember and sear have their own data files for defining how they should render entities. You'll have to talk to erik about configuring that.

    Whenever you identify somewhere where documentation is short, it would be great if you could write up what you find on the WorldForge wiki. There should be some documentation already on there for both Ember and Cyphesis, but it is probably sparse.

    If there is anything I have not covered, hit me with more questions, and I will answer as soon as I can.
  • Thanks, that helps! I have been playing around with cyphesis/cyclient/ember some more, and have a few more questions. Once I get a better feel for how things work I'll write some of this up.

    Just for fun, I created an inn. It was pretty easy, I just added a

    m.make("inn1", type="inn", pos=(...), orientation=(...))

    line in my define_world.py script. And voila, an inn appeared! Very cool. (great model, BTW!)

    What is the first argument to make()? In this case, I used "inn1", but as far as I can tell I can use any name I want to. I thought it was the ID of this instance of inn object, but I see there can be multiple instances of the same object class, all with the same ID (or at least, all with the same first argument to make()). So what is the first argument?

    Within the etc/cyphesis/mason.xml file, I can see where the inn object was defined. Presumably that's what let cyclient add it. What is the "parents" list? I see there are a number of types of parents: thing, character, structure, seed, tree, food, action, area, task ... Where are the parent objects defined? Is that in code? What does it mean for an object class to have multiple parents?

    Within define_world.py, is there a way to delete objects in the world? For instance, if I run cyclient once and add some stuff, then run it a second time and delete some items I added the first time, and add some new ones.

    (This is an ember question, but hopefully someone here can answer): How did ember know how to render the inn? I see it mapped in the media/user/modeldefinitions/buildings.modeldef file, but how did it know to read that file? Or are all files in that drectory parsed? Why does the modeldef file include the subentities in the model, which are also defined in the inn.mesh file?

    Thanks for any and all answers! I think I'm getting closer to seeing how to generate worlds.

    -Thomas
  • The first argument is the name of the entity. It is pretty much free text, so make it something helpful. It can be something like "The Prancing Pony", but the name should not be too descriptive or verbose. A unique ID is assigned to the entity at creation by the server. It is typically numeric.

    The parents list of an entity class defines the inheritance of that class. Entities of that class also get the default property valus of the parent, and and other ancestors. There are some base classes hard coded into the server core, but I am working to cut these down to a minimum. In the latest version, and in cvs, I think the only base classes worth worrying about are "thing", "character", and "plant". I will be removing "plant" soon. Things that move around by themselves, or can be controlled by a player must inherit from character. Anything inanimate should inherit from thing. Although parents is a list, multiple entries has not been implemented, and there is currently no plan to do anything along these lines.

    I don't think there is currently a way to delete things from define_world.py directly, but I can probably add it easily. Currently doing the following to an entity has the side effect of it getting deleted:

    m.set(entity.id, status=-1)

    To get a reference to the entity in the first place, you will need to use m.look_for(), specifying either name or type of entity you are searching for in the world.

    inn = m.look_for(name='The Prancing Pony')
    m.set(inn.id, status=-1)

    I'll leave the ember question to erik, as to be honest I don't really know the answer.
  • Thanks again for the feedback! I've got a first draft of my wiki page up:
    http://wiki.worldforge.org/wiki/WorldCreation

    All comments/suggestions welcome, and of course you can edit the wiki.
  • After reading the wiki entry I think you've got a very good grasp on how the architecture works. I think a lot of people have trouble seeing how it all fits together.

    If you're using the Ember 0.5.0beta1 package you'll have access to some nifty world editing tools. Just log in as administrator (as described here) and you'll be able to edit the terrain in realtime, create new entities, move entities and update attributes of entities.
  • Excellent. As soon as possible I will start tweaking stuff using your guide.
  • Sorry it's taken me a while to have a good look at this. My first reaction from reading quickly through it is great. I had initially expected a more formal tutorial, but the format of an introductory article works nicely, and covers a lot of breadth. Nice work.

    I'll go through in more detail to make sure I don't find anything you have got wrong. If you feel inclined to enhance this article with more information that would be great. It would be cool to announce it in our regular news feed and get more people playing with the tech.
  • I think that priority 1 topic is how to modify bhavior and goals. Also I dont see there how to define and set entity attributes and skills.

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