Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » FreeStars » Component File Sample (long)
icon10.gif  Component File Sample (long) Thu, 10 July 2003 14:00 Go to next message
overworked is currently offline overworked

 
Lt. Junior Grade

Messages: 403
Registered: November 2002
Location: Pittsburgh, PA

Well, here's a snip of what a component currently looks like. We're using XML as the format. If you having coding/processing questions then you need to talk to Leit.

First, a "simple" part: Our buddy the Fuel Mizer engine

<Component>
<Type>Engine</Type>
<Name>Fuel Mizer</Name>
<EngineType>Ramscoop</EngineType>
<Costs>11 8 0 0 0</Costs>
<Tech>-1 -1 2 -1 -1 -1</Tech>
<Mass>6</Mass>
<FuelUsage>-10 -6 -3 -1 35 120 175 235 360 420</FuelUsage>
<SafeSpeed>9</SafeSpeed>
<MaxSpeed>10</MaxSpeed>
<FreeSpeed>4</FreeSpeed>
<BattleSpeed>6</BattleSpeed>
<Value>
<Type>Engine</Type>
<Number>6</Number>
</Value>
<LRTNeeded>Improved Fuel Efficiency</LRTNeeded>
</Component>

"Costs" are a list - Resources, Mineral1 (iron)... Mineral3 (germ) and then Crew/Population (which is currently zero for everything - but added for potential expansion.]

"Tech" is -1 if not required, otherwise the required level. Standard En, Wp, Pr, Con, El, Bio order. We're not looking at adding new tech fields.

FuelUsage is a list of the base fuel usage at each Warp Speed (1-10). Negative values are fuel gain from scooping.

The "Value" block is a recent addition. It assigns a sub-type and value to the component. In current usage the value is checked for when a starting ship design (i.e. Santa Maria colonizer) might have better tech parts available. If you have IFE and > Prop 2 at start your Santa Maria will not have a Quick Jump 5 Engine but probably a Fuel Mizer instead. The "Value" section allows the code to check if a "more valuable" component is available for that starting ship.

In addition to that I think the Value blocks might eventually prove useful for anyone wanting to automate ship design for either an utility or an AI player script.

Finally, note the "LRTNeeded" clause. This ties the component to a facet of the building race. There are also clauses to handle required PRTs and denying the part to certain LRT and PRT values.

Most things are fully named for ease of understanding.

Processing the file converts most of these into much more abstract variable values. Fairly few capabilities are inter-connected. "Ramscoop" type is differentiated for instance; you could also define "ramscoop" = "FreeSpeed > 1" (which is true for the current game). But, this prevents you from later adding
a "standard" engine with a higher free speed for instance without doing some additional changes to the processing code itself.

A "ship" inherits the abilities of its attached "components" - thus inherited classes are used to build up the full capabilites of a ship that can be easily queried and manipulated accordingly in the code.

I'll pull a ship hull next and put it in a separate message.

- Kurt



Time flies like an arrow.
Fruit flies like a banana.
- Groucho Marx

Report message to a moderator

Re: Component File Sample (long) Thu, 10 July 2003 14:07 Go to previous messageGo to next message
overworked is currently offline overworked

 
Lt. Junior Grade

Messages: 403
Registered: November 2002
Location: Pittsburgh, PA

OK. Now a sample ship hull... The Frigate

<Component>
<Type>Hull</Type>
<Name>Frigate</Name>
<HullClass>Scout</HullClass>
<Costs>12, 4, 2, 4, 0</Costs>
<Tech>-1, -1, -1, 6, -1, -1</Tech>
<Mass>8</Mass>
<Fuel>125</Fuel>
<Armor>45</Armor>
<InitAdj>4</InitAdj>
<Slot>
<Type>ENGINE</Type>
<Number>1</Number>
</Slot>
<Slot>
<Type>SHIELD</Type>
<Type>ARMOR</Type>
<Number>2</Number>
</Slot>
<Slot>
<Type>GENERAL</Type>
<Number>3</Number>
</Slot>
<Slot>
<Type>SCANNER</Type>
<Number>2</Number>
</Slot>
</Component>

The hull itself can have a full set of clauses assigned to it. PRT limitations, special abilities (like x2 mine laying), or basically any capability that a part component has.

