[freeroleplay] Yagsbook XML format

  • From: Samuel Penn <sam@xxxxxxxxxxxxxxxxxxx>
  • To: freeroleplay@xxxxxxxxxxxxx
  • Date: Tue, 28 Oct 2003 21:51:25 +0000

Since Ricardo asked...

The best place to start is probably the page on my website:

http://www.bifrost.demon.co.uk/comp/yagsbook/

I originally started using Docbook, but that was too specific to
writing technical documentation, so I spun off my own XML format
(which is very similar to Docbook in the basics), which I call
Yagsbook.

The two main areas it is used are:
a) Describing game rules.
b) Describing campaign background.

There's a lot of overlap between the two, though the main difference
is that the former is 'pure' XML/XSLT, whilst the latter makes heavy
use of a Java program to process the output into an Encyclopedia.
e.g.:

http://www.bifrost.demon.co.uk/games/habisfern/encyclopedia

This was inspired by the Encyclopedia of Arda, http://www.glyphweb.com/arda/


Game rules are written in XML format, marking things up with pretty
standard tags like <sect1>, <sect2>, <para>, <table> etc. I also
have a large amount of XSL to cope with special, Yags specific, tags
for marking up specialist content. e.g.:

    <skill name="Astrophysics" type="science">
        <prerequisite name="Physics" score="4"/>
        <prerequisite name="Astronomy" score="2"/>
        <default name="Astronomy"/>

        <description>
            <para>
                Astrophysics deals with the makeup and behaviour of stars
                and planets from the point of view of physics. It is not
                concerned with particular stars (that is <e>Astronomy</e>)
                but with the underlaying physics behind them.
            </para>
        </description>

        <examples>
            <example target="10">Understand different star types</example>
            <example target="20">Know standard equations</example>
        </examples>
    </skill>


There are XML structures defined for weapons, spells, characters,
beasts etc. A document can reference external documents as well,
and pull in lists of things. So my 'rules' documents (say, on
character generation) just gives the core rules, and links to
documents containing lists of skills, advantages etc. When the
HTML is generated, I can generate them inline, sorted and grouped
more or less how I want.

Character and beast descriptions do a lot of the raw calculations.
A character description will give attributes and skills, as well
as the armour worn and weapons used. The XSL then pulls in the
weapon and armour stats needed, and works out all the final combat
stats for the character, including encumbrence penalties and
number of body levels etc.

In theory, I can display a 'full' description of a character, a
simple combat only description, a non-rules description etc.

There's still a lot of work to be done in this regard, and it
suffers from having grown, rather than been designed.

It means I can have both HTML and PDF versions of everything though.
I can also share content between documents, and update basic info
(such as weapon stats) and have everything that relies on them
change automatically.

Using a text based format makes it easier to use a source control
system such as CVS as well, so I can track and merge changes, even
if I'm making them at home one day, or from my laptop another day.


The Encyclopedia stuff is somewhat cleverer, in that it works out
cross referencing and cataloging of entries. All the background
for my campaigns go into XML files, and each night a job runs
which regenerates everything, and pushes the changes out to my
website.

All documents are represented by a unique uri, which is just a
flat namespace. Articles can be referenced by its uri, such
as with a <qv uri="weidany">Kingdom of Weidany</qv>, much like
HTML href's, but you don't need to know the exact path to it.
There's even an Ant task for this, though it's still experimental
at this stage.

I also have Mapcraft, which is a Java based mapping tool I'm
writing. This also stores everything as XML. The XSL for the
Encyclopedia can access this, get the Java program to render
the requested map, and insert it into the Encyclopedia entry.

e.g.:

<import-map uri="bryteland" scale="1" thumb="320">
    <area name="jarneyland" margin="1"/>
</import-map>

This will take the Bryteland map, crop it to the area identified
as being 'Jarneyland' (with a 1 hex margin around the border of
Jarneyland), and create a JPEG at scale 1 (1 tile = 32px). It
also generates a thumbnail, 320px wide, which is inserted inline
into the HTML page, with a link out to the main image.

I can only crop my areas and coordinates at the moment, but plan
on being able to crop around towns and things later (so, give me
a map of everything within 6 hexes of 'Stowell').

Meta data can be added to locations in the map as well, so towns
and cities can have useful data associated with them, such as
their population, army size, ruler and so on. At some point, I'm
going to write something to allow me to access this data.

If anyone's seen the Kingdom lists for Harnworld - lots of detailed
data of each manor, and which manor owes fealty to whom etc - then
you'll have some idea of the sort of thing I want to be able to
generate automatically.

It's all very much a work in progress, but is available on my
website if anyone wants a play. How easy any of it is to download
and get to work though is anybody's guess!

-- 
Be seeing you,                               -------------------------------
Sam.                                         http://www.bifrost.demon.co.uk/


Other related posts: