Galaxy Editor And Maps

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

PaperDog
Posts: 154
Joined: Tue, 2. Dec 08, 04:02

Galaxy Editor And Maps

Post by PaperDog » Wed, 10. Dec 08, 00:16

Galaxy Editor: I got a decent handle on placing/ moving objects around and setting their properties, but I'll be danged if I can figure out how to save the new maps I created. (That would be hours out of my busy life , which I'll never get back...) :evil:

I searched this forum with a fine tooth comb and can't find any reference.

Can ya help ?

Thanks
PaperDog

X420TokeAlot
Posts: 52
Joined: Sun, 10. Dec 06, 03:56

saving map in galaxy editor

Post by X420TokeAlot » Wed, 10. Dec 08, 07:28

Hey there PaperDog....

To save your custom map...
open the galaxy editor
Then open the galaxy edit mode(shift enter)

at the top of the menu there is a setting called Set galaxy file name..
change the name to your own map name....
then export galaxy
and your map will be saved in the maps directory in TC.

hope this helps a bit

cheers

User avatar
Chealec
Posts: 1916
Joined: Sun, 20. Aug 06, 10:54
x3tc

Deconstruction x3_universe.xml

Post by Chealec » Wed, 10. Dec 08, 23:05

I've started deconstructing the x3_universe.xml file so that, should I fancy it I can rip out all the asteroid data or plonk in new sectors for a mod. I had a hard time finding a thread about this - so I figured I'd make one.

-- edit --

I've now compiled everything into a PDF - see:
this post on the next page

-- end edit --

It'll probably be in several posts since Heroes is about to start on Beeb3 so I'm out of here at that point in time ;)

To begin with - everything in the xml file is an "Object", I'm guessing that's what they had in mind when they named the xml Element "<o>".

What determines the type of object is the 't' attribute, for instance t="1" is a sector and t="17" is an asteroid.

For this first bit, I'll just deconstruct a "Sector object"...

--------------------------------------------------------------------------
Note: the "base" scale for all measurements seems to be 2 millimetres!
Therefore - size="22500000" in kilometres is 22500000/500000 = 45

First we have the "object" - which seems to be denoted by the xml <o> Element
The attributes of the <o> Element vary depending on it's type, the "t" attribute

So initial deconstruction seems to imply that

<o id="29" t="1" ... ></o>

is a sector (type 1) with an id of 29

Let's look at Argon Prime...

<o id="49" f="4" t="1" x="1" y="3" r="1" size="22500000" m="8100" p="189451753" qtrade="100" qfight="100" qbuild="100" qthink="100">


This is an deconstruction of the Argon Prime Object Element

id = "49" - this is the object's unique id

f="4" - seems to denote a "core" sector

x="1" - is the 'x' index of the sector - this is based on a zero index so 1 is actually the second row or sectors from the left

y="3" - is the 'y' index of the sector - again this is based on a zero index, but y is "down" rather than up - sector 0, 0 for instance is "Kingdoms End"

r="1" - is the 'race' - see below:

size="22500000" - this is to do with the gate distance on the map, it seems to be a measure of radius... the gate distance is, however a diametre so you need to multiply by 2. This gives you 2*(22500000/500000) = 90km BINGO! However, when displayed this is always rounded to the nearest 5km.

m="8100" - this is the music track - Argon prime is 08100.mp3 - 0 seems to be some kind of default - maybe loaded from a director file or the game binary?

p="189451753" - this is the population, a figure of -1 seems to be some kind of default - maybe loaded from a director file or the game binary? A figure of -2 will display "unknown" (used in "unknown sectors")

qtrade="100" - I would guess this denotes the frequency of "trade" missions (or Quests to explain the 'q')

qfight="100" - ditto for "fight" quests

qbuild="100" - ditto for "build" quests

qthink="100" - ditto for "think" quests


Races, as far as I can figure it:
1 => argon
2 => boron
3 => split
4 => paranid
5 => teladi
6 => xenon
7 => kha'ak
8 => pirates
9 => goner
10 => n/a
11 => n/a
12 => unclaimed (ship)
13 => n/a
14 => unknown (sector|beacon)
15 => n/a
16 => n/a
17 => Terran (ATF)
18 => Terran (USC)
19 => Yaki
20 => n/a
...

n/a may be reserved - possibly used for corporations - but these values, such as r="10" don't actually appear anywhere in the x3_universe.xml file at the moment
Last edited by Chealec on Tue, 16. Dec 08, 20:44, edited 1 time in total.
[ external image ]

... old skool

exogenesis
Posts: 2718
Joined: Sun, 9. Sep 07, 15:39
x4

Post by exogenesis » Thu, 11. Dec 08, 00:09

Some race ID's are uniquely associated with some ships, rather than sectors/installations

