[TUTORIAL] X Rebirth - Modding Guide

The place to discuss scripting and game modifications for X Rebirth.

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

TargetLost
Posts: 474
Joined: Wed, 23. Nov 05, 20:27
x3tc

Post by TargetLost » Sat, 16. Nov 13, 11:24

so let's write down from the .cat file format as we know it at the moment:

[FilePathAndName] [FileSize_in_bytes] [UnixTimeStamp] [MD5_Hash]


I have not checked the MD5_Hash'es so I can't tell

I have seen that the FilePathAndName has sometime spaces in it which complicated the extraction due to that space is also the separation char.

metallica787
Posts: 15
Joined: Sun, 23. Jul 06, 18:52
x4

Post by metallica787 » Sat, 16. Nov 13, 11:32

Space separation is not a problem. Just parse the last 3 spaces from right to left and use those as separators.

TargetLost
Posts: 474
Joined: Wed, 23. Nov 05, 20:27
x3tc

Post by TargetLost » Sat, 16. Nov 13, 11:33

did that too but it's ugly.

anyone successfull with texture modding?

I tried to place new texture files into self created folder:

\X Rebirth\assets\characters\argon\textures

but it doesnt takes them..it still uses the one in the .cat/.dat

in other games you can simple overwrite contents by creating the folders
and put custom made content there

User avatar
enenra
Posts: 7150
Joined: Fri, 8. Apr 05, 19:09
x4

Post by enenra » Sat, 16. Nov 13, 11:37

How about we put all the info about modding rebirth on a wikia from the beginning? We didn't do that with X3 nor X2 when they were launched and the info was all over the place. By collecting it in one place that would be prevented and more people would be motivated to mod themselves.

I've proposed this in the German forums as well and created a wikia for it: http://www.xworkshop.com .

We should also consider posting modding guides on the Steam Guides page where a lot people will see it that might not use the official forums at all.

TargetLost
Posts: 474
Joined: Wed, 23. Nov 05, 20:27
x3tc

Post by TargetLost » Sat, 16. Nov 13, 12:02

Can someone download and open that osr_universe.rar ?

It's always corrupt when I try open it with 7zip

it seems that it doesnt become downloaded correctly ..and ends witha random file length.

killerog
Posts: 3464
Joined: Fri, 28. Oct 05, 16:31
x4

Post by killerog » Sat, 16. Nov 13, 13:09

Ive had that zip downloaded and working a few weeks back, I have also had my own texture replace a station one as well as a new highway texture.

Place any changes you do in the extension folder as observe has said. That's where his changes and mine are placed and both worked.
Image

TargetLost
Posts: 474
Joined: Wed, 23. Nov 05, 20:27
x3tc

Post by TargetLost » Sat, 16. Nov 13, 13:11

So I am stuck. If anyone has an idea let me know:

I just want to exchange Yisha texture for a start..

according to that template osr_universe.rar and the OP post I created:

\X Rebirth\extensions\TLTextureMod
file content.xml (with the description of this mod/expansion)

\X Rebirth\extensions\TLTextureMod\libraries
file material_library.xml (with the texure replacement instruction)

\X Rebirth\extensions\TLTextureMod\assets\characters\argon\textures
file ar_f_yisha_diff.gz (the modified texture)
file ar_f_yisha_diff-small.gz (unmodified)


content of content.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<content id="1.0" name="TargetLost Texture Mod Attempt" description="Just want to Mod a texture ...for now" author="TargetLost" version="1.0" date="2014-01-01">
  <text language="44" name="Just want to Mod a texture ...for now" author="TargetLost" />
  <text language="49" name="Just want to Mod a texture ...for now" author="TargetLost" />
</content>
Note that the version number (version="1.0") is an integer and divided by 100.
A value of 1.0 will be displayed ingame as 0.01. A value of 103 will be displayed as 1.03.


content of material_library.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>

<diff>
  <!-- Replace Yisha Texture -->
  <replace sel="/materiallibrary/collection[@name='characters']/material[@name='ar_f_yisha_diff']/properties/property[@name='diffuse_map']">
    <property type="BitMap" name="diffuse_map" value="extensions\TLTextureMod\assets\characters\argon\textures\ar_f_yisha_diff"></property>
  </replace>
  <replace sel="/materiallibrary/collection[@name='argon']/material[@name='ar_f_yisha_diff']/properties/property[@name='diffuse_map']">
    <property type="BitMap" name="diffuse_map" value="extensions\TLTextureMod\assets\characters\argon\textures\ar_f_yisha_diff"></property>
  </replace>
  <replace sel="/materiallibrary/collection[@name='characters/argon']/material[@name='ar_f_yisha_diff']/properties/property[@name='diffuse_map']">
    <property type="BitMap" name="diffuse_map" value="extensions\TLTextureMod\assets\characters\argon\textures\ar_f_yisha_diff"></property>
  </replace>
  <replace sel="/materiallibrary/collection[@name='yisha']/material[@name='ar_f_yisha_diff']/properties/property[@name='diffuse_map']">
    <property type="BitMap" name="diffuse_map" value="extensions\TLTextureMod\assets\characters\argon\textures\ar_f_yisha_diff"></property>
  </replace>
  <replace sel="/materiallibrary/collection[@name='ar_f_yisha']/material[@name='ar_f_yisha_diff']/properties/property[@name='diffuse_map']">
    <property type="BitMap" name="diffuse_map" value="extensions\TLTextureMod\assets\characters\argon\textures\ar_f_yisha_diff"></property>
  </replace>
  <replace sel="/materiallibrary/collection/material[@name='ar_f_yisha_diff']/properties/property[@name='diffuse_map']">
    <property type="BitMap" name="diffuse_map" value="extensions\TLTextureMod\assets\characters\argon\textures\ar_f_yisha_diff"></property>
  </replace>
 
</diff>

but it does do nothing (and yes the extension is on in the game)

I just want to replace a texture..that can't be that complicated can it?

Sure I could repack it into that .cat/.dat package but the extension mod thing they offer here should make that obsolet...

But there is too much info missing.

Without better info the repacking becomes the much simpler solution.

killerog
Posts: 3464
Joined: Fri, 28. Oct 05, 16:31
x4

Post by killerog » Sat, 16. Nov 13, 13:24

My material library change looks like this:

Code: Select all

  <replace sel="/materiallibrary/collection[@name='interiors']/material[@name='int_tile_02']">
    <material name="int_tile_02" shader="shaderfx\high\XU_surface_test.fx" blendmode="none" preview="none">
      <properties>
        <property type="BitMap" name="diffuse_map" value="extensions\SBMod_Test\assets\textures\interiors\int_tile_02_diff"></property>
        <property type="BitMap" name="specular_map" value="extensions\SBMod_Test\assets\textures\interiors\int_tile_02_spec"></property>
        <property type="BitMap" name="normal_map" value="extensions\SBMod_Test\assets\textures\interiors\int_tile_02_bump"></property>
        <property type="BitMap" name="color_age_map" value="assets\fx\textures\dirt_diff"></property>
        <property type="BitMap" name="diffuse_paint_map" value="assets\textures\paint\ar_paintoverlays.tga"></property>
        <property type="Float" name="diffuseStr" value="4"></property>
        <property type="Float" name="specularStr" value="1"></property>
        <property type="Float" name="normalStr" value="2"></property>
      </properties>
    </material>
  </replace> 
Try doing it like that and see what happens.


And it looked like: http://i45.photobucket.com/albums/f60/k ... a1126e.jpg
Image

TargetLost
Posts: 474
Joined: Wed, 23. Nov 05, 20:27
x3tc

Post by TargetLost » Sat, 16. Nov 13, 13:52

I can try but I have less hope for this.
The problem is here:

<replace sel="/materiallibrary/collection[@name='interiors']/material[@name='int_tile_02']">
<material name="int_tile_02" shader="shaderfx\high\XU_surface_test.fx" blendmode="none" preview="none">

without the correct collection name whete the yisha thexture will be to find
it will not work

I guess that egosoft will deliver those keys somewhen.

But honest I wonder why they not just keept it simple by
just replacing any core file with the one in the expansion when it's the same folder and name.

That's how it should works and no knowledge of keys and complicated remaping for simple things were required.

killerog
Posts: 3464
Joined: Fri, 28. Oct 05, 16:31
x4

Post by killerog » Sat, 16. Nov 13, 14:00

