FreeOrion

Forums for the FreeOrion project
It is currently Wed Jun 19, 2013 7:53 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: XML improvments
PostPosted: Tue Jun 21, 2005 5:39 am 
Offline
Creative Contributor
User avatar

Joined: Sun Jun 29, 2003 12:40 am
Posts: 1060
Location: Tucson, Arizona USA
I have been thinking of making some improvments to our XML formating for technologies and future documents of the same type. The current formating is a not very sophisticated and many people are having trouble using it as pointed out on the Brainstorming board. Whial looking over the current format their are several issues I have.


First and formost is the <Unlocked items> under <Tech> in the Tech.xml. Is it our intention to place here the devices, buildings and other such "stuff" that a tecnology give you access too? If so I must disagree, its far better for the mod makers of the furture if each Technology, device or other "thing" in the game that can be obtained lists only its own Pre-requisites. Adding a new item becomes much much simpler as only the new items code need be created and inserted in a single spot, the potentialy numerous pre-requsites dont need to be updated with new stuff. Removing an item is just as easy. In addition a truely universal pre-requisite format can be created and used for all items in the game. Any consevable thing in the game could be used as a pre-requisite such as a building, diplomatic status, event occurance or Racial type. With only a single format to learn moders will find it much easier to mod. It might look something like this.

<Prerequisites>
<Pre-Event Scope="Galactic" Duration="Ever" Name="Return_of_the_Orions" />
<Pre-Tech Scope="Self" Duration="Current" Name="Orion_Prophecy" />
<Pre-Building Scope="Self" Durration="Current" Name="Orion_Temple" />
</Prerequisites>

Logical AND and OR tags can be used as well, Prerequsites itself is a kind of logical AND in the sense that all its children must be true to give access to the prize. In addition it might be nice to include a Logical "Atleast #" tag. Say I have 5 items and any 3 of them would grant access, I can combine these under a "Atleast" tag with a value of 3. This would be considerable easier then the multiple And/Or statment that would otherwise be required.


The second major area I think could be improved is that of tech descriptions and other "fluff" Paraphanalia. I can see that we already have a plan to simply use references to the real descriptions which will be help on a page of string tables. Why not combine all textual "fluff" elements under one element and reference it to the Tech name. The tech would no longer need to contain this information and changes need to be made in only a single location. On a similar vein the Image and or sound file for a thing should simple have a matching name to reference it. Moding would again be made simpler by keeping all related data together.


Another area that needs adressing is Refinment technology. The wiki says that Refinment is not yet implemented. We should come up with some definitive plans and an implementation plan. I think we should aim for something that combines as much of the refinment data with the original aplication data as possible. Such as listing all the subsequent device data and all the subsequent costs in one spot. We know these things will require a great deal of tweaking so they should be easy to get to as a group and manipulate.

_________________
Fear is the Mind Killer - Frank Herbert -Dune


Top
 Profile  
 
 Post subject: Re: XML improvments
PostPosted: Tue Jun 21, 2005 6:31 am 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 8056
Location: Vancouver, BC
Impaler wrote:
Why not combine all textual "fluff" elements under one element and reference it to the Tech name. The tech would no longer need to contain this information and changes need to be made in only a single location. On a similar vein the Image and or sound file for a thing should simple have a matching name to reference it.

I can't figure out what you mean by this... can you explain / elaborate?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 21, 2005 6:41 pm 
Offline
Creative Contributor
User avatar

Joined: Sun Jun 29, 2003 12:40 am
Posts: 1060
Location: Tucson, Arizona USA
Currently we have something along the lines of... (coppied from Wiki)

<Tech>
<name>LRN_PHYS_BRAIN</name>
<description>LRN_PHYS_BRAIN_DESC</description>
<type>TT_THEORY</type>
<category>LEARNING_CATEGORY</category>
<research_cost>10</research_cost>
<research_turns>5</research_turns>
<prerequisites></prerequisites>
<unlocked_items></unlocked_items>
<graphic>tech_icons/The_Physical_Brain.png</graphic>
</Tech>


The name, Image and description are fluff because they dont have any real effect on the game, their eye cand. Were going to be using a string table to substetute in the Description and Name that the player sees. The true name element though would be used for referencing a Tech inside of the XML document itself, for example to refer to a Pre-requisite. Because each fluff element is a seperate piece of data its very likly they will be in several different places and harder to track down. With one spot for everything it gets easier to mod. We want to string.xml to look something like this.

