[A16][WIP] Backstories

Started by AngleWyrm, March 24, 2017, 05:05:16 PM

Previous topic - Next topic

AngleWyrm


First look at the editor componant
The purpose of this tool is backstory authorship. It is being designed so that the story writer has no need of programming knowledge, and it should run on virtually any browser-capable device.

The underlying structure of the supporting data is going to be such that the values presented on-screen are drawn from the set of values the player has in their mod collection. Maybe there are new traits, or new ranges for values. Whatever the case may be the data itself shouldn't be hard-coded but instead imported from the game state.

There is also self-correcting error catching going on both in front and behind the scenes. The data files generated by the editor are an intermediary between the game's API and the user's story. This prevents a variety of hasty errors and troubles that arise in direct editing of the game files. It also insulates the editor from changes in the API, thereby future-proofing it from modifications as Rimworld evolves.

There will be an edit window in the browser, and a display window so the artist may verify that what they intended to create was indeed what they created. Once they are satisfied with the production there will be an option to export to game.

The preview mock-up on the right is attached as data entry form *.htm that should just work in your browser by clicking on it.

Also attached is the complete collection of backstories from Basic, Tribal and Storybook in a readable format for easy searching.


[attachment deleted by admin due to age]
My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

Granitecosmos

#1
So... what exactly are you planning to do?

Are you going to try and create an application that makes it easy for players to write backstories for this mod without any actual xml experience? Or did you change your mind?

It's nice and all that you provide us a screenshot and some files but it would be a lot better if you properly described your goal first. This is a new thread, after all. How else would people that visit this page know what this is in the first place?


And you finally edited your first post, thanks.

AngleWyrm

#2

Data Engineering

This is a fairly good representation of the information contained in a backstory record, but it has a ways to go before it reaches the structural integrity of normal form for a database record.

Some of the things that can be addressed through well-formed design (some of which are already in the game engine)
  • It is possible to specify a required work type, such as Intellectual and then also declare that work type to be forbidden.
  • That same issue occurs again with the character traits.
  • The set of traits available aren't random strings, but drawn from a pool supplied by the game and it's mods.
  • The key that identifies a backstory in the set of all backstories can be enforced as unique
  • The tag specifying a story belongs to the set of adults or children is better than the optional but redundant separation of those two categories into two different files.
These aren't all issues to be resolved by the game engine (although some have been), which can be considered legacy technology through which to interface. Thus the separation through mapping from game representation to something that can be tuned to include validation of expected inputs, which can then be mapped right back into the game representation for use by the engine.

Two Questions
  • Why is there a third optional declaration for body type, beyond the set for male and the set for female?
  • There is what appears to be a potency factor attached to traits, with a five-point range of -2 to +2. Any details on the effect?
My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

dburgdorf

Quote from: AngleWyrm on March 25, 2017, 10:01:07 AMThis is a fairly good representation of the information contained in a backstory record, but it has a ways to go before it reaches the structural integrity of normal form for a database record.

As I've endeavored to explain to you repeatedly, you CANNOT simply alter the tags and organization of an XML file arbitrarily and expect it to work. My "Editable Backstories" mod reads XML files that are structured in the same manner as the default backstory data files. Whether you like that structure or not doesn't change the fact that that structure, and that structure alone, is what the code will recognize and read.

Quote from: AngleWyrm on March 25, 2017, 10:01:07 AMThe tag specifying a story belongs to the set of adults or children is better than the optional but redundant separation of those two categories into two different files.

There's already a tag in the XML files that defines whether a backstory belongs to the adult set or the child set. It's the "Slot" tag. The "ageGroup" tag with which you've replaced it WILL NOT BE UNDERSTOOD by the code. I really don't see how this is a difficult concept to grasp.

As to the "redundant" separation of the definitions into separate XML files, that's something I did because it was an easy way for me to keep the data files organized. As I mention in the mod's documentation, though, you can have as many or as few XML backstories as you see fit, organized in whatever way works for you. You could have all your backstories in one single, very large file, if that's what you prefer. You could even have a separate XML file for each backstory if you really wanted to. You can organize the files in whatever way you see fit, but you still have to make sure the individual XML definitions are correct.

Quote from: AngleWyrm on March 25, 2017, 10:01:07 AMWhy is there a third optional declaration for body type, beyond the set for male and the set for female?

The global declaration can be (but doesn't have to be) used instead of individual male and female declarations if you want particular backstories to always be attached to "Fat," "Thin" or "Hulk" pawns.

Quote from: AngleWyrm on March 25, 2017, 10:01:07 AMThere is what appears to be a potency factor attached to traits, with a five-point range of -2 to +2. Any details on the effect?

Some traits, such as drug dependency and movement speed, are "spectrum" rather than singular traits, with various values possible. This is one of several points I'll be addressing in more detail in expanded documentation in the next release, but in the meantime, if you simply look at the core game's traits definition files, you'll find everything you need.
- Rainbeau Flambe (aka Darryl Burgdorf) -
Old. Short. Grumpy. Bearded. "Yeah, I'm a dorf."



Buy me a Dr Pepper?

AngleWyrm




Quote from: dburgdorf on March 25, 2017, 12:05:50 PM
As I've endeavored to explain to you repeatedly, you CANNOT simply alter the tags and organization of an XML file arbitrarily and expect it to work.
Here's a quote from the author of a book on the subject. Click the cover art if you wish to read it.

Quote from: Michael KayXSLT (Extensible Stylesheet Language: Transformations) is a language that, according to the very first sentence in the specification (found at http://www.w3.org/TR/xslt20/), is primarily designed for transforming one XML document into another. However, XSLT is also capable of transforming XML to HTML and many other text-based formats, so a more general definition might be as follows:

XSLT is a language for transforming the structure and content of an XML document.


To the left is an image of what we might call the Rimworld API, the data structure as the game presents and understands it. To the right is an image of a transform from the API to another potentially different arrangement.


My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

dburgdorf

Quote from: AngleWyrm on March 25, 2017, 02:49:18 PMHere's a quote from the author of a book on the subject.... XSLT... is a language that... is primarily designed for transforming one XML document into another.

At this point, I honestly hope you're trolling.

Sure, you can transform one XML document into another. But when you do so, the new document WILL NOT BE UNDERSTOOD by code designed to read the old document, because the tags in the new document WILL NOT BE the tags the code is expecting.

You can easily verify this by trying to use your "transformed" XML backstories file with my mod, and seeing for yourself the long list of errors which will show up in your log file as a result.


- Rainbeau Flambe (aka Darryl Burgdorf) -
Old. Short. Grumpy. Bearded. "Yeah, I'm a dorf."



Buy me a Dr Pepper?

AngleWyrm

#6

Can't say he didn't have an opportunity.

Meanwhile back at the ranch, I've compiled documentation for the backstory API as presented by Rimworld to and from data consumers. It's html; as always just start at the index of the root directory. Lemme know if I've missed anything ;)

One of the oddities that comes up in backstory creation is that authors have differing ideas about favorite skills, and so the distribution of buffs/debuffs in the backstories is unlikely to be a neat mathematical model, instead reflecting various biases.

It may be useful to tabulate how the skills are distributed, and use the sight of that as part of the character backstory creation process. This sounds like a job for transforms :P

[attachment deleted by admin due to age]
My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

Granitecosmos



What I like the most is that you try so hard to seem like a professional, yet anyone with the least amount of modding experience knows you have no idea what you're doing.



As Dr. Pingas Robotnik would say: "Happiness is so much more enjoyable when it's based on the misery of others."



Please do continue. I want to see the part where you realize this and actually improve, too. Dunno how long will that take, though.

Now where's my second popcorn?

AngleWyrm

#8

Skills Distribution spreadsheet with pages by skill, by adjustment, and 2-D view.

No humans were forced to hand-type data for the above spreadsheet, and the Robot Council of Fair Practice between Humans and Machines has been appeased of their complaint for infringement on duties more suitable to machines.

Observations
  • The set of adult backstories doesn't have any -1s to skill.
  • There's an unusually large proportion of bonuses to melee
  • Mining and Cooking are under-represented
If taken as equally likely, the set of basic adult backstories doesn't match the typical needs and uses of a prosperous colony.


My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

Granitecosmos

Quote from: AngleWyrm on March 26, 2017, 02:15:04 AM
There's an unusually large proportion of bonuses to melee
That might be because it's the hardest to train of all skills. Additionally, the majority thinks melee is underperforming compared to ranged.

Quote from: AngleWyrm on March 26, 2017, 02:15:04 AM
Mining and Cooking are under-represented
High mining skill is one of the least important things. It can also be trained extremely easily in all biomes but one, and in that one you don't use it anyway since there are no rocks.
Cooking is used from the start, throughout the lifetime of a colony and therefore trains constantly.

It's almost like you can't just balance the average skill point distribution by mathematically equalizing everything. I wonder why.  ::)  ::)  ::)

Quote from: AngleWyrm on March 26, 2017, 02:15:04 AM
If taken as equally likely, the set of basic adult backstories doesn't match the typical needs and uses of a prosperous colony.

It's almost like backstories weren't balanced for lategame when you can train anyone in most skills easily. I mean, it's totally not because preset skill levels matter the most for earlygame. Nope, not at all.  ::)  ::)  ::)


AngleWyrm