10 is 'UFO', seemingly used for meaning 'Player' sometimes,
11 is 'TerraCorp' (X3:R, not still in TC?)
12 is Yaki (but meaning X3:R 'Plot Yaki')
14 is used for an actual UFO ship variant in TC ('LifeForm')


Be interested if you come across the sector's 'Sun % intensity'

User avatar
Chealec
Posts: 1916
Joined: Sun, 20. Aug 06, 10:54
x3tc

Post by Chealec » Thu, 11. Dec 08, 00:31

I think some things have changed in TC - since there are several corporations now and each corporation is associated with a race...

For instance the Terracorp HQ is now:
<o id="6054" t="5" s="SS_DOCK_CORP_1" x="1250000" y="2031250" z="625000" r="1" a="32768" b="0" g="0"></o>

This implies that whilst the station belongs to CORP_1 (Terracorp) the race that it's associated with is the Argon (r="1").

Maybe the n/a values in the "gaps" would be more properly described as deprecated rather than reserved.

... I've not worked out what the a, b and g attributes stand for yet though - there's a possibility that they're texture effects - since the "signs" (SS_SPECIAL_SIGNn) seem to also have a v attribute. I'm thinking these might be something like:

Alpha, Brightness, Gamma and Video - but I'm only guessing at the moment.

[EDIT]
I _think_ I might be on to something with the suns...

It looks as though t="3" is the sun...
<o t="3" s="3" ... color="14483420"/> <!-- kingdom end -->

Now, IF there is a value with 's' (no matter what it is) that sector will have a 'suns' value of 150%. However, if s="0" then the sector will have a suns value of 100%.

The one exception (I've found so far) being Akeela's Beacon which actually has 4 "sun" type objects:

<!-- akeela's beacon -->
<o t="3" s="0" ... color="2631720"/>
<o t="3" s="0" ... color="0"/>
<o t="3" s="0" ... color="10850715"/>
<o t="3" s="0" ... color="11837610"/>

Each of those sun objects has an s value of 0 which means, in theory, the sector _should_ have 4 suns each with a value of 100, giving a total value of 400... which is right, that's what Akeela's Beacon has.

I've not tried it yet, but I'm guessing that if I fly through Akeela's Beacon I should see 3 solar effects - the 4th being invisible (or black) since it has a colour value of 0.

However, this is only a theory at this point in time, I've only checked it with a dozen sectors so far... I'll take a closer look tomorrow.
[ external image ]

... old skool

PaperDog
Posts: 154
Joined: Tue, 2. Dec 08, 04:02

Post by PaperDog » Thu, 11. Dec 08, 04:00

Actually I had figured that might be the case and had even tried it before posting my question. To my dismay, I now discovered that the Maps directory was missing (I got the SW from Steam) . So when I had attempted the export map feature, I got a normal audio bleep but didn't realize it hadn't saved the file.
I'll just create the map subdirectory on the TC directory and then retry.

Much thanks.
:)
PaperDog

User avatar
DeadlyDa
Posts: 1882
Joined: Mon, 5. Jan 04, 04:46
x4

Post by DeadlyDa » Thu, 11. Dec 08, 04:26

There are three ways you can re-size sectors:

1. You can use a text editor and the info in Chealec's post ( http://forum.egosoft.com/viewtopic.php?t=227624 )
2. You can use doubleshadow's X3 Editor to move the gates waaaay out
3. You can use the internal X3 Galaxy Editor as per X420TokeAlot's post

Finally, if you're feeling a bit crazy...there was a program developed during the X2 era that was specifically designed to expand sectors by a set amount. I used to use it as the first step in creating an expanded universe for my old X2 mods (SSG). Once I had expanded things, I'd go back with an editor to tweak & tune each sector.

I still have the program, and just ran a test. I took the current x3_universe.xml file and renamed it to x2_universe, fired up the program and told it to expand things by a factor of 2...and it still works! For example, in Argon Prime the gates were twice as far from the center of the sector as before, and the stations were shifted outward as well.