<Tech_Fluff>
<True_Name>LRN_PHYS_BRAIN</True_NAME>
<Fluff_Name>The Physical Brain</Fluff_Name>
<Description>The stuctures and their functions in the brain are determined. The electrochemical and quantum nature of thought and memory are exposed. With understanding, alteration and augmentation of brain functions becomes possible, and new ideas are spawned at the frontiers of thought, its expression, and its replacement.</Description>
<Quote>Is the brain mearly a computer? We have speculated so for generations but NOW we can definitivly say it is not. Rather the Brain is a blankslate, continualy reshaping itself to mimic the order found in its environment.</Quote>
<Tech_Fluff>


Whole Fluff Element is linked to the un-adorned Tech Element by use of the True_Name element. The image file would be found by simply taking the True_Name adding .png to it and looking for it in the Tech Icons File. The same would go for any Audio file we might use. If a tech is unable to find its Fluff element then it loads a set of Default Fluff basicaly saying it has no name Description and Image.

_________________
Fear is the Mind Killer - Frank Herbert -Dune


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 21, 2005 10:23 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 8056
Location: Vancouver, BC
So you're proposing to redo the stringtable as an XML file, and to organize all the strings by what they're used for for techs and such... Sounds reasonable, but you'd have to reorganize all the non-tech, non-item, generic game strings as well, which would be a big job, and it might not be obvious how to organize things when you do... though I'm sure a reasonable scheme could be worked out.

A bit better main tag for the individual techs' groupings could probly be found though... maybe something like

<Tech_Fluff Tech="LRN_PHYS_BRAIN">

instead of the <True_Name> tag inside specifying the name, which makes the "true name" appear as though it's part of the fluff.

Also, I think just having <icon_file> and <audio_file> tags would be better than forcing the naming to be <true name> + ".png" or ".ogg". IMO this would be clearer and and more flexible (in case you wanted to use the same image for more than one tech, for instance).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 21, 2005 11:21 pm 
Offline
Creative Contributor
User avatar

Joined: Sun Jun 29, 2003 12:40 am
Posts: 1060
Location: Tucson, Arizona USA
Well we might have a seperate document for each type of Fluff, One for Devices, one for buildings. After all their are different requirments for each. But Idealy they would be grouped as child elements under a single <Fluff_Groups> root element on on one document. Each Fluff Catagory would contain a reference to the directory inwhich the Graphic and Audio files for each catagory would go.

What do you think of the other sugjestion conserning Universal Pre-requisite elements and our handling of Refinments? As I see it would can simplify the Tech.xml to something like this.

<Techs>
<Catagory Catagory_Name="Learning">
<Tech Tech_Name="PHYS_BRAIN" Type="Theory" Cost="10" Turns="5">
<Prerequisites></Prerequisites>
<Effects></Effects>
</Tech>
</Catagory>
</Techs>