In addition to this a ship hull has "Slot" Blocks. These define what additional components the ship can inherit capabilities from (when built). A slot basically defines what component type can be fitted, and how many. Note that a slot can have multiple types defined for it (the Shield/Armor slot).

Hope this is at least somewhat interesting. I can probably field general questions about the components file - and once I get caught up on the current code base I'll see about posting some further information.

- Kurt



Time flies like an arrow.
Fruit flies like a banana.
- Groucho Marx

Report message to a moderator

Re: Component File Sample (long) Thu, 10 July 2003 14:18 Go to previous messageGo to next message
LEit is currently offline LEit

 
Lt. Commander

Messages: 879
Registered: April 2003
Location: CT
Here's a section of the RacialTraits.xml file:

<PrimaryRacialTrait>
<Name>Super Stealth</Name>
<InherentCloaking>
<HullClass>All</HullClass>
<Cloaking>300</Cloaking>
</InherentCloaking>
<CloakCargo>true</CloakCargo>
<MineSpeedBonus>1</MineSpeedBonus>
<SpyTechBonus>0.5</SpyTechBonus>
<StartingTech>0 0 0 0 5 0</StartingTech>
<ShipDesign>
...

It says that this PRT is named Super Steath (hooks into the Components.xml file for components allowed/restricted).
SS has Inherent cloaking on all ships of 300 units (75%)
They can also cloak cargo - actually they don't count cargo in determining the mass for cloaking.
They get a bonus of 1 warp in mine fields
They have a spy bonus of half (of the average of everyone elses spending).
Starting tech listed is the same format as the Components (so SS starts with tech 5 in elec).
And then it lists starting ships, the Value part in the Components will upgrade the ships to what tech you really start with (start at 3 checked, and or LRTs that adjust starting tech levels).

Here is a LRT:
<LesserRacialTrait>
<Name>Improved Starbases</Name>
<ComponentCostFactor>
<ComponentType>Base</ComponentType>
<CostFactor>0.8</CostFactor>
</ComponentCostFactor>
<InherentCloaking>
<HullClass>Base</HullClass>
<Cloaking>40</Cloaking>
</InherentCloaking>
<Cost>67</Cost>
</LesserRacialTrait>

