HowTo:Edit Systems:Milkyway

From VsWiki
Jump to: navigation, search
main.php?g2_view=core.DownloadItem&g2_itemId=6608&g2_serialNumber=1&ext=.png Edit Systems

Autogenerated System Files

Since they are autogenerated, these systems must have some rules so that the generator knows what to make. These systems are autogenerated from the information contained in the XML file universe/milky_way.xml.

Overall description of how they work

From this forum post, the way it works is:

The universe/milky_way.xml file contains information on planets that are created. The information is used in two ways.

1. When generating a system, systems have pre-defined tags;

<var name="planets" value="a b *c gd bb m"/>

Each of those are looked up in this top section based on the "initial" (this was to save space, since planets is used in so many places). "*" means that it is a moon to the previous planet.

Each planet generated is made with a texture from the "texture" field, randomized between 0 (blank) and texture_max. In addition, other properties are used, such as atmosphere and lights.

The system file is then written.

2. Upon reading the system file, the HUD will look up that texture filename (as a planet type ID), and show that information on the HUD from the name (Uninhabitable Gas Giant).

Default values are chosen from "uninhabitable_sector"/"min" or "max" This is done randomly for numeric values (num_stars for example). Other elements of this: Names of individual planets are chosen from "namelist" (defined in uninhabitable_sector) => "names.txt".

There is also planetlist, starlist, moonlist. starlist is still used to generate suns based on the "num_stars" property... moons and planets however are now predefined. Nothing is accessed directly from a directory. Everything is at some point looked up from one of the lists... as to whether planets.txt is still used, I don't think so.

To test textures, the way is to edit a system file. If you don't want to modify game data, you can go into your home directory (.vegastrike), go to the sectors folder, and find the system file you want. Once the system has been generated, you can edit the XML by hand and put the planet that you want. If you want to edit Cephid 17, that is stored in the game data directory.

However, if you want to test your planet from milky (so as to get the proper atmospheres and lights), the proper method is to delete the system file from your home directory so that it will be autogenerated again, then find the system that you want in the milky_way.xml, and edit the planets property so as to only contain the initial for your planet under the "planets" tag.

If there are multiple textures, you can make the planets variable contain 10 of the planet you want, like:

<var name="planets" value="v v v v v v v v v"/>

for Volcanic.

Some detailed thoughts

If planets that are in system files are assigned textures with new names, it is very easy to change the reference in the planet statement of the system file.

However, the generic milky_way statement requires png textures.

<var name="texture_ext" value="png">

That means, if he planet type has only maximum one texture to be randomly selected while generating a random system, a statement for a different file type can be added there.

<planet name="Volcanic">
       <var name="texture" value="planets/Lava"/>
       <var name="texture_ext" value="jpg"/>
       <var name="initial" value="v"/>
       <var name="lights" value="planets/Lava_light.jpg"/> 
 </planet>

A problem arises when there are mixed textures with texture_max>0, e.g. Lava.jpg and Lava1.png. In this case a preferred format has to be chosen and remaining textures converted from one to another.

XML Schema Description

  • <galaxy> ... </galaxy> - Marks the beginning and end of the XML file.
    • <planets> ... </planets> - Section for defining the basic planet types and their textures.
      • <planet> ... </planet> - (repeatable) Individual planet description.
        • < var ... /> - (repeatable) The variables for each individual planet (var tag to be described later)
    • <systems> ... </systems> - You need it but I don't know why.
      • <sector ... > ... </sector> - (repeatable) A sector containing a group of systems.
        • name - the name of the sector. For example, enigma_sector.
        • < var ... /> - (repeatable) The default variables for the entire sector (var tag to be described later)
        • <system ... > ... </system> - (repeatable) A system (to be a system it must be inside another sector tag).
          • name - the name of the system, for example, heavens_gate.
          • < var ... /> - (repeatable) To be described later (see below).

Variables

Variable Types

  • BOOL = boolean value = "true" or "false"
  • INT = integer
  • FLOAT = decimal number
  • FILENAME = the name of a file inside the universe directory.
  • STRING = Text


Planet Variables