Prerequsites and Effects would be the only child elements of a Tech as these are the only ones complex enough to need it. When we go on to create files for Ship Components and Buildings these will use the same format for their Effects and Prerequiste elements but will have some additional items that specify things like ware a building can be placed or what ship a device can go in (lets call that "Requirments". Events will need Triggering information, Goverment and Economic systems would be similar to Techs as would any skills and abilities for Heos/Characters.

_________________
Fear is the Mind Killer - Frank Herbert -Dune


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 22, 2005 12:05 am 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 8056
Location: Vancouver, BC
Impaler wrote:
Well we might have a seperate document for each type of Fluff

It should be all in one file, to simplify making and distributing translations.

Quote:
What do you think of the other sugjestion conserning Universal Pre-requisite elements and our handling of Refinments?

Making things have prereqs, rather than making techs unlock things, makes sense. All prereqs for and location restrictions (if applicable) for buildings, techs, ships, and whatever else can probly be done with conditions, just like effect scopes / activation, if sufficient appropriate conditions are available, as I've discussed here. Conditions should also be usable for whether special functions can be activated / fired and what they can target.

Someone just needs to write the code for it all...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 22, 2005 2:11 am 
Offline
Creative Contributor
User avatar

Joined: Sun Jun 29, 2003 12:40 am
Posts: 1060
Location: Tucson, Arizona USA
Quote:
t should be all in one file, to simplify making and distributing translations.


Yes I agree completly :?

Quote:
But Idealy they would be grouped as child elements under a single <Fluff_Groups> root element on on one document.


We should do the xml plan first, then it will be much simpler to come up with the code involved (or atleast I hope it will be). You list a lot of good Pre-Requisite types their and I will try to come up with some formating for them. Most of the values should be atributes to keep the doc readable. Here is a shot at it.

First off Technology Pre-Requsites are going to be needed for almost everything in the game. Fortunatly Tecnology is an Empire wide, non-corporeal thing an empire either DOSE or DOSE"NT have any particular tecnology so a simple Name Atribute for the particular Tech is obvious. A Scope atribute will be used for the determining who needs to possess it. I dont think their are any plans for tecnology to ever be lost but it dose seem their should be ways to count how long something has happened for, a Duration atribute can cover that. So we have...

<Prereq_Tech Name="TECH_NAME" Scope="Self" Duration="Now" />

Scope will typicaly hold "Self" meaning that its your empire tht must have the Tech, you can also specify "Any" meaning that any Empire could have the Tech (put this all under a <NOT> braket to negate these). You can specify a raw number say "#3" to mean that 3 empire need the Tech or "All" to require all to have it. A number followed by a % sign asks for a % of all empires. Lastly it would be usefull to have some flexible wildcard values that can be combined with other statments. For example if I want the requirement to be that an empire must have 2 particular techs BUT it must be a single empire having both not 2 different empires having 1 each. I could use a wildcard "@X" to create wildcard empire X, each statmentment under a Pre-Requisite will recognize this wildcard as refering to a single empire. So my above example could be done with.

<AND>
<Prereq_Tech Tech="A" Scope="@X" Duration="Now" />
<Prereq_Tech Tech="B" Scope="@X" Duration="Now" />
</AND>

Multiple Wildcard can be used so long on they use a different letter. Now for Duration, this is used to determine time span since aquisition of tecnology. If a value of "Now" is used then the scope Empire just needs to have the tech right now and no more questions are asked. A numerical value means that Scope must have been in possesion of the tech for that many turns. A value of "Ever" means that even having it for a moment is sufficient (this only has any use if it is possible to loss a tecnology, which could be kind of cool and Geoff has speculated along these lines, if its not possible to loss tech then this is functinaly equivilent to "Now"). Lets say I wanted to make a Tech that becomes alalible for research to all Empires once its original owner has for 20 years. That could be done with.

<Tech Name="The_very_hard_to_keep_secret_Tech" Cost="25" Turns="12" Type="Theory" >
<Prerequisites>
<OR>
<Prereq_Tech Tech="The_very_hard_to_keep_secret_Tech" Scope="Any" Durration="20" />
<Prereq_Tech Tech="Original_means_of_obtaining" Scope="Self" Durration="Now" />
</OR>
</Prerequisites>
</Tech>


Duration can work in a similar way with several other things such as Building and Specials. This can work much like the Galaxy turn and Timing mechanism Geoff sugjested. I think it would be better though to use the Date of acuisition that dose not need to update each turn (avoiding much processing). Rather age is determined when needed by Subtraction. Every object in the game might need to have an Age so we should add this member directly to the Universe_Object for it to proliferate down to everything in the game. I am shure we could find dozens of uses for it particularly in respect to Event generation.

Building and Special Requirements should be practicaly identical. Name, Scope and Duration values would be used, but more options are avalible under Scope. You can specify "Site" under scope to refere to the potential building site itself. So to require building A to be present for Building B to be built you use.

<Pre_Build Building="A" Scope="Site" Duration="Now" />

To specify that requirments to be in the same system use "System", for adjacent systems use "Hops#2" to specify 2 starlane Hops. Self, Any, All and Empire wildcards work just as they do for Tech Requirments and reference whole empires.

Meter values are also simple to do with a Min and Max

<Pre_Meter Meter="Construction" Min="10" Max="Unbound" Duration="Now" />

Events could also be used for Pre_Requisites, Events might not always include a location though so "Galactic" would be the scope to refer to these.

<Pre_Event Event="Super_Nova" Scope="Galactic" Duration="Ever" />

Notice the "Ever" Duration it should prove quite usefull for creating senarios, "silent" events can be created to control many parts of the game behind the scene.

_________________
Fear is the Mind Killer - Frank Herbert -Dune


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group