However it is not a mature & stable tool, it knows nothing of the new X3R and X3TC objects (assuming it cares, and doesn't simply move "objects")...and as a modder I would never use the output as a "final" product.

Finally, while I have the program, I don't feel comfortable sharing it with others. I don't remember who the author was, and do not have their permission to distribute it. However the thread(s) may very well still exist over in the X2 forums (along with a fair bit of info on the composition of the universe file).

Hope this helps...

User avatar
DeadlyDa
Posts: 1882
Joined: Mon, 5. Jan 04, 04:46
x4

Post by DeadlyDa » Thu, 11. Dec 08, 04:33

This was a "hot topic" during the early days of X2 modding, and there is still a fair bit of useful information floating around over there. You might try using "extra search" on the X2 scripting & modding forums.

There was (is) a program developed during the X2 era that was specifically designed to expand sectors and their contents by a set amount. I used it as the first step in creating an expanded universe for my old X2 mods (SSG). Once I had expanded things, I went back in with an editor and tweaked each sector.

I still have the program, and just ran a test. I took the current x3_universe.xml file and renamed it to x2_universe, fired up the program and told it to expand things by a factor of 2...and it still works! For example, in Argon Prime the gates were twice as far from the center of the sector as before, and the stations were shifted outward as well.

However it is not a mature & stable tool, it knows nothing of the new X3R and X3TC objects (assuming it cares, and doesn't simply move "objects")...and as a modder I would never use the output as a "final" product.

Still...if you are going to go through the trouble of digging out the secrets of the x3_universe.xml file, it might be fun to create an updated version of this tool.

jlehtone
Posts: 21808
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone » Thu, 11. Dec 08, 07:46

I hope you do not mind a bit of merging (since both threads were on the same "map"). And as added salt to the wound, the Tutorials sticky is pointing to Chealec's comment (even though he is not the only contributor here). :wink:

exogenesis
Posts: 2718
Joined: Sun, 9. Sep 07, 15:39
x4

Post by exogenesis » Thu, 11. Dec 08, 09:34

Chealec wrote:It looks as though t="3" is the sun...
<o t="3" s="3" ... color="14483420"/> <!-- kingdom end -->

Now, IF there is a value with 's' (no matter what it is) that sector will have a 'suns' value of 150%. However, if s="0" then the sector will have a suns value of 100%.

The one exception (I've found so far) being Akeela's Beacon which actually has 4 "sun" type objects:

<!-- akeela's beacon -->
<o t="3" s="0" ... color="2631720"/>
<o t="3" s="0" ... color="0"/>
<o t="3" s="0" ... color="10850715"/>
<o t="3" s="0" ... color="11837610"/>

Each of those sun objects has an s value of 0 which means, in theory, the sector _should_ have 4 suns each with a value of 100, giving a total value of 400... which is right, that's what Akeela's Beacon has.
Good observation & deductive reasoning, well done!

I wonder what an s value of >0 actually means for the t=3 sun item.

User avatar
Chealec
Posts: 1916
Joined: Sun, 20. Aug 06, 10:54
x3tc

Post by Chealec » Thu, 11. Dec 08, 13:23

's', generally speaking, seems to refer to a "sub-type" - so for instance with the Terracorp HQ I used as an example earlier:

't' = 5 is a shipyard if I remember rightly (I'm at work atm, on lunch so I've not got the xml file in front of me) and 's' refers to the specific type of shipyard - i.e. the Terracorp HQ.

With Suns I would guess that the 's' value refers to the kind of environmental effect employed by that sun. There's probably some kind of "sun type" array or database in the game somewhere that looks a bit like:

+--------------+----------------+-------------------+----
| type | effect | brightness | ...
+--------------+----------------+-------------------+----
| 1 | effect_x | 100 |
| 2 | effect_y | 150 |
| 3 | effect_z | 150 |

...

and so on
[ external image ]

... old skool

exogenesis
Posts: 2718
Joined: Sun, 9. Sep 07, 15:39
x4

Post by exogenesis » Thu, 11. Dec 08, 20:00

Yes, types\TSuns.txt has a list of different coloured suns, but all the rest of the params are the same.
I think your initial method for 'sun%' looks good.

User avatar
Chealec
Posts: 1916
Joined: Sun, 20. Aug 06, 10:54
x3tc

Post by Chealec » Thu, 11. Dec 08, 21:07

You're right - it looks as though the sun brightness % is in that file...

If you divide 98304 by 65536 (the only value that changes in column J) you'll see that the result is 1.5.

Therefore I'd assume that brightness 100% = 65536 and by tweaking the value (by multiples or parts thereof of 65536) you should be able to increase or decrease the sun intensity.

For example:
-1;0;0;0;0.001;-1;884;0;5;98304;0;0;0;0;0;-100000;0;0;SS_SUN_6;

If you change that to:
-1;0;0;0;0.001;-1;884;0;5;131072;0;0;0;0;0;-100000;0;0;SS_SUN_6;

That _should_ increase the intensity of all sun types s=6 (or SS_SUN_6) to 200% brightness.
[ external image ]

... old skool

User avatar
Chealec
Posts: 1916
Joined: Sun, 20. Aug 06, 10:54
x3tc

Post by Chealec » Thu, 11. Dec 08, 21:44

Oki - here's the blurb on decoding suns... I am writing this all up into an ODF document whilst I'm going, so when it's done I'll dump the whole thing out to a PDF.

------------------------------------------------
T3: Suns <o t=”3” ...>

Suns have 6 attributes; the x, y and z values are the three dimensional co-ordinates that denote the position of the sun. These figures are generally pretty enormous so that the sun (light source) is positioned outside the navigable area of the sector.

t is the “type” and is always 3

s is a sub-type which refers to the index in types\TSuns.pck

x is the 'x' position of the sun (light source)

y is the 'y' position of the sun

z is the 'z' position of the sun

color I would guess this is an RGB colour index of some sort.

There are 228 suns in total.

The “types\TSuns.pck” resides in 03.cat and is a comma separated values file (ok, technically semi-colon separated values file) so if you extract it and rename it to “TSuns.csv” you should be able to open it in Excel or OpenOffice Calc.
Last edited by Chealec on Sat, 13. Dec 08, 17:35, edited 1 time in total.
[ external image ]

... old skool

User avatar
Chealec
Posts: 1916
Joined: Sun, 20. Aug 06, 10:54
x3tc

Post by Chealec » Thu, 11. Dec 08, 22:12

Still...if you are going to go through the trouble of digging out the secrets of the x3_universe.xml file, it might be fun to create an updated version of this tool.
I might have a crack at knocking one up in Java since that's got pretty good XML support these days... and I could do with some kind of an excuse for polishing up on my Java skills (I'm a web developer by trade and it's been a really, really long time since I wrote anything that didn't output to (X)HTML) - I'd not hold your breath though, my Java skills are a bit basic (and very rusty) at the moment ;)

I still miss "proper" method overloading when I'm coding in PHP though.
[ external image ]

... old skool

exogenesis
Posts: 2718
Joined: Sun, 9. Sep 07, 15:39
x4

Post by exogenesis » Fri, 12. Dec 08, 00:30

Doing well...looks like doubleshadow's GalaxyEditor has the sun's brightness described as 'Volume' then....
the full list of files that 't=' & 's=' reference to is (afaik) :
http://forum.egosoft.com/viewtopic.php? ... 90#2648990

User avatar
Chealec
Posts: 1916
Joined: Sun, 20. Aug 06, 10:54
x3tc

Post by Chealec » Sat, 13. Dec 08, 17:32

T4: Planets <o t=”4” ...>

Planets again have type, sub-type and co-ordinate attributes, but they also have an fn attribute which I've not worked out yet.

f seems to denote a “special flag”; there are 17 planets where f=”1” but I'm not sure what that implies

t is the “type” and is always 4

s is a sub-type which refers to the index in types\TPlanets.pck

x is the 'x' position of the planet

y is the 'y' position of the planet

z is the 'z' position of the planet

color I would guess this is an RGB colour index which applies a hue to the planet

fn ? this is always 0

Note: the number of planets a sector displays on the galaxy map does not include planets that have an s attribute of 128. There is no 128 index in TPlanets so I guess these default to the planet type SS_PLDUMMY... this explains why Uranus has 0 planets.

As an aside, there are 510 planets in total
[ external image ]

... old skool

User avatar
Chealec
Posts: 1916
Joined: Sun, 20. Aug 06, 10:54
x3tc

The (almost) definitive guide to Universe hacking

Post by Chealec » Tue, 16. Dec 08, 19:28

While I was hacking the X3 Universe to bits I was making notes in an ODF file which I've now tidied up and converted to PDF.

This is an (almost) definitive guide to hacking the galaxy and covers every main-type I discovered along the way as well as their sub-types and other attributes and explains what they all do and what tools to use to hack them to bits.

Anyway - you can nab it here:
http://www.xenotaph.net/lib_pdf/galaxy_hacking_x3tc.pdf
[ external image ]

... old skool

User avatar
DeadlyDa
Posts: 1882
Joined: Mon, 5. Jan 04, 04:46
x4

Post by DeadlyDa » Tue, 16. Dec 08, 23:58

Wow...this is without a doubt the ultimate galaxy map reference!

I still find myself needing to use a text editor on custom maps, and this just found a place in my on-screen reference library :)

With your permission, I'd like to add it to the X-Wiki (link in my sig).

User avatar
Chealec
Posts: 1916
Joined: Sun, 20. Aug 06, 10:54
x3tc

Post by Chealec » Wed, 17. Dec 08, 03:24

With your permission, I'd like to add it to the X-Wiki (link in my sig).
heheh feel free - I didn't spend 4 (very late) evenings reverse engineering the Galaxy editor just to keep it to myself ;) If it makes anyone else's life easier it was worth it.

I can't 100% guarantee the accuracy of all of it though but I think it's pretty damned close - if you pick up any errors (or find out exactly what that 'f' attribute does in the different sub-types) let me know and I'll update it.
[ external image ]

... old skool

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”