#10
Finished the schemas for Rimworld API and backstories authorship. When writing a new xml of backstories, associate it with the backstories authorship schema and most modern editors will offer prompts for the next valid tag, and value ranges for enumerated data types.

The data mappers (both *.dm and *.xslt) are for translating the human-readable xml to a game-readable xml. I've tried using it to translate the example code below and then copy/pasting from the output file to the end of the adults xml and it works fine in-game. More automation to come.

If you're working directly with a game-readable xml, associating the Rimworld API schema should provide similar but less legible results. Also, you take full responsibility for mucking about in your game files if you do so.

Here's an example of what it looks like to type a backstory with the Backstories Authorship schema associated:<?xml version="1.0" encoding="UTF-8"?>
    <backStories xsi:noNamespaceSchemaLocation="file:///C:/Documents%20and%20Settings/Jonathan/Desktop/Rimworld/Backstories/Schemas/Backstories%20Authorship.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <backStory storyID="Leader1">
            <title>Leader in Botany</title>
            <shortTitle>Botanist</shortTitle>
            <description>NAME is a recognized leader in the field of botany.</description>
            <ageGroup>Adulthood</ageGroup>
            <eligibleFactions>
                <faction>Civil</faction>
                <faction>Raider</faction>
                <faction>Slave</faction>
                <faction>Trader</faction>
                <faction>Traveler</faction>
            </eligibleFactions>
            <workPrerequisites>
                <work>PlantWork</work>
                <work>Animals</work>
                <work>Caring</work>
            </workPrerequisites>
            <skillChanges>
                <change>
                    <skill>Growing</skill>
                    <adjustment>+3</adjustment>
                </change>
                <change>
                    <skill>Animals</skill>
                    <adjustment>+2</adjustment>
                </change>
                <change>
                    <skill>Medicine</skill>
                    <adjustment>+1</adjustment>
                </change>
            </skillChanges>
</backStory>

</backStories>


[attachment deleted by admin due to age]
My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

AngleWyrm




The <Defs> tag doesn't mind attributes, and the game carries on parsing backstory xmls just fine. So it's possible to place unique IDs in the tag as an attribute, which is the normal way of assigning IDs.

For example, <Defs storiesID="MyBackstoriesCollection"> is an acceptable node as far as the game is concerned.

Which begins to look like support for multiple sets of backstories.
My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

Granitecosmos

Quote from: AngleWyrm on March 26, 2017, 11:35:39 AM
The data mappers (both *.dm and *.xslt) are for translating the human-readable xml to a game-readable xml. I've tried using it to translate the example code below and then copy/pasting from the output file to the end of the adults xml and it works fine in-game.
FINALLY! Took you long enough. You should've started with this instead of making fancy databases of existing backstories or posting mostly irrelevant pictures noone cares about. (No, I'm not talking about your obsession with random female pictures in every post you ever make, I got used to that already. I'm talking about all those pictures containing data which you describe in your posts anyway, effectively repeating yourself over and over.)

Starting with compatibility, then adding functions while relentlessly testing compatibility. That's how it should've been from the start. You've finally reached the point where you added compatibility, good job.



Took you severeal days, though.

AngleWyrm


Yes, well File/Save-As is an important feature and it seemed pretty obvious that a lossless information mapping could go both ways.

Colony Leadership & Teaching collection
For the mod Colony Leadership & Teaching by Nanodalt, this is a set of four adult backstories, applicable to any faction. Each backstory gives three bonuses in the form of a primary and two secondary skills that are what that leader can teach.

In order to teach those skills a leader must have skill proficiency of 8+ in them. So when using EdB's Prepare Carefully, the mouse-over that shows the bonuses for a given backstory is helpful in setting up characters that will be able to teach the full range of a given class of leader.

<Defs storiesID="LeadershipAndTeaching">
    <REB_Code.BackstoryDef>
<defName>GeneralW01</defName>
<Slot>Adulthood</Slot>
<Title>Leader in botany</Title>
<TitleShort>Botanist</TitleShort>
<BaseDesc>NAME is a recognized leader in the field of botany, and HIS peer-reviewed work on genetic updates to haygrass has been published in science journals.</BaseDesc>
<requiredWorkTags>
<li>PlantWork</li>
<li>Animals</li>
<li>Caring</li>
</requiredWorkTags>
<SkillGains>
<li><key>Growing</key><value>5</value></li>
<li><key>Animals</key><value>3</value></li>
<li><key>Medicine</key><value>3</value></li>
<li><key>Shooting</key><value>-1</value></li>
<li><key>Melee</key><value>-1</value></li>
</SkillGains>
<BodyTypeMale>Male</BodyTypeMale>
<BodyTypeFemale>Female</BodyTypeFemale>
<SpawnCategories>
<li>Civil</li>
<li>Raider</li>
<li>Slave</li>
<li>Trader</li>
<li>Traveler</li>
</SpawnCategories>
</REB_Code.BackstoryDef>

