At first glance it looks daunting to try to create your own galaxy (after all it's 62000 lines in length)
but once you understand it's actually quite easy. This document is meant to supplement Egosoft's
modding tutorial, as I know alot of you may understand the concept, but the numbers are difficult.
Understanding:
This excerpt shows parts of the sector Kingdoms End
Code: Select all
<universe xmlns="XUNIVERS.xsd" id="2">
<o id="0" t="1" x="0" y="0" r="2" color="2313738" fc="0" fn="0" ff="0">
<o t="2" s="0"/>
<o id="0" t="18" x="0" y="0" z="-10080000" s="1" r="2" gid="1" gx="0" gy="1" gtid="0" a="32768" b="0" g="0"/>
<o id="0" t="18" x="10080000" y="0" z="0" s="3" r="2" gid="3" gx="1" gy="0" gtid="2" a="49152" b="0" g="0"/>
<o t="3" s="5" x="178145224" y="25597057" z="122769889" color="8570965"/>
<o t="4" x="160609000" y="263775829" z="-297674095" s="5" r="2"/>
<o id="0" t="17" x="2483880" y="346920" z="-2745120" s="2" atype="0" aamount="2" a="20503" b="10643" g="61392"/>
<o id="0" t="21" x="7992000" y="1554000" z="3774000" s="112" a="0" b="0" g="0"/>
<o id="0" t="6" x="835800" y="-351120" z="3971520" s="42" r="2" a="32768" b="0" g="0">
<o t="23" s="6">
<o t="11" s="0"/>
<o t="15" s="0"/>
<o t="14" s="4"/>
</o>
<o t="23" s="7">
<o t="9" s="0"/>
</o>
<o t="23" s="8">
<o t="16" s="2"/>
</o>
<o t="23" s="5">
<o id="0" t="7" s="35" r="2">
</o>
</o>
</o>
<o id="0" t="7" x="2280600" y="-1377600" z="4182360" s="89" r="2">
</o>
</o>
Code: Select all
<o id="0" t="1" x="0" y="0" r="2" color="2313738" fc="0" fn="0" ff="0">
You may recall from scripting that when you get sector from index x=1 y=1 you get Kingdom End
That is not so here, in fact all sectors are x-1 y-1. You need to be aware of the numbering convention,
as it will change from script editor to galaxy editor to text file.
What does id="0" mean? I don't know, everything has it therefore I can't interperet it. However, after looking at some older maps I assume that this is some text flag similar to what is now n="****"
T="1" Type = sector
X and Y are coordinates explained above.
r = race, in this case Boron. The numbers do not proceed alphabetically, they follow the same order that is in the
script editor. Until you have memorized them, check the script editor, or look at a sector you already know.
c = background color, different from the sun color, in Red Green Blue format.
fc, fn, ff color of fog, near fog, far fog color is expressed in rgb format and near/far is in units - submitted by Storm_Front
All variables always mean the same thing, ie s=subtype, even if we are talking about sectors or ship,kryptyk wrote:Well in the XML file I figured out the color number. This works for sun color and sector color.
All Blue = 255 (R=0 G=0 B=255)
All Green = 65280 (R=0 G=255 B=0)
All Red = 16711680 (R=255 G=0 B=0)
White = 16777215 (R=255 G=255 B=255)
I tried to find out how the game was getting the numbers so I did a little calculating and found that 255(all blue) + 65280(all green) + 16711680(all red) = 16777215(all white)
Apparently just using all green and no blue gives the blue value a 256 instead of zero which means 255(all green) * 256(no blue) = 65280
so usually I won't repeat them,. I will however explain the number of the subtype if necessary.
From the sector line down, everything has been indented 1 tab, that means everything below belongs to this sector.
Code: Select all
<o t="2" s="0"/>
Otherwise, reuse a number and it'll be fine. If you want a funny sector try number 115, it stops at 114.
Code: Select all
<o id="0" t="18" x="0" y="0" z="-10080000" s="1" r="2" gid="1" gx="0" gy="1" gtid="0" a="32768" b="0" g="0"/>
<o id="0" t="18" x="10080000" y="0" z="0" s="3" r="2" gid="3" gx="1" gy="0" gtid="2" a="49152" b="0" g="0"/>
other things that tell you it's south.
s=subtype, which is 1, mean it is south, it's 0,1,2,3 for North,South,West,East respectively.
X Y and Z are the coordinates, in most sectors it will be approx 10080000, as that is 45.4 km *222
All coordinates are expressed in "units" 222 units make 1 meter. Thus 1km = 222000
gid= grid ID this is the same as subtype, it will be used to let other gates know what to connect to.
gx and gy = sector to which this gate connects to. x1y0 is of course Rolt's Drift.
gtid= grid target ID this is the gate, in the target sector, to connect to. Thus gtid references gid in sector gx gy.
If you want the East gate in KE to connect to West in RD, you would have the bottom line, if you want East KE to connect to
South RD you would change the GtargetID to number 1, or south and keep the rest.
a, b,g = This is which way the gate faces. Mostly you will only need 4 numbers, 0, 16384, 32768, and 49152 for gates
Code: Select all
<o t="3" s="5" x="178145224" y="25597057" z="122769889" color="8570965"/>
<o t="4" x="160609000" y="263775829" z="-297674095" s="5" r="2"/>
color = red green blue
I usually just find a random sector and copy that sector's planet(s) and sun(s) when creating a new sector
because it's hard to convert 8570965 into a red green blue format for me, but subytpe is easily changed.
Code: Select all
<o id="0" t="17" x="2483880" y="346920" z="-2745120" s="2" atype="0" aamount="2" a="20503" b="10643" g="61392"/>
Aamount is the yield.
Code: Select all
<o id="0" t="21" x="7992000" y="1554000" z="3774000" s="112" a="0" b="0" g="0"/>
Code: Select all
<o id="0" t="6" x="835800" y="-351120" z="3971520" s="42" r="2" a="32768" b="0" g="0">
are indented an extra 1 or 2 lines. Those indentations means those lines belong to the station.
Code: Select all
<o t="23" s="6">
Code: Select all
<o t="11" s="0"/>
<o t="15" s="0"/>
<o t="14" s="4"/>
</o>
You may recall that ware main11 sub0 is energy, well, at least I recall!
and </o> closes the indentation so that the next lines are also in the station, but not interpreted as resources.
14 4 is ore and 15 0 is bofu I think
Code: Select all
<o t="23" s="7">
<o t="9" s="0"/>
</o>
Code: Select all
<o t="23" s="8">
<o t="16" s="2"/>
</o>
Code: Select all
<o t="23" s="5">
<o id="0" t="7" s="35" r="2">
</o>
</o>
</o>
t7=ship, subtype=Boron Octopus
Notice that there is no x y z position, that's because it's docked. So t23 s5 = docked ships.
Notice that there are 3 </o>s the first closed the ship, nothing extra was installed. The second
closed the docked ships, there are no more docked ships at this station. The last closed the station,
there is nothing more to the station.
Code: Select all
<o id="0" t="7" x="2280600" y="-1377600" z="4182360" s="89" r="2">
</o>
The game will install default items on its own upon loading. Do not add items unless you need them extra.
Code: Select all
</o>
<o id="0" t="1" x="1" y="0" r="2" color="10183690" fc="0" fn="0" ff="0">
If this is the last sector you would also close the universe with
Code: Select all
</universe>
you can make hundreds of sectors now if you so wished.
Creating neat stuff:
OK so you have the basics for a simple sector. But you want text!
In file 440001.xml there's a ton of text you can use.
For instance, want to make ship debris? NP First create your ship like normal.
Then, make the ship race 14, so it won't go anywhere. Next, right after race, add the text n="5561"
This will reference T ID 5561 in 440001, which happens to be ship debris.
Station debris? 5571 Debris? 5551
Broken Gate is different, do not add a n="****" instead, change the subtype to 4, and make sure it leads nowhere
like make the gtarget ID gx="-1" gy="-1"
You can make custom text. Let's say you want a personalized ship to be named "Suzy's Ship"
Find a blank spot in 440001.xml that has 2 spots back to back. Here is where you need new files.
You cannot edit 440001 yourself, but you can make a second file and call it 449999 or whatever.
*edit* you might be able to edit the 440001. I had trouble with this and it may have been user error. However, it would still be a good idea to create your own file since uploading/hosting/downloading a whole 440001 would be alot more work.
Before we get to that, lets go over how we are to integrate 449999 into the game once we have put text
into it because it's the simple part. Go into your in game script editor and create a new script. You want
it to load automatically so call it "init.your_script_here" Add a new line, go to general commands,
and press page down twice. About in the middle of the page is a line called load text: id=<var/number>
Select this, and as id enter number **** where **** is your 44**** that isn't used yet. Save and exit.
Next put text into the 449999 file, but you can't put it anywhere. Notice that file 440001 is formatted
in a special way, it's got pages and IDs etc.
If we want a ship named "Suzy's ship" and a description of that ship as "This is Suzy's ship" we would
do the following:
Code: Select all
<language id="44">
<page id="17" title="Boardcomp. objects" descr="Quad line groups for ware factory pairs or twins (spoken by Boardcomputer)">
<t id="3333">Suzy's ship</t>
<t id="3334">This is Suzy's Ship.</t>
</page>
</language>
instead of entering n="5561" on your ship, now you would enter n="3333" Do not enter 3334 as this is the description you see by default when you look at ship info.
You can do this for ships, stations, wares, anything
OK, now you want to name your sector and add a description to it
Code: Select all
<language id="44">
<page id="7" title="Boardcomp. Sectornames" descr="Names of all sectors (spoken by Boardcomputer)">
<t id="1021505">My sector name</t>
</page>
<page id="19" title="Sectordescription" descr="Long descriptions of all sectors">
<t id="1031505">My sector description</t>
</page>
</language>
Instead, it is your sector coordinates. But wait, I don't have a sector there! For example, Rolk's Drift
x1y0 in the x2_universe.xml would become 1020102. The x and y are switched, to YX and 1 is added to each number.
If you get your sector number from the in game galaxy map you do not need to add 1 to each,
since RD in game is x2 y1 already
OK, that's it for the text. Now you want more features for your Carrier
Code: Select all
<o id="0" t="7" x="2212560" y="739200" z="-5658240" s="31" r="2">
<o t="23" s="4">
<o t="16" s="19" n="1"/>
</o>
<o t="23" s="5">
<o id="0" t="7" s="35" r="2">
</o>
</o>
<o t="23" s="9">
<o id="0" t="7" x="1680" y="-1034040" z="0" s="35" r="2">
</o>
</o>
</o>
The main16 sub19 installs N docking computers
*NEW EDITED*
I want to create an asteroid field, but making 50 asteroids is alot of work. Solution?
Code: Select all
<o id="0" t="20" x="0" y="0" z="0" s="20" a="0" b="0" g="0"/>
*NEW EDITED*
I'm making a racetrack, making gates are a bit big so I'd like to use Kessler rings. Solution?
Code: Select all
<o id="0" t="20" x="0" y="0" z="0" s="0" a="0" b="0" g="0"/>
If this doesn't work, try scripting in a special object-type number 0, in conjuction with Reven's X² Math library - fixed point decimal & trig functions
Debugging and tips:
My game crashes when I try to start my custom map.
Uh oh
My game hangs but doesn't crash when I try to start my custom map
It sounds like a script error instead of a map error, are you sure the map was the only thing you changed?
Come on help me, I wrote 10000 lines of text and it crashes when I try to start my custom map.
OK if it crashes there's an error someplace in your text. One time I made the following mistake:
Code: Select all
<o id="0" t="7" x="-2436450" y="923964" z="-280386" s="28" r="4" n="5561>
So the moral is save often, make a backup before changing really big stuff, and alt tab to your game and try out your
map with the in game galaxy editor. You can alt tab back out and edit your text, even save your text while still playing the game,
but to load the new text after a save you must exit to the start menu and restart galaxy editor.
PS the error was n="5561> it should have been n="5561">
I can't think of any other reasons why it would crash on start up except for typing errors. If you have a syntax error
such as:
Code: Select all
<o id="0" t="6" x="835800" y="-351120" z="3971520" s="42" r="2" a="32768" b="0" g="0">
<o t="23" s="7">
</o>
<o t="9" s="0"/>
</o>
Code: Select all
<o id="0" t="7" s="90" r="2">
</o>
</o>
<o id="0" t="7" s="30" r="2">
My custom map will start, but as soon as I open up the galaxy map it crashes.
Sounds like you forgot
Code: Select all
<o t="2" s="0"/>
at the end of the script, so that the universe is closed too.
My custom map starts, galaxy map opens up, but my sector isn't there
If you go to your sector using arrow keys and it seems to "freeze" at one part of the map, that's your sector
I can't help you there, there is no graphic for your sector in your universe, you need to edit it with 3dmax
If you go to your sector, and it skips over it like it wasn't there at all then that's a problem, most likely
you didn't close the tag.
Everything works except the gates, they don't work or they make you backwards
Make sure your IDs are ok, then make sure your alpha is ok. Make sure the other sector has the
exit gate too.
I created sectors and ships with custom text, but when I start the game it says ReadText **** or doesn't show at all.
OK first, if it does not show at all, then there is a syntax error in your galaxy map, or you forgot the n="****" for ships and stations. For sectors, then you may have used the wrong id# for your text, remember that x and y are switched and add 1.
If it shows ReadText **** then you may have a syntax error in your text file, or you may have forgotten to include your init script that loads the text file.
*NEW*
I have a map with a whole bunch of sectors, but some don't show.
The limit to your map size is 20x, 15y. Remember since numbers start at 0 you have the numbers 0-19 for x and 0-14 for y. A grand total of 300 sectors :/