Welcome, Guest

Author Topic: What's wrong with this coding?  (Read 6258 times)

atomic7732

  • Global Moderator
  • *****
  • Posts: 3849
  • caught in the river turning blue
    • Paladin of Storms
What's wrong with this coding?
« on: January 05, 2009, 04:42:51 PM »
Code: [Select]
<?xml version="1.0" standalone="yes"?>
<System>
  <Body>
<Object>
<ID>1</ID>
<Name>AESPS 7</Name>
<HorizonID>10</HorizonID>
<HorizonName>Sun (10)</HorizonName>
<Diameter>100594</Diameter>
<Type>Star</Type>
<Mass>.1 sun</Mass>
<Density>1.408</Density>
<Obliquity>7.25</Obliquity>
<RotationPeriod>3 days</RotationPeriod>
<AbsMag>14.83</AbsMag>
<ColorIndexBV>0.65</ColorIndexBV>
</Object>
<Object>
    <Name>Kipotrom</Name>
    <TextureDiffuse>mercury.dds</TextureDiffuse>
    <Type>Rock</Type>
    <ColorReal>a2a2a2</ColorReal>
    <ColorVivid>ab33bf</ColorVivid>
    <Mass>7.553 moon</Mass>
    <Density>2.892</Density>
    <Diameter>8034.293</Diameter>
    <PositionX>2610.78595293927</PositionX>
    <PositionY>-5062.79072459265</PositionY>
    <PositionZ>.0038344</PositionZ>
    <VelocityX>0.1886360760433921</VelocityX>
    <VelocityY>0.27862490855394</VelocityY>
    <VelocityZ>-0.08653981246352</VelocityZ>
    <Settings>gravity=1</Settings>
</Object>
<Object>
<ID>3767</ID>
<Name>2004 PC112</Name>
<Type>TransNep</Type>
<Notes>Last in List</Notes>
</Object>
  </Body>
</System>

atomic7732

  • Global Moderator
  • *****
  • Posts: 3849
  • caught in the river turning blue
    • Paladin of Storms