<REB_Code.BackstoryDef>
<defName>GeneralW02</defName>
<Slot>Adulthood</Slot>
<Title>Leader in science</Title>
<TitleShort>Scientist</TitleShort>
<BaseDesc>NAME is a recognized leader in general science. HE holds several patents on DNA resequencing in live organisms, and HECAP is traveling to a planet where authorization has been given to run experiments with outbreak potential.</BaseDesc>
<requiredWorkTags>
<li>Intellectual</li>
<li>Animals</li>
<li>Caring</li>
</requiredWorkTags>
<SkillGains>
<li><key>Research</key><value>5</value></li>
<li><key>Animals</key><value>3</value></li>
<li><key>Medicine</key><value>3</value></li>
<li><key>Shooting</key><value>-1</value></li>
<li><key>Melee</key><value>-1</value></li>
</SkillGains>
<BodyTypeMale>Male</BodyTypeMale>
<BodyTypeFemale>Female</BodyTypeFemale>
<SpawnCategories>
<li>Civil</li>
<li>Raider</li>
<li>Slave</li>
<li>Trader</li>
<li>Traveler</li>
</SpawnCategories>
</REB_Code.BackstoryDef>

<REB_Code.BackstoryDef>
<defName>GeneralW03</defName>
<Slot>Adulthood</Slot>
<Title>Leader in warfare</Title>
<TitleShort>Warrior</TitleShort>
<BaseDesc>NAME has fought HIS way up through the ranks from squad leader to master seargent, and has led several successful missions teaching the local rebels how to conduct raids.</BaseDesc>
<requiredWorkTags>
<li>Violent</li>
<li>Scary</li>
<li>Caring</li>
</requiredWorkTags>
<SkillGains>
<li><key>Shooting</key><value>5</value></li>
<li><key>Melee</key><value>3</value></li>
<li><key>Medicine</key><value>3</value></li>
<li><key>Social</key><value>-2</value></li>
</SkillGains>
<BodyTypeMale>Male</BodyTypeMale>
<BodyTypeFemale>Female</BodyTypeFemale>
<SpawnCategories>
<li>Civil</li>
<li>Raider</li>
<li>Slave</li>
<li>Trader</li>
<li>Traveler</li>
</SpawnCategories>
</REB_Code.BackstoryDef>

<REB_Code.BackstoryDef>
<defName>GeneralW04</defName>
<Slot>Adulthood</Slot>
<Title>Leader in carpentry</Title>
<TitleShort>Carpenter</TitleShort>
<BaseDesc>NAME began HIS career as a construction worker, where HECAP took an interest in design flaws. HECAP went to night school and became an architect to improve upon them.</BaseDesc>
<requiredWorkTags>
<li>Artistic</li>
</requiredWorkTags>
<SkillGains>
<li><key>Construction</key><value>5</value></li>
<li><key>Crafting</key><value>3</value></li>
<li><key>Artistic</key><value>3</value></li>
<li><key>Mining</key><value>-2</value></li>
</SkillGains>
<BodyTypeMale>Male</BodyTypeMale>
<BodyTypeFemale>Female</BodyTypeFemale>
<SpawnCategories>
<li>Civil</li>
<li>Raider</li>
<li>Slave</li>
<li>Trader</li>
<li>Traveler</li>
</SpawnCategories>
</REB_Code.BackstoryDef>
</Defs>
My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

dburgdorf

Your insistence that you're somehow converting between human-readable and game-readable XML code is completely ridiculous. All XML code, by definition, is human-readable. There is absolutely nothing in the default backstory files that can't be easily understood by a human being. The only issue is that you simply don't like the tags that are used.

When all is said and done, what you've created is a tool which will take XML files which can already be easily read by human beings and which can also be understood by the game code that has to read them, and convert them into XML files which are no easier for humans to read, but which *can't* be read by the game code... and then convert them back again.

I am underwhelmed.

I assume you've also added some sort of error checking. While error checking is obviously useful, unlike your silly transform-and-transform-back gimmick, I'd point out there there are still potential problems with anything more than basic XML structure validation, which of course doesn't require your tool, anyway.

Any sort of data validation would of necessity be based upon entries which are valid in a vanilla game build. So what happens if, for example, someone wants to create backstories utilizing traits, or skills, or spawn categories, added by mods?

Sorry, but I'll continue to use Notepad or Notepad++ for my XML editing, and will continue to recommend that users of my "Editable Backstories" mod do the same.
- Rainbeau Flambe (aka Darryl Burgdorf) -
Old. Short. Grumpy. Bearded. "Yeah, I'm a dorf."



Buy me a Dr Pepper?