Here is a list of all of the possible names and their values so far when using the < var name="" value="" /> tag within the <planet/> tag.

  • name
    • Type: STRING
    • Description: Used to describe a type of planet in human-readable form. The type is also defined by an “initial,” which is the cross-reference variable used by the <system/> tag to identify the type of <planet/> .
    • Example 1: planet name="Frozen_Ammonia"
      • This would use initial “fa”.
    • Example 2: var name="texture" value="planets/industrial"
  • texture
    • Type: FILENAME
    • Description: Defines the graphic to use for the planet, along with its folder location, starting from the “textures” folder. The graphics file is wrapped over a sphere, which is lighted by the system’s sun, so there is a day side and night side. Works in conjunction with the texture_ext to define the exact file to be used.
    • Example: var name="texture" value="planets/industrial"
  • initial
    • Type: STRING
    • Description: Used as a cross-reference value to indicate the types of planets present in a star system. Cross reference is between <planet> types and <system> planetary contents.
    • Example: var name="initial" value="fa" (frozen ammonia).
    • Example from a <system> tag: var name="planets" value="a a fr" (two agricultural planets and a frozen planet).
  • atmosphere
    • Type: BOOL
    • Description: Indicates whether this planet type has an atmosphere. Unclear where this value is used.
    • Example: var name="atmosphere" value="true"
  • lights
    • Type: STRING
    • Description: Name of file (including location) containing lighting information for the planet. Appears to include options for additional lighting files and instructions.
    • Example: var name="lights" value="planets/industrial_light.png planets/industrial_light_repeat.pngwrapx64wrapy64"
  • texture_max
    • Type: INT
    • Description: Used within the <planets> tag, which also contains <planet> tags.
    • Example: var name="texture_max" value="0"
  • texture_min
    • Type: INT
    • Description: Used within the <planets> tag, which also contains <planet> tags.
    • Example: var name="texture_min" value="0"
  • texture_ext
    • Type: STRING
    • Description: Indicates the type of graphics file used for the texture. Used within the <planets> tag, which also contains <planet> tags.
    • Example: var name="texture_ext" value="png"


FIXME Add variables and definitions for texture_min, texture_max, and atmosphere usage.

Sector and System Variables