Name again hooks into Components.xml to allow some extra base hulls.
ComponentCostFactor, says that with this LRT every Component type of Base has a cost multiplier of .8 (hmm, I just realized, we'll have to apply it to everything on a base too)
InherentCloaking gives all bases 40 cloaking units (20% cloaking) note that this will stack with SS inherent cloaking.
And this LRT has a cost of 67 Race wizard points.



- LEit

Report message to a moderator

Re: Component File Sample (long) Thu, 10 July 2003 23:00 Go to previous messageGo to next message
Korsar is currently offline Korsar

 
Crewman 3rd Class

Messages: 4
Registered: June 2003
Location: Perm, Russian Federation
Quote:

<FuelUsage>-10 -6 -3 -1 35 120 175 235 360 420</FuelUsage>
<SafeSpeed>9</SafeSpeed>
<MaxSpeed>10</MaxSpeed>
<FreeSpeed>4</FreeSpeed>

FreeSpeed can be calculated in some func by scanning FuelUsage table (max index with value <= 0)

Quote:

<Number>1</Number>

Don't use hardcoded numbers
Use text ID's instead (ENG_FuelMizer) and make table ID's and internal tech # on loading/parsing .xml
This way you can change/delete/insert any tech without renumbering in many files (cross-references by ID, not numbers)

Report message to a moderator

Re: Component File Sample (long) Thu, 10 July 2003 23:53 Go to previous messageGo to next message
LEit is currently offline LEit

 
Lt. Commander

Messages: 879
Registered: April 2003
Location: CT
That Number is the nuber of items in the slot.
Or if it's the Number in the value column, it's the score of the part for ranking items for starting ships.



- LEit

Report message to a moderator

Re: Component File Sample (long) Fri, 11 July 2003 00:17 Go to previous messageGo to next message
Crusader is currently offline Crusader

 
Officer Cadet 2nd Year

Messages: 233
Registered: January 2003
Location: Dixie Land
Yep. Looks a LOT like XML. Whew! You guys are making me tired just thinking about it, but then I spent the day setting up a new Web Access server for GroupWise 6.5 (to replace the 5.5 one). Tomorrow I'll try getting the SSL piece to work and bypassing the language selection page, since not too many Dixie guys and chicks understand anything other than Dixie English. Very Happy

Respectfully,
The Crusader Angel



Nothing for now.

Report message to a moderator

Re: Component File Sample (long) Fri, 11 July 2003 05:52 Go to previous messageGo to next message
Korsar is currently offline Korsar

 
Crewman 3rd Class

Messages: 4
Registered: June 2003
Location: Perm, Russian Federation
That Number is the nuber of items in the slot[/quote]
well, call this "Count"
I mean "number" in engine component,
[quote]<BattleSpeed>6</BattleSpeed>
<Value>
<Type>Engine</Type>
<Number>6</Number>
</Value>[/qoute]
This number (IMHO) better change to text ID

Report message to a moderator

Re: Component File Sample (long) Fri, 11 July 2003 10:05 Go to previous messageGo to next message
Sinla is currently offline Sinla

 
Warrant Officer

Messages: 132
Registered: February 2003
Location: the Netherlands
LEit wrote on Thu, 10 July 2003 20:18


<snip>
They have a spy bonus of half (of the average of everyone elses spending).



maybe a bit O/T, but this is a bit different from the current stars...
"The Super Stealth race gains free resources in each Tech every turn, each equal to half of the average resources spent by all races on that Tech" it sais in the SSG.
And this is true in my feeble experience with SS. You also get tech from back from your own investment.
Just thought to mention it Rolling Eyes

BR,

S



If you can't beat me... Run away...

Report message to a moderator

Re: Component File Sample (long) Fri, 11 July 2003 11:30 Go to previous messageGo to next message
LEit is currently offline LEit

 
Lt. Commander

Messages: 879
Registered: April 2003
Location: CT
Sinla wrote on Fri, 11 July 2003 10:05

LEit wrote on Thu, 10 July 2003 20:18


<snip>
They have a spy bonus of half (of the average of everyone elses spending).



"The Super Stealth race gains free resources in each Tech every turn, each equal to half of the average resources spent by all races on that Tech" it sais in the SSG.



Thanks for pointing that out. I'll make sure it's right when I actually get to that code...



- LEit

Report message to a moderator

Re: Component File Sample (long) Fri, 25 July 2003 22:10 Go to previous messageGo to next message
Hatterson is currently offline Hatterson

 
Warrant Officer
Past Weekly Puzzle Master

Messages: 121
Registered: May 2003
Location: NY, USA

Sinla wrote on Fri, 11 July 2003 10:05

You also get tech from back from your own investment.


Yes it turns out that your return from your own investment is:

resources_gained = resources_spent / (total_number_players * 2)

Therefore if you spend 1000 resources in weapons research and there are ten players in the game the return from your investment alone is 1000/(10*2) or 50 resources.



"Don't be so humble - you are not that great. " - Golda Meir (1898-1978) to a visiting diplomat

Report message to a moderator

Re: Component File Sample (long) Wed, 10 December 2003 18:24 Go to previous messageGo to next message
boneandrew is currently offline boneandrew

 
Crewman 1st Class

Messages: 35
Registered: June 2003
Location: Detroit
Just my meager $.02

The tech requirement for "no tech" should be 0, not -1. You can use a simpler data storage. And seeing if something is non-zero is slightly easier to check than seeing if something is positive (for miniturization, for example).

Report message to a moderator

Re: Component File Sample (long) Wed, 10 December 2003 20:37 Go to previous messageGo to next message
Sotek is currently offline Sotek

 
Chief Warrant Officer 2

Messages: 167
Registered: November 2002
boneandrew wrote on Wed, 10 December 2003 18:24

The tech requirement for "no tech" should be 0, not -1. You can use a simpler data storage. And seeing if something is non-zero is slightly easier to check than seeing if something is positive (for miniturization, for example).


A miniturization option's precisely why it'd be a good idea to use a -1.

What if I want to modify things slightly so that the scout hull miniturizes from const only?

It'd be easy enough to do with -1 tech requirement.

And speaking as a programmer, -1 is a very common value for 'does not exist', and it's nice to be consistant like that...
...and you can't get much simpler data storage than the basic integer, which, I should point out, is a signed variable.

And to check if it's positive?

if (variable > -1 ).

Simple and explicit.

Report message to a moderator

Re: Component File Sample (long) Fri, 12 December 2003 01:16 Go to previous messageGo to next message
boneandrew is currently offline boneandrew

 
Crewman 1st Class

Messages: 35
Registered: June 2003
Location: Detroit
Yeah, you're right. Upon further thought, I concluded I did not propose a useful $.02. Embarassed -1 for DNE, 0 for miniturization possible but no tech required.

Report message to a moderator

Re: Component File Sample (long) Tue, 23 December 2003 19:08 Go to previous messageGo to next message
nash is currently offline nash

 
Chief Petty Officer

Messages: 84
Registered: December 2003
Location: Sydney Australia
overworked wrote on Fri, 11 July 2003 04:00


<Component>
    <Type>Engine</Type>
    <Name>Fuel Mizer</Name>




May I make a suggestion for internationalisation...

You should have a unique internal name/id, and then make the (visible) Name field locale specific, probably using a language attribute.

<component>
    <type>Engine</type>
    <id>FuelMizer</id>
    <name xml:lang="en">Fuel Mizer</name>
    <name xml:lang="fr">Le Fuel Mizer</name>
    <name xml:lang="x-sweedishchef">Bork Bork Vuel Vizer</name>
...
</component>


Then internally the only thing important is the id, and translation to a locale is fairly easy.

Additionally if someone was to write a XSLT to transform the tech list to HTML, postscript or similar, they allready have the translations avialable[1].

Note:
My apologies to all French speaking people world wide for my example.

[1] This is something I would be likely to do Razz



Sentio aliquos togatos contra me conspirare.

Report message to a moderator

Re: Component File Sample (long) Tue, 23 December 2003 20:58 Go to previous messageGo to next message
LEit is currently offline LEit

 
Lt. Commander

Messages: 879
Registered: April 2003
Location: CT
I was going to leave localization to the Client programs, if those want to add some common names in other languages to the Components file, that is fine, the host program will ignore them. I think it ignores the name already.

I am trying to keep anything locale specific out of the host program. However, as a person born and raised in USA, my understanding of what is and is not specific to the US is not as good as it should be.

If I end up writing the client, I'll try to have a language be selectable, however, seeing as I only speak English, it might be hard to know what other languages need for support (right to left text for example).



- LEit

Report message to a moderator

Re: Component File Sample (long) Thu, 05 February 2004 10:31 Go to previous messageGo to next message
Sumo_Sniper is currently offline Sumo_Sniper

 
Crewman 3rd Class

Messages: 6
Registered: January 2004
Location: Western Australia

Speaking of multilanguage support I could, with the help of a dictionary to fill the gaping gaps, do a Romanian translation. Although I must admit, literal translations can be hillariously bad. And I know American/Aussie english better than I know Romainian, still, I havent lost it.

Of course, has to fit around school stuff, but I could do it, there ain't THAT much to do.

Another thing to consider though, is are there any Romainians other than me who play stars?... Got me.

A good first step though.



- The Overstuffed Sharpshooter

Report message to a moderator

Re: Component File Sample (long) Sun, 28 March 2004 13:00 Go to previous message
edorfaus is currently offline edorfaus

 
Crewman 3rd Class

Messages: 8
Registered: March 2004
For localization I would suggest not modifying the existing files, but instead have files containing translations from in-file text labels to client-display text labels. That way you wouldn't have to modify the data files - and people could download only those translations they actually wanted, keeping the size low for those who don't want/need all the languages.

Besides, as LEit already mentioned, localization is really a client issue - it's up to the client to support it, so the common files shouldn't, IMO, be bogged down with text for various languages.

That being said, it wouldn't hurt to have a common file format for translations, XML would be nice, that all(or at least most of) the clients(that support localization) could use. If properly made, such a file could include anything from one to many languages.

This could also be used for "themed" games where you've renamed various components - instead of editing the core data file(although you might want to do this anyway), you write a translation file.


Although this would be completely up to the client(and perhaps not something for the first one), I'd also suggest having similar files for graphics used in the GUI, or maybe even having full "skin" support.. Fully optional, of course.

Report message to a moderator

Previous Topic: Battles
Next Topic: Graphics
Goto Forum:
  


Current Time: Sun Apr 28 01:43:56 EDT 2024