Code: Select all


  <collection name="characters">
 <material name="argon_female_yisha_eyelashes" shader="shaderfx\high\XU_hair.fx" blendmode="alpha8" preview="none">
      <properties>
        <property type="BitMap" name="diffuse_map" value="assets\characters\argon_bodies\ar_yisha_eyelashes_color"></property>
      </properties>
    </material>

    <material name="yisha_eyelashes_2" shader="shaderfx\high\XU_hair.fx" blendmode="alpha8" preview="none">
      <properties>
        <property type="BitMap" name="diffuse_map" value="assets\characters\argon_bodies\ar_yisha_eyelashes_color"></property>
        <property type="BitMap" name="specular_map" value="assets\characters\argon_bodies\ar_yisha_eyelashes_spec"></property>
        <property type="BitMap" name="normal_map" value="assets\characters\argon_bodies\ar_yisha_eyelashes_bump"></property>
        <property type="Float" name="specularStr" value="0.25"></property>
        <property type="Float" name="normalStr" value="2.0"></property>
        <property type="Float" name="mat_spec_power" value="200.0"></property>
      </properties>
    </material>

    <material name="argon_female_yisha_hair" shader="shaderfx\high\XU_hair.fx" blendmode="hair" preview="none">
      <properties>
        <property type="BitMap" name="diffuse_map" value="assets\characters\argon_bodies\yisha_test_hair_color"></property>
        <property type="BitMap" name="specular_map" value="assets\characters\argon_bodies\yisha_test_hair_spec"></property>
        <property type="BitMap" name="normal_map" value="assets\characters\argon_bodies\yisha_test_hair_bump"></property>
        <property type="BitMap" name="occlusion_map" value="assets\characters\argon_bodies\yisha_test_hair_occl"></property>
        <property type="Float" name="diffuseStr" value="1.0"></property>
        <property type="Float" name="specularStr" value="0.01"></property>
        <property type="Float" name="normalStr" value="0.5"></property>
        <property type="Float" name="mat_spec_power" value="200.0"></property>
        <property type="Float" name="fresnel_strength" value="0.0"></property>
        <property type="Float" name="fresnel_power" value="0.0"></property>
        <property type="Float" name="fresnel_minrange" value="0.0"></property>
      </properties>
    </material>
    <material name="argon_female_yisha_face" shader="shaderfx\high\XU_skin.fx" blendmode="none" preview="none">
      <properties>
        <property type="BitMap" name="diffuse_map" value="assets\characters\argon_bodies\ar_f_face_a_color"></property>
        <property type="BitMap" name="diffuse_sub_map" value="assets\characters\argon_bodies\ar_f_face_a_subd"></property>
        <property type="BitMap" name="diffuse_paint_map" value="assets\characters\argon_bodies\ar_f_face_a_paint"></property>
        <property type="BitMap" name="specular_map" value="assets\characters\argon_bodies\ar_f_face_a_spec"></property>
        <property type="BitMap" name="normal_map" value="assets\characters\argon_bodies\ar_f_face_a_bump"></property>
        <property type="BitMap" name="normal_sub_map" value="assets\characters\argon_bodies\ar_f_face_a_bump"></property>
        <property type="BitMap" name="occlusion_map" value="assets\characters\argon_bodies\ar_f_face_a_occl"></property>
        <property type="Float" name="specularStr" value="0.13"></property>
        <property type="Float" name="diffuseStr" value="0.25"></property>
        <property type="Float" name="diffuse_subStr" value="0.4"></property>
        <property type="Float" name="mat_diff_light_str" value="0.2"></property>
        <property type="Float" name="mat_spec_light_str" value="0.4"></property>
        <property type="Float" name="mat_diff_light_power" value="6.0"></property>
        <property type="Float" name="mat_spec_light_power" value="5.0"></property>
        <property type="Float" name="mat_spec_light_func" value="0.1"></property>
        <property type="Float" name="occlusionStr" value="0.5"></property>
        <property type="Float" name="normalStr" value="1.0"></property>
        <property type="Float" name="normal_subStr" value="0.5"></property>
        <property type="Float" name="environmentStr" value="0.1"></property>
        <property type="Color" name="fresnel_color" r="222" g="122" b="122" a="122" value="(color 222 122 122)"></property>
        <property type="Float" name="fresnel_strength" value="0.01"></property>
        <property type="Float" name="fresnel_power" value="30.0"></property>
      </properties>
    </material>

    <material name="argon_female_yisha_body" shader="shaderfx\high\XU_surface_test.fx" blendmode="none" preview="none">
      <properties>
        <property type="BitMap" name="diffuse_map" value="assets\characters\argon_bodies\ar_yisha_body_color"></property>
        <property type="BitMap" name="specular_map" value="assets\characters\argon_bodies\ar_yisha_body_spec"></property>
        <property type="BitMap" name="normal_map" value="assets\characters\argon_bodies\ar_yisha_body_bump"></property>
        <property type="Float" name="environmentStr" value="0.2"></property>
        <property type="Float" name="specularStr" value="0.2"></property>
      </properties>
    </material>