Re: What's wrong with this coding?
« Reply #1 on: January 06, 2009, 03:57:05 PM »
 >:( ANOTHER!

Code: [Select]
<?xml version="1.0" standalone="yes"?>
<System>
  <Body>
    <Name>AESPS 10</Name>
    <Object>Sun</Object>
    <Appearance>Sun</Appearance>
    <Mass>814000674443.002</Mass>
    <Density>0.74054912138661</Density>
    <Diameter>5943251.25124358</Diameter>
    <PositionX>-4973626.6823057</PositionX>
    <PositionY>2929504.69448439</PositionY>
    <PositionZ>-1027177.00111291</PositionZ>
    <VelocityX>0.0178057934016095</VelocityX>
    <VelocityY>0.023572269825459</VelocityY>
    <VelocityZ>0.00365819578425236</VelocityZ>
    <Settings>gravity=1</Settings>
  </Body>
  <Body>
    <Name>b</Name>
    <Object>Jupiter</Object>
    <Appearance>Jupiter</Appearance>
    <Mass>18986000</Mass>
    <Density>1.32650326843687</Density>
    <Diameter>139822</Diameter>
    <PositionX>77677029.6144243</PositionX>
    <PositionY>139893014.663998</PositionY>
    <PositionZ>21636234.21372</PositionZ>
    <VelocityX>-156.156189411216</VelocityX>
    <VelocityY>100.010313203133</VelocityY>
    <VelocityZ>-13.41663457139882</VelocityZ>
    <Settings>timestep=16.0 hours</Settings>
  </Body>
  <Body>
    <Name>e</Name>
    <Object>Mars</Object>
    <Appearance>Mars</Appearance>
    <Mass>50677.4137183068</Mass>
    <Density>1.84101954172011</Density>
    <Diameter>17388.1138083567</Diameter>
    <PositionX>-832453069.406863</PositionX>
    <PositionY>-456587448.230401</PositionY>
    <PositionZ>-159330278.917775</PositionZ>
    <VelocityX>35.9992120153768</VelocityX>
    <VelocityY>-64.7604669951208</VelocityY>
    <VelocityZ>2.18803899040028</VelocityZ>
    <Settings>collisionmode=0</Settings>
  </Body>
  <Body>
    <Name>d</Name>
    <Object>Neptune</Object>
    <Appearance>Neptune</Appearance>
    <Mass>3115802.12412807</Mass>
    <Density>1.63800000000001</Density>
    <Diameter>71354.1301898706</Diameter>
    <PositionX>508732057.608004</PositionX>
    <PositionY>-760662008.074991</PositionY>
    <PositionZ>56015772.3049099</PositionZ>
    <VelocityX>72.3352151307513</VelocityX>
    <VelocityY>20.1413704002191</VelocityY>
    <VelocityZ>13.2589125518569</VelocityZ>
    <Settings>date=0</Settings>
  </Body>
  <Body>
    <Name>c</Name>
    <Object>Saturn</Object>
    <Appearance>Saturn</Appearance>
    <Mass>2137567.4515412</Mass>
    <Density>0.687000000000002</Density>
    <Diameter>84072.6666663151</Diameter>
    <PositionX>-181987912.699035</PositionX>
    <PositionY>10358458134.3867</PositionY>
    <PositionZ>253252914.411699</PositionZ>
    <VelocityX>-19.5765841225612</VelocityX>
    <VelocityY>-7.80972646060461</VelocityY>
    <VelocityZ>-2.58295910338147</VelocityZ>
    <Settings>camera=dist:41.7 AU,h:96,v:-88</Settings>
  </Body>
  <Body>
    <Name>1P Kubinak</Name>
    <Object>Jupiter</Object>
    <Appearance>Jupiter</Appearance>
    <Mass>1.9778573064239E-07</Mass>
    <Density>10.9269940864926</Density>
    <Diameter>1.51204671343837</Diameter>
    <PositionX>2222653799.15951</PositionX>
    <PositionY>715440774.909725</PositionY>
    <PositionZ>676926024.707085</PositionZ>
    <VelocityX>-24.311306970465</VelocityX>
    <VelocityY>23.2214738619647</VelocityY>
    <VelocityZ>-8.16390042258626</VelocityZ>
    <Settings />
  </Body>
</System>

I edited the apperance to make it look like something else so I changed it back WHAT THE HECK IS WRONG????
Does it not like Apperance unless IT coded it???? >:( >:( >:( :( >:( :( >:( :( >:( :( :( :(

Dan Dixon

  • Creator of Universe Sandbox
  • Developer
  • *****
  • Posts: 3244
    • Personal Site
Re: What's wrong with this coding?
« Reply #2 on: January 08, 2009, 12:47:41 PM »
The problem with your first example is that you have each body wrapped in an object tag.

You are doing this:
Code: [Select]
<System>
  <Body>
    <Object>
      <Name>AESPS 7</Name>
    </Object>
  </Body>
</System>

And you need to do this:
Code: [Select]
<System>
  <Body>
    <Name>AESPS 7</Name>
    <Object>Earth</Object>
  </Body>
</System>

Or even this (if you don't want to use the Object tag):
Code: [Select]
<System>
  <Body>
    <Name>AESPS 7</Name>
  </Body>
</System>


Although after this is fixed it generates an error. This is because the bodies are starting on top of one another. The 1st and 3rd bodies will default to 0,0,0 and the 2nd will fall within the diameter of the 1st. Positions values default to meters unless you specify otherwise.

Here's the info page on editing XML files:
http://universesandbox.com/support/newsystems.htm



Regarding your second example: It worked for me. What is the problem that you're having with it?

atomic7732

  • Global Moderator
  • *****
  • Posts: 3849
  • caught in the river turning blue
    • Paladin of Storms
Re: What's wrong with this coding?
« Reply #3 on: January 08, 2009, 04:36:08 PM »
It wont run. It's just space. The backround there but nothing else.

Dan Dixon

  • Creator of Universe Sandbox
  • Developer
  • *****
  • Posts: 3244
    • Personal Site
Re: What's wrong with this coding?
« Reply #4 on: January 08, 2009, 05:51:36 PM »
This is a working version of the code you posted:

Code: [Select]
<?xml version="1.0" standalone="yes"?>
<System>
  <Body>
<ID>1</ID>
<Name>AESPS 7</Name>
<HorizonID>10</HorizonID>
<HorizonName>Sun (10)</HorizonName>
<Diameter>100594</Diameter>
<Type>Star</Type>
<Mass>.1 sun</Mass>
<Density>1.408</Density>
<Obliquity>7.25</Obliquity>
<RotationPeriod>3 days</RotationPeriod>
<AbsMag>14.83</AbsMag>
<ColorIndexBV>0.65</ColorIndexBV>
  </Body>
  <Body>
    <Name>Kipotrom</Name>
    <TextureDiffuse>mercury.dds</TextureDiffuse>
    <Type>Rock</Type>
    <ColorReal>a2a2a2</ColorReal>
    <ColorVivid>ab33bf</ColorVivid>
    <Mass>7.553 moon</Mass>
    <Density>2.892</Density>
    <Diameter>8034.293</Diameter>
    <PositionX>.378595293927 au</PositionX>
    <PositionY>-5062.79072459265</PositionY>
    <PositionZ>.0038344</PositionZ>
    <VelocityX>0.1886360760433921</VelocityX>
    <VelocityY>0.27862490855394</VelocityY>
    <VelocityZ>-0.08653981246352</VelocityZ>
  </Body>

  <Body>
<ID>3767</ID>
<Name>2004 PC112</Name>
<Type>TransNep</Type>
<Notes>Last in List</Notes>
    <PositionX>.78595293927 au</PositionX>
  </Body>
</System>


This is a cleaned up version that removes extra tags that aren't used like <ID> and <Type>:

Code: [Select]
<?xml version="1.0" standalone="yes"?>
<System>
  <Body>
<Name>AESPS 7</Name>
<Diameter>100594</Diameter>
<Mass>.1 sun</Mass>
<Density>1.408</Density>
<Obliquity>7.25</Obliquity>
<RotationPeriod>3 days</RotationPeriod>
<AbsMag>14.83</AbsMag>
<ColorIndexBV>0.65</ColorIndexBV>
<Settings>timestep=10 hours</Settings>
  </Body>
  <Body>
<Name>Kipotrom</Name>
<Appearance>Mercury</Appearance>
<Mass>7.553 moon</Mass>
<Density>2.892</Density>
<Diameter>8034.293</Diameter>
<PositionX>.5 au</PositionX>
<PositionY>0</PositionY>
<PositionZ>0</PositionZ>
<Action>orbit=AESPS 7</Action>
  </Body>
  <Body>
<Name>2004 PC112</Name>
<Object>2004 PC112</Object>
<Notes>Last in List</Notes>
<PositionX>3 au</PositionX>
<Action>orbit=AESPS 7</Action>
  </Body>
</System>

atomic7732

  • Global Moderator
  • *****
  • Posts: 3849
  • caught in the river turning blue
    • Paladin of Storms
Re: What's wrong with this coding?
« Reply #5 on: January 09, 2009, 04:35:42 PM »
Thanks!

atomic7732

  • Global Moderator
  • *****
  • Posts: 3849
  • caught in the river turning blue
    • Paladin of Storms
Re: What's wrong with this coding?
« Reply #6 on: January 09, 2009, 08:10:42 PM »
Oh I tried an only galaxy one. I wonder why it wont work...

Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<System xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Body>
<ID>0</ID>
<Name>Triangulum</Name>
<RA>01:33.9</RA>
<Dec>+30:39</Dec>
<Type>Galaxy</Type>
<Distance>2.735</Distance>
<Mag>5.7v</Mag>
<Diameter>55</Diameter>
<Mass>25000 M Sun</Mass>
<NameAlt>M33</NameAlt>
<RadialVel>+  3</RadialVel>
<SubType>Sc \ SA(s)cd II-III</SubType>
<Orient>.75</Orient>
<AngularDiameter>67.0 x 41.5</AngularDiameter>
<Link>http://seds.org/~spider/spider/LG/m033.html</Link>
<Group>Local Group</Group>
<NameAlt2>NGC 598</NameAlt2>
<Constellation>Tri</Constellation>
<AppMag>6.27</AppMag>
<DistanceMethod>2735±55</DistanceMethod>
<Axis>1654</Axis>
</Body>
</System>

Dan Dixon

  • Creator of Universe Sandbox
  • Developer
  • *****
  • Posts: 3244
    • Personal Site
Re: What's wrong with this coding?
« Reply #7 on: January 09, 2009, 08:27:19 PM »
You're using data out of the "Data for Reference" folder. This is the data that is referenced when you use the <Object> tag. Base new systems on the files in the "Included Systems" folder instead.

And at the moment you can't use RA & Dec in system files, but this will be corrected in a future update.

Here's a good example of how to work with galaxies.

Open up the system "Galaxy Collision - Parallel.xml":

Code: [Select]
<System>

<Body>
<Object>Andromeda</Object>
<Name>Galaxy</Name>
<Mass>1 mw</Mass>
<Diameter>1 mw</Diameter>
<Appearance>Color-Red</Appearance>
<PositionX>100000 ly</PositionX>
<PositionY>0</PositionY>
<PositionZ>0</PositionZ>
<VelocityX>-150</VelocityX>
<VelocityY>-25</VelocityY>
<VelocityZ>-50</VelocityZ>
<Action>rotate=0,20,0</Action>
<Settings>camera=dist:120000 light year,h:2,v:-18; labels=off</Settings>
</Body>
<Body>
<Object>Milky Way</Object>
<Appearance>Color-Blue</Appearance>
<PositionX>0</PositionX>
<PositionY>0</PositionY>
<PositionZ>0</PositionZ>
<VelocityX>150</VelocityX>
<VelocityY>60</VelocityY>
<VelocityZ>50</VelocityZ>
<Settings>timestep=30000 y;focus=center</Settings>
<Action>rotate=10,0,0;</Action>
</Body>

<Body>
<Object>Sun</Object>
<Name>Star</Name>
<Mass>0</Mass>
<PositionX>0</PositionX>
<PositionY>26000 ly</PositionY>
<PositionZ>0</PositionZ>
<VelocityX>0</VelocityX>
<VelocityY>0</VelocityY>
<VelocityZ>0</VelocityZ>
<Action>orbit=Milky Way</Action>
</Body>
</System>

It's often best to use the <Object> tag then just add the additional properties that you want to change and override, like <Name> or <Mass> or <PositionX>

1 mw = Mass of Milky Way
1 ly = Distance light travels in 1 year
« Last Edit: January 10, 2009, 12:44:54 PM by Dan Dixon »

atomic7732

  • Global Moderator
  • *****
  • Posts: 3849
  • caught in the river turning blue
    • Paladin of Storms
Re: What's wrong with this coding?
« Reply #8 on: January 10, 2009, 10:05:56 AM »
okay thanks.

Dan Dixon

  • Creator of Universe Sandbox
  • Developer
  • *****
  • Posts: 3244
    • Personal Site
Re: What's wrong with this coding?
« Reply #9 on: January 19, 2009, 07:09:43 PM »
No problem. I'm glad I could help.