Here is a list of all of the possible names and their values so far when using the < var name="" value="" /> tag within the <system> or <sector> tag. If these variables are not set inside any of the sector tags (innermost overrides) the system will randomly use a number between the corresponding values of the unknown_sector/min and max "systems"

  • num_stars
    • Type: INT
    • Description: The number of suns in the system (to make binary systems).
    • Example:
  • sun_radius
    • Type: FLOAT
    • Description: The radius of the sun in the system.
    • Example: < var name="sun_radius" value="26000"/>
  • starlist
    • Type: FILENAME
    • Description: A file with a list of colors/textures/sprites for different sizes of stars:
    • Example < var name="starlist" value="stars.txt"/>
      • Contents of Stars.txt
        • "0 .3 1 .3 .1 stars/white_star.png"
        • "1000 .5 .5 1 .1 stars/white_star.png"
        • ... means, "if the radius of the star is greater than or equal to 0 but less than 1000, then use RGB color (.3,1,.3), variance (?) of .1 and a texture/sprite filename of "stars/white_star.png". The same goes for 1000, etc.
  • planets
    • Type: STRING
    • Description: The possible planet types (defined by the "initial" in the <planets> section in milky_way.xml) in the system.
    • Example: < var name="planets" value="a"/> One arid planet.
  • num_gas_giants
    • Type: INT
    • Description: The number of gas giant planets.
    • Example: < var name="num_gas_giants" value="3"/>
  • num_planets
    • Type: INT
    • Description: The total number of inhabited(?) planets (not including gas giants).
    • Example: < var name="num_planets" value="8"/>
  • num_moons
    • Type: INT
    • Description: The number of moons orbiting any planet.
    • Example: < var name="num_moons" value="2"/>
  • asteroids
    • Type: BOOL
    • Description: Whether there are asteroids or not.
    • Example: < var name="asteroids" value="true"/>
  • nebulae
    • Type: BOOL
    • Description: Whether there are nebulae or not.
    • Example: < var name="nebulae" value="true"/>
  • num_natural_phenomena
    • Type: INT
    • Description: How many asteroids/nebulae/? there are in the system.
    • Example: < var name="num_natural_phenomena" value="2"/>
  • namelist
    • Type: FILENAME
    • Description: a file containing a list of planet names to use.
    • Example: < var name="planetlist" value="planets.txt"/>
  • gasgiantlist
    • Type: FILENAME
    • Description: A list of possible textures for gas giants. If a " " follows the filename, then it will have atmosphere. If a " ^ " and another filename follows the first filename then the next texture will be used for lights.
    • Example: < var name="gasgiantlist" value="gas_giants.txt"/>
  • planetlist
    • Type: FILENAME
    • Description: A list of possible textures for non-gas-giant planets with the same rules as above.
    • Example: < var name="planetlist" value="planets.aera.txt"/>
  • moonlist
    • Type: FILENAME
    • Description: A list of possible textures for moons with the same rules as above.
    • Example: < var name="moonlist" value="moons.txt"/>
  • ringlist
    • Type: FILENAME
    • Description: A list of textures of planetary rings.
    • Example:
  • asteroidlist
    • Type: FILENAME
    • Description: A list of distances and units with the same format as unitlist.
    • Example:
  • nebulalist
  • Type: FILENAME
  • Description: A list of distances and units with the same format as unitlist.
  • Example: < var name="asteroidlist" value="asteroids.txt"/>
  • data
    • Type: INT
    • Description: The random number seed that is used to generate the system. This number ensures that the same system is generated each time.
    • Example: < var name="data" value="1039"/>
  • compactness
    • Type: FLOAT
    • Description: The scale of the star system.
    • Example:< var name="compactness" value="5.8"/>
  • faction
    • Type: FACTION NAME
    • Description: The name of the faction that owns the system.
    • Example:< var name="faction" value="aera"/>
  • backgroundlist
    • Type: FILENAME
    • Description: A list of background spheremaps/cubemaps without the extension (.png, .jpg, etc... ).
    • Example:
  • force
    • Type: BOOL
    • Description: If this is not true, then the system will clamp to the corresponding value of the unknown_sector/minlimit or maxlimit "system__ FIXME What's meant here exactly ??
    • Example:
  • num_starbases
    • Type: INT
    • Description: how many bases there will be (may be changed around with dynamic universe)
  • unitlist
    • Type: FILENAME
    • Description: A list of distances and units with the following format:
    • Example:< var name="unitlist" value="smallunits.txt"/>
    • Contents of smallunits.txt
      • Example: "U800^MiningBase U800^MiningBase A8480^AFieldBaseSparse&U400^MiningBase"
      • Format: "U"|"E"|"B"|"A"|"N"|"gas"|"jump"|"planet" distance-from-orbiting-planet "^" unit-name
      • Description of the Format
        • U = Unit
        • N = Nebula
        • B = Building
        • E = Enhancement
        • A = Asteroid.
      • You can have another object at the same coordinates by putting a "&" and another of these unit-distance pairs with no white space in between.
  • num_jump
    • Type: INT
    • Description: The number of jump points to other systems there are.
    • Example:
  • jumps
    • Type: STRING
    • Description: List of systems that this system jump points connect to.
    • Example: < var name="jumps" value="enigma_sector/harrison enigma_sector/repleetah"/>

Building a System

To create a system, follow these steps;

  • Always put the <system> tags first. Within the <system> tag use the name tag to specify the system name.
  • Using the planets variable define the possible types of planets.
  • Add the data value to specify the random seed value. From this value the same system will be created each time.
  • Using the Faction variable, specify who initially owns the system.
  • Define the number of planets using the num_planets variable. You can also define extra units, have a nebula or an asteroid field if you want.
  • Specify the size of the sun using the sun_radius variable.
  • Define the position of the system in the galaxy using the xyz variable.
  • Specify the Jump destinations using the jumps variable.
  • Finally, close with the </system> tag.

Examples

These examples are excerpts from universe/milky_way.xml


Crucible/Cephid_17

<galaxy>
  ...
  <systems>
  ...
    <sector name="Crucible">
    ...
      <system name="Cephid_17">
        <var name="planets" value="mol *r v a bs gd bd *r gg gg fr"/>
	<var name="data" value="-932898433"/>
	<var name="faction" value="klkk"/>
	<var name="luminosity" value="0"/>
	<var name="num_gas_giants" value="0"/>
	<var name="num_moons" value="2"/>
	<var name="num_natural_phenomena" value="2"/>
	<var name="num_planets" value="3"/>
	<var name="planetlist" value=""/>
	<var name="sun_radius" value="16600.000000"/>
	<var name="xyz" value="389.551310 -309.661278 348.064561"/>
	<var name="jumps" value="Crucible/17-ar Crucible/Stirling 
             Crucible/Cardell Crucible/Enyo Crucible/Everett Crucible/Oldziey"/>
      </system>
    ...
    </sector>
  ...
  </systems>