</collection>
These are the code blocks containing the keywords you should need.

So yours will be along the lines of:
<replace sel="/materiallibrary/collection[@name='characters']/material[@name='argon_female_yisha_body]">
Image

TargetLost
Posts: 474
Joined: Wed, 23. Nov 05, 20:27
x3tc

Post by TargetLost » Sat, 16. Nov 13, 14:17

killerog wrote:
These are the code blocks containing the keywords you should need.

So yours will be along the lines of:
<replace sel="/materiallibrary/collection[@name='characters']/material[@name='argon_female_yisha_body]">
Thank you I will check later.

The File I modded which is the diffuse texture of her dress: ar_f_yisha_diff isn't listet. The body color map is another one.

But that already helps me a lot...so I can experiement a litte with try and err

it's somewhat imbelievable that with all those many texture maps, diffuse, spcular, normal, occlusion..
Yisha face forexample still looks like it's a model of a game of the year 2000
and as I have seen the mesh is high polygon count...something is very wired here.

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Sat, 16. Nov 13, 15:31

Just a heads-up:

If you follow the steps for the first example one by one, it's not going to work.

"X Rebirth" is located in my documents\Egosoft.
An \extensions\ folder in "X Rebirth" is not going to be found.

\Steam\steamapps\common\x_rebirth\extensions\MyModFolder\
is the correct path.


Also, despite all modern XML fanciness, file names are still critically important.

The first example with the trade lane colour is not going to work unless the file name is exactly "material_library.xml".
While Observe doesn't say otherwise, it isn't clearly stated, either. =)
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

Deleted User

Post by Deleted User » Sat, 16. Nov 13, 16:28

well amazing. the game is only out and you've already been digging!

TargetLost
Posts: 474
Joined: Wed, 23. Nov 05, 20:27
x3tc

Post by TargetLost » Sat, 16. Nov 13, 17:08

..of course..when else shall we start?

so I got it to work.

[ external image ]


Here the correct setup for this: (hope this will help some for a quicker start)

according to that template osr_universe.rar and the OP post you have to create something like this:

1. create the \extensions folder in your X Rebirth main folder
2. create your Mod folder in there you can choose any name I choosed TLTextureMod


Then put this content in there (create the folders where needed):

\X Rebirth\extensions\TLTextureMod
file content.xml (with the description of your mod/expansion)

\X Rebirth\extensions\TLTextureMod\libraries
file material_library.xml (with the texure replacement instruction)

\X Rebirth\extensions\TLTextureMod\assets\characters\argon\textures
file ar_f_yisha_diff.gz (a gzip of your modded yisha suit texture)
file ar_f_yisha_diff-small.gz (unmodified, maybe not needed)

\X Rebirth\extensions\TLTextureMod\assets\characters\argon_bodies
file ar_yisha_body_color.gz (a gzip of your modded yisha bodytexture)
file ar_yisha_body_color-small.gz (unmodified, maybe not needed)



content of file content.xml :

Code: Select all

<?xml version="1.0" encoding="utf-8"?> 
<content id="1.0" name="TargetLost Texture Mod Attempt" description="Just want to Mod a texture ...for now" author="TargetLost" version="1.0" date="2014-01-01"> 
  <text language="44" name="Just want to Mod a texture ...for now" author="TargetLost" /> 
  <text language="49" name="Just want to Mod a texture ...for now" author="TargetLost" /> 
</content> 


content of file material_library.xml

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>

