[WF-General] A little help

Erik Hjortsberg erik.hjortsberg at gmail.com
Tue May 5 07:00:47 PDT 2009


Regarding how to represent the water entity, I think for now is should 
do just fine to create one _very_ large "water" entity which occupies 
pretty much all space below zero altitude. Whenever the terrain dips 
below zero altitude the water is exposed. This will also mesh with the 
client, where the water basically just is one large plane placed at zero 
altitude.
Further on we want to look into how to handle the cases where we want 
ponds and streams placed on other altitudes than zero, or places in the 
world where the ground is below sea level, but no water is present (like 
the Netherlands). But that's something for later; for now we'll just 
focus on keeping it simple.

Note also that Ember has a couple of inspection and editing features 
which makes it easy to inspect the entity definition for any entity (you 
can get it in raw atlas data through the "Atlas" tab on the entity 
editor, just make sure to use a recent build as it crashes on 0.5.6). 
There's also a widget which shows the type hierarcy, but it doesn't show 
the public atlas data attached to each type (since that wasn't available 
at the time the widget was created). We could extend it to also show the 
atlas data.


/Erik

Alistair Riddoch skrev:
> 2009/5/5 Amey Parulekar <amey.par at gmail.com>:
>   
>>> The parent of "oak" is not "acorn" though. Where did
>>> you find something that suggested that? The parent of the "oak" class
>>> is the "tree" class. The "acorn" class inherits from, or has as its
>>> parent the "seed" class.
>>>       
>> In data/plants.xml,
>>     
>
> This is the "acorn" class. You can tell by the line which specifies
> the "id" further down. Sections of the class are in alphabetical order
> as the file is machine processed. I will go through the section and
> explain each part.
>
>   
>> <map>
>>     
>
> The "attributes" section defines the default Atlas attributes that all
> acorns have. Inside the server these are called properties because
> they affect how the acorn is simulated. Each attribute has a
> visibility to define who can see it, and a default value.
>
>   
>>    <map name="attributes">
>>     
>
> The "biomass" attribute causes the acorn to be edible, and defines the
> level of nutrition the eating entity gets from it.
>
>   
>>      <map name="biomass">
>>        <float name="default">0.05</float>
>>        <string name="visibility">public</string>
>>      </map>
>>     
>
> The "germinates" property defines to the seed simulation code what
> kind of plant this seed will grow into.
>
>   
>>      <map name="germinates">
>>        <string name="default">oak</string>
>>        <string name="visibility">public</string>
>>      </map>
>>     
>
> The "mass" property is simply the mass of an acorn in kilograms, and
> is used by the physics system in cyphesis as you would expect.
>
>   
>>      <map name="mass">
>>        <float name="default">0.05</float>
>>        <string name="visibility">public</string>
>>      </map>
>>     
>
> The "transient" property specifies that this entity disappears from
> the world after a period of time, and that it is not a permanent
> feature of the world map, so should not be stored in the database.
>
>   
>>      <map name="transient">
>>        <float name="default">1800</float>
>>        <string name="visibility">public</string>
>>      </map>
>>     
>
> This is the end of the "attributes" section.
>
>   
>>    </map>
>>     
>
> The "id" of the class is it's primary identifier. This class is "acorn".
>
>   
>>    <string name="id">acorn</string>
>>     
>
> The "objtype" is the object type. This specifies that this is a class.
> All objects in these files are classes or "op_definition", which
> define new types of operation.
>
>   
>>    <string name="objtype">class</string>
>>     
>
> The "parents" specifiy the class this object inherits from. It is a
> list for historical reasons, but the implementations require that it
> only has one entry.
>
>   
>>    <list name="parents">
>>      <string>seed</string>
>>    </list>
>>     
>
> The "script" defines the python object associated with this class,
> which is created every time the entity is used in the world. You can
> find the script in rulesets/mason/world/objects/plants/seeds/Acorn.py.
>
>   
>>    <map name="script">
>>      <string name="language">python</string>
>>      <string name="name">world.objects.plants.seeds.Acorn.Acorn</string>
>>    </map>
>>  </map>
>>
>> Like you said, the parent is "seed", but then there's "acorn" in there
>> as well. I guess I got confused by that. What function does acorn
>> serve here?
>>     
>
> I hope my comments above have clarified that this is the class for
> "acorn", and it inherits from "seed" because an acorn is a type of
> seed. I hope you now understand why "oak" is in there, but why it is
> not the class for "oak". If not please let me know and I will try and
> explain in more detail.
>
>   
>> I think I've understood the way tasks are defined in tasks.xml, and to
>> define fishing as an activity, I would have to define it as:
>>
>>  <map>
>>    <map name="attributes">
>>    </map>
>>    <string name="id">fishing</string>
>>    <string name="objtype">class</string>
>>    <list name="parents">
>>      <string>task</string>
>>    </list>
>>    <map name="activation">
>>      <string name="operation">fish</string>
>>      <string name="tool">fishing_pole</string>
>>      <string name="target">ocean</string>
>>    </map>
>>    <map name="script">
>>      <string name="language">python</string>
>>      <string name="name">world.tasks.Fish</string>
>>    </map>
>>  </map>
>>
>> right?
>>     
>
> This is very close to correct. Well done. In fact there is no ocean
> object in game at the moment, but this is probably something we will
> have to work on defining.
>
>   
>> But I have two problems here. One, fishing should be available for any
>> moderately large body of water, like ponds and lakes, and not just for
>> oceans. How would I go about associating an activity with multiple
>> entities?
>>     
>
> This is where inheritance is useful. Classes for "pond", "lake",
> "ocean", "river" etc could all inherit from a base class for all
> bodies of water. Getting this right can be tricky, but we'll have to
> see what we can make work. We'll need to discuss with the client
> developers a way to usefully define bodies of water as entities.
>
>   
>> And secondly, the <string
>> name="name">world.tasks.(activity)</string> part. These are the python
>> scripts in "rulesets/mason/world/tasks", right? So to create a fishing
>> activity, I would have to create a new script for the same there. But
>> the files there have a lot of functions like "new_loc =
>> target.location.copy()". How do I find out what methods are available
>> for which objects, and in turn add my own?
>>
>>     
>
> Adding new methods requires extending the exposed API to the C++ core,
> and is quite involved. For now, if you need something you should let
> me know and I'll look into it. The functions exposed on the various
> C++ classes are implemented in rulesets/Py_Foo.cpp where Foo is the
> C++ class available.
>
> I would strongly suggest you make a point of logging on to Google Talk
> whenever you are online, and ask me questions on there whenever you
> have them. It is way more effective for getting quick answers than
> email or irc. I've CCed the general mailing list on this mail as I
> think it contains lots of useful information. I hope you don't mind.
>
> Al
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.worldforge.org/pipermail/general/attachments/20090505/623f3d23/attachment-0001.html>


More information about the General mailing list