</galaxy>

Planet Type Definitions

<galaxy>
  <planets>
  ...
    <planet name="Arid">
       <var name="texture" value="planets/desert"/>
       <var name="initial" value="a"/>    
    </planet>
    <planet name="Arid_Methane">
       <var name="texture" value="planets/frigid_mud"/>
       <var name="initial" value="am"/>     
    </planet>
    <planet name="Bio_Diverse">
       <var name="texture" value="planets/m_class"/>
       <var name="texture_max" value="4"/>
       <var name="initial" value="bd"/>
       <var name="atmosphere" value="true"/>
    </planet>
 ...
    <planet name="Tropical">
       <var name="texture" value="planets/carribean"/>
       <var name="texture_max" value="3"/>
       <var name="initial" value="t"/>
       <var name="atmosphere" value="true"/>
    </planet>
    <planet name="Oceanic">
       <var name="texture" value="planets/ocean"/>
       <var name="initial" value="o"/>
       <var name="atmosphere" value="true"/>
    </planet>
  ...
  </planets>
</galaxy>

associating the milky_way.xml planet definitions with the units.csv file

this is done by taking the var:texture from the milky_way.xml , e.g.

 <planet name="Ice">
 <var name="texture" value="planets/Snow"/>

take the part after the last / , so in this case "Snow", and append "__planets", getting Snow__planets you can find that in the first column of the units.csv file.

for the lazy, here are the associations as of 18.08.2010 :

NAME TEXTURE INITIAL ID for units.csv HUD IMAGE units.csv
Trantor_Class planets/Dirt i Dirt__planets planet-dirt-hud.sprite
Human_Homeworld:Earth sol/earth earth earth__planets planet-earth-hud.sprite
Mars sol/mars mars mars__planets planet-mars-hud.sprite
Luna sol/moon moon moon__planets planet-moon-hud.sprite
Arid planets/desert a desert__planets planet-desert-hud.sprite
Arid_Methane planets/frigid_mud am frigid_mud__planets planet-aridmethane-hud.sprite
Bio_Diverse planets/m_class bd m_class__planets planet-biodiverse-hud.sprite
University planets/university u university__planets planet-university-hud.sprite
Ice planets/Snow fr Snow__planets planet-snow-hud.sprite
Tropical planets/carribean t carribean__planets planet-carribean-hud.sprite
Oceanic planets/ocean o ocean__planets planet-ocean-hud.sprite
Oceanic_Ammonia planets/ocean_ammonia oa ocean_ammonia__planets planet-oceanicammonia-hud.sprite
Aera_Trantor planets/n_class ai n_class__planets planet-aeratrantor-hud.sprite
Rlaan_Trantor planets/tkirsa at tkirsa__planets planet-rlaantrantor-hud.sprite
Aera_Ice planets/j_class afr j_class__planets planet-jclass-hud.sprite
Bio_Simple planets/k_class bs k_class__planets planet-biosimple-hud.sprite
Frozen_Ammonia planets/tundra fa tundra__planets planet-frozenammonia-hud.sprite
Volcanic planets/Lava v Lava__planets planet-lava-hud.sprite
Bio_Diverse_Methane planets/red_rocky bdm red_rocky__planets planet-biodiversemethane-hud.sprite
Bio_Simple_Methane planets/toxic_disaster bsm toxic_disaster__planets planet-biosimplemethane-hud.sprite
Rocky planets/rock r rock__planets planet-rocky-hud.sprite
Molten planets/molten mol molten__planets planet-molten-hud.sprite
Overgrown planets/forest f forest__planets planet-overgrown-hud.sprite
Overgrown_Methane planets/forest_methane fm forest_methane__planets planet-overgrownmethane-hud.sprite
Uninhabitable_Gas_Giant planets/gas_giant gg gas_giant__planets planet-gasgiant-hud.sprite
Uninhabitable_Medium_Gas_Giant planets/gas_medium gm gas_medium__planets planet-gasgiantmedium-hud.sprite
Uninhabitable_Dwarf_Gas_Giant planets/gas_midget gd gas_midget__planets planet-gasgiantdwarf-hud.sprite

See also