<diff>
  <!-- Replace Yisha Texture -->
  <replace sel="/materiallibrary/collection[@name='characters_bodies']/material[@name='ar_f_yishas_suit']/properties/property[@name='diffuse_map']">
    <property type="BitMap" name="diffuse_map" value="extensions\TLTextureMod\assets\characters\argon\textures\ar_f_yisha_diff"></property>
  </replace>
  <replace sel="/materiallibrary/collection[@name='characters']/material[@name='argon_female_yisha_body']/properties/property[@name='diffuse_map']">
    <property type="BitMap" name="diffuse_map" value="extensions\TLTextureMod\assets\characters\argon_bodies\ar_yisha_body_color"></property>
  </replace>
</diff>


The keywords you need for the replacement (the catalog and the material keyword)

you can extract from the official material_library.xml

which you will find in the folder where you unpacket the .cat/.dat

Mine is here:
\XRCatUnpack\libraries

Note that the textures are all gzipped (.gz)
in each such .gz you find the texture file with no ending
it's a .dds file
Just extract the .gz and add .dds to the file then
open/mod it an create a .gz again with your moddes .dds file and out the .dds again

for the texture moding I took noesis for the .dds input and save as .tga
the .tga then I moded with .NET paint
then loaded in noesis again and saved as .dds
but of course you are free here how to mod this stuff

User avatar
enenra
Posts: 7150
Joined: Fri, 8. Apr 05, 19:09
x4

Post by enenra » Sat, 16. Nov 13, 17:13

I see we're starting with the important "assets". :roll: :D

TargetLost
Posts: 474
Joined: Wed, 23. Nov 05, 20:27
x3tc

Post by TargetLost » Sat, 16. Nov 13, 17:35

:oops: :D

The mesh (.xac) would be even more important to get her into a normal human shape and a better head :roll:

But I read it's still not supported as an expansion and some of the meshes I couldn't open (noesis with DK Online python script plugin) like the head. Maybe a noesis/plugin error or maybe it's not quite the right .xac format.

Anyway time for me to finnaly game a little.. I am somhow still in the first hour of the game. :)

p.s. Byway I self probabily will not going to mod except little things for myself so dont count on me for mods. I just don't have time for.

andry1
Posts: 9
Joined: Sat, 12. Sep 09, 23:45
x4

Post by andry1 » Sat, 16. Nov 13, 18:10

r4m0n wrote: It looks like the UI section uses some Lua code, but it's getting distributed pre-compiled and on an unusual format, so I haven't been able to see how that part works.
I've been digging into this a bit -- LuaJIT bytecode files btw -- you can list the bytecode using luajit itself, which can yield some useful information I imagine, although I haven't had a chance to really dig into any of the ones I've listed so far.

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Sat, 16. Nov 13, 19:25

Small tip for modders who end up launching the game... a lot:

Like with previous X games, "-skipintro" does what it sounds like.

Enter that as a "launch option" in the steam client.


For the last day I've been trying to fix one little thing... removal of the "dead" cockpit graphics... but without any success.
I never worked with 3D graphics before so it's like trying to disarm a nuclear device where all the buttons are labeled in cyrillic letters.

It's not the biggest issue with the game (that would be the UI (or lack of one)) but it sounded like something I could do to make the main screen not look so horribly cramped.


- - - - -

Also, Obsever skipped right to "releasing mods properly", which is commendable but won't be relevant on a large scale anytime soon. =)

First steps would be to tinker with the game files, find out what works, what you want to change.

For that, you don't encode any complicated patch files. You extract the entire file and start editing.

For instance:
Steam\steamapps\common\x_rebirth\extensions\TradeLaneMod\libraries\material_library.xml

That's the entire 800k file. It simply replaces the same file in the CAT archives.
Apply the colour tinting to the trade lanes and watch it work ingame.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Sun, 17. Nov 13, 00:28

well, it seems there are tools out there wich make a game compatible diff.xml file from the core file and the mod file, but i wasnt sucessful in using them till now.. something like this would be optimum, because you can edit core files directly with that and have the compatibility of diff files instead of file replacement.

btw: we should discuss about some default folder sceme for things not given by the game/devs, like manuals and so on.
i think the Bonus Pack from the earlier games is a solid base for that.
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

Azalrion
Posts: 66
Joined: Sat, 9. Nov 13, 11:31
x4

Post by Azalrion » Sun, 17. Nov 13, 09:08

Just a heads up about content.xml, in the osr_universe mod its id is set as id="1.0". You'll need to change it to something unique as that is used by the game to decide which mods are active or not.

Return to “X Rebirth - Scripts and Modding”