[TUTORIAL] X Rebirth - Modding Guide

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

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

User avatar
Observe
Posts: 5079
Joined: Fri, 30. Dec 05, 17:47
xr

Post by Observe » Mon, 26. May 14, 22:39

Notice: I am preparing to place this tutorial and accompanying file on Steam Workshop. I am asking the community to let me know of any changes/additions/omissions I should consider. I know there have been various suggestions since I originally posted this tutorial, but I might not be able to easily find them all to incorporate.

This will take me a week or so before I am ready to submit to the Workshop. Please, if you have used this tutorial, I ask for your input.

Thanks

User avatar
Commodore MJ Fire
Posts: 476
Joined: Mon, 27. Jul 09, 17:45
x4

Post by Commodore MJ Fire » Mon, 26. May 14, 23:07

Hm, some little notes for the cluster.xml: When you resize an object with blender (using the xmf-converter) the size part in the cluster.xml is important- for the performance the game fades out the mesh and uses this information to find out, when the object is out of view- the size information you get from the output xml-file at the converter- copy it, or multiply the original size-value with the resize-factor- important when you make something bigger or when you copy some meshes from one cluster to another :wink:
and: the .ANI files are not really useful- the Texture animation at a new mesh you got into the cluster still works, when you place it into the cluster.xml.
greetings, MJ Fire

karabAs
Posts: 96
Joined: Sun, 7. Dec 03, 01:58
x3tc

Post by karabAs » Tue, 27. May 14, 19:01

Observe wrote:Part Three: Bringing the Universe to life

Example 12: Working with Mission Director

Learning Mission Director (MD) is beyond the scope of this guide. There are official documents available on using Mission Director, and this subject will need to be dealt with separately. Suffice to say, Mission Director is extremely flexible and powerful. It can be used not only for creating game missions, but also for affecting a wide variety of conditions within the universe.

Contained within the example mod, is a sample MD file extensions\osr_universe\md\osr_universe.xml. This file is a bit of a hodge-podge of things I was doing while developing this guide and the accompanying example mod, but you might want to look at it for some ideas. Here are a few of the key features of the code in this particular MD file:

a). When playing the game in "free mode" (not the campaign), you will be warped to a zone in the new cluster. In the code, you will see <event_cue_signalled cue="md.Setup.GameStart" />. This triggers the associated code to run as soon as the game has started.

b). Player ship (Skunk) is loaded with various weapons and ammo, and the player is given 51 million credits.

c). All the zones within the custom sector are set to 'known'. This means they show up on the map without having visited them.

d). Two stations are spawned with <create_station> along with station defense ships.

e). Several player-owned Capital ships are spawned with <create_ship>. These are assigned to a group.

f). If you command the big Capital ship (Arawn) to move somewhere, the other 2 Capital ships will escort it as a convoy. If the destination is within the sector, these ships will fly there (not jump). If outside the sector, these ships will jump via the nearest gate. As a convoy, these ships will defend themselves and perform other actions. You will see various things being done in the code related to how this convoy operates.

g). NPC's Commander, Engineer, and Defense Control NPC's are created for each of the Capital ships. In addition, an Upgrade Trader is placed on the docking-bay of the Arawn. Also, an engineer is assigned to the player ship. This engineer will disembark from the Skunk, and will be present on the platform. When the Skunk leaves the dock, the engineer is transferred back to the Skunk.

a). - YES
b). - YES
c). - YES
d). - YES
e). - NO - there is no player owned capital ships in my new XR 2.0 free play gamestart! Am I missing something? Or they are lost somewhere in the Universe, like in Transcend II (huge thanks for that BTW, spent many hours on it!)? :wink:

Thank you.
Last edited by karabAs on Tue, 27. May 14, 19:15, edited 1 time in total.

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

Post by UniTrader » Tue, 27. May 14, 19:11

karabAs wrote:Maybe they are somewhere in the Universe? :(
did you check your property list?
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 ;)

karabAs
Posts: 96
Joined: Sun, 7. Dec 03, 01:58
x3tc

Post by karabAs » Tue, 27. May 14, 19:16

UniTrader wrote:
karabAs wrote:Maybe they are somewhere in the Universe? :(
did you check your property list?
Yep, Skunk only... :(

User avatar
Observe
Posts: 5079
Joined: Fri, 30. Dec 05, 17:47
xr

Post by Observe » Wed, 28. May 14, 03:21

Thanks for the suggestions!

I have now placed the example mod that accompanies the tutorial on Steam Workshop for those who with to download it to study along with the tutorial. It can be obtained here.

The example mod has a separate forum discussion here: Transcend - Lost Colony.

Now that I have reviewed and updated the mod files for comparability with Rebirth 2.0, I will be updating the tutorial with additional content in coming days.

Thanks

User avatar
Commodore MJ Fire
Posts: 476
Joined: Mon, 27. Jul 09, 17:45
x4

Post by Commodore MJ Fire » Sat, 31. May 14, 23:33

I have problems with game crashs after some play-time: It misses loading some tex and after a few of these mistakes it crashed. Are there any changes for some forms of patching since 2.0 or are these bugs a problem from a savegame before 2.0? Or is it the patch itself? Searching for mistakes at my enzy-mod- couldn't found anyone.
Did you know if some of the SweetFX mods (I use Re-Imagined) are no longer really compatible with 2.0? It starts normally and It does the same good work as before...
greetings, MJ Fire

KlausM
EGOSOFT
EGOSOFT
Posts: 639
Joined: Wed, 6. Nov 02, 20:31
x4

Post by KlausM » Fri, 6. Jun 14, 22:01

Commodore MJ Fire wrote:But there is one limitation at the workshop you also have to know (I found out after my upload fails): At this time, you can't upload files with more than 100 MB- and you need to pack all mod data into a dat/cat (the tool does that for you), which means no mod bigger than 100 MB can be published at the workshop. Please, fix this, Egosoft...
Uploading more than 100MB should be possible, the workshop tool supports that. I just tested it with 220 MB and it worked for me. Admittedly, only the second time - during the first time the Steam client silently crashed. ;) So you should just try again.

mbhm
Posts: 78
Joined: Wed, 21. Mar 07, 18:13
x4

How to about make a zonehighway from scratch.

Post by mbhm » Sun, 8. Jun 14, 12:23

Ok, at first i wanted to get things working before i write something like this, but as the jumpgate and the sectorhighway seem to take quite a while to get going, i'll write the summary for the zonehighways now.

First off: I created that one by simply extracting the original files, making copies into the appropriate working folder replacing the header with:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
	<replace sel="/macros">
		<macros>
			[...]
		</macros>
	</replace>
</diff>
Only the macros.xml and t-files are made in a manner of simply adding indexes / pages.

############################################
Files needed:
  • zones.xml
  • sectors.xml
  • zonehighways.xml
  • macros.xml (if you want to use your own naming conventions)
  • t-files (if you want to localize your texts into other languages)
You need a Sector and two zones (or one zone if the Highway should be a circle i a way). As i used the original files the map somehow was already painted. Basically the sector has to define some zone with:

Code: Select all

<connection name="tzoneCluster_C_Sector09_Zone62_connection" ref="zones">
						<offset>
							<position x="left/right" y="high/low" z="up/down" />
						</offset>
						<macro ref="tzoneCluster_C_Sector09_Zone62_macro" connection="sector" />
					</connection>
'position' is the position on the map with x/y/z being about values between +/- 200 000.
'tzoneCluster_C_Sector09_Zone62_connection' being the reference towards other files (galaxy/cluster) and 'tzoneCluster_C_Sector09_Zone62_macro' being the definition of the zone in zones.xml.

The zone is defined like that:

Code: Select all

<macro name="tzoneCluster_C_Sector08_Zone87_macro" class="zone">
				<component ref="standardzone" />
				<connections>
			
					<!-- Highwaytest -->
					<connection ref="Highway03Connection01_gate">
						<offset>
							<position x="7000" y="-1500" z="-990" />
						</offset>
					</connection>
					[...]
				</connections>
				<properties>
					<boundaries priority="1" />
					<identification name="{20005,92}" />
					<area />
					<icon map="tzoneCluster_C_Sector08_Zone92_macro_icon" />
					<map index="3" />
				</properties>
			</macro>
I had to use the already existing convention for the gate being Highway0xConnection0y_gate with x being the number of the highway and y the number of the gate in the highway (so 1 or 2). (not sure why, as i didn't find any hint why it needed to be that way)
Position again being the position in the map but in this case at the base of the zone (i think it's somewhere between +/- 40 000.)

now there needs to be an entry in the Sectordefinition again besides the zones.

Code: Select all

					<connection name="AP_Highway_990802_connection" ref="zonehighways">
						<offset>
							<position x="-30421.875" y="-1500" z="92531.25" />
						</offset>
						<macro ref="AP_Highway_990802_macro" connection="sector">
							<connections>
								<connection ref="entrypoint">
									<macro path="../../tzoneCluster_C_Sector08_Zone87_connection" connection="Highway03Connection01_gate" />
								</connection>
								<connection ref="exitpoint">
									<macro path="../../tzoneCluster_C_Sector08_Zone92_connection" connection="Highway03Connection02_gate" />
								</connection>
							</connections>
						</macro>
					</connection>
The position here in theory can be anywhere in the sector but i tend to put it into the middle of the planned highway. As it seems, it is the zero-point of a new coordinate system which defines the highway (so if you have any clue about vector geometry and/or shifted coordinate systems you're probably in an advantage here).
The paths refer to the gates defined in the zones.xml and define them as entry- and exitpoint.

Now the difficult part:
the entry in the zonehighways.xml:

Code: Select all

<macro name="AP_Highway_990802_macro" class="highway">
				<component ref="standardzonehighway" />
				<connections>
					<connection ref="entrypoint">
						<offset>
							<position x="-19171.875" y="0" z="98924.0625" />
						</offset>
					</connection>
					<connection ref="exitpoint">
						<offset>
							<position x="65171.875" y="0" z="-60914.0625" />
						</offset>
					</connection>
				</connections>
				<properties>
					<boundaries>
						<boundary class="splinetube">
							<splineposition x="-19171.875" y="0" z="98923.0625" tx="0.5" ty="0.001" tz="0.5" weight="0" inlength="0" outlength="90362" />
							<!--<splineposition x="22000" y="0" z="19000" tx="0.95205146074295" ty="0.000164837692864239" tz="0.305937916040421" weight="1" inlength="10000" outlength="10000" />-->
							<splineposition x="65171.875" y="0" z="-60913.0625" tx="0.5" ty="0.5" tz="0.5" weight="0" inlength="90362" outlength="0" />
							<size r="200" />
						</boundary>
					</boundaries>
					<controls>
						<linear>
							<time />
						</linear>
						<angular>
							<roll />
						</angular>
					</controls>
					<identification name="AP_Highway_990802" />
					<configuration ref="cluster_c_localhighwayconfiguration" />
				</properties>
			</macro>
The position of the entrypoint as i observed it, is about as following:
[position of the zone in the sector] + [position of the gate in the zone] - [position of the highway definition in the sector]
The position of the exitpoint being the same but with the 2nd zone and the 2nd gate.
now the splinepositions seem to work in an similar way being defined as points somewhere between entry and exitpoint with the first and last being either exactly there or very close to them.

Additional splineposition define points through which the highway moves with the following values:
x/y/z: position in the coordinate system the highway position is the zero-point of.
weight: if two splinepositions interfere with each other this should define which one is prefered and how much.
inlength/outlength: a value who seems to define how far a the curve through that point is, with inlength being the part form the side moving into the point and outlength the one moving away from the point.
tx/ty/tz: seems to be some kind of sinus or cosinus value defining the intensity of the curve through that point.
(the last two are very vague and have to be experimented heavily with)

Note: Copying highways needs the corrosponding zones and gates to be in the exact same position,too or you get weird results (if any).

When i get those sectorhighways or jumpgates working, i'll try to make a highway that could be used as a real tutorial and post that.

PS: all of that above is based on my own perception, so might consist of errors and false assumptions. But maybe it helps someone to create his own zonehighway and who cares for false assumptions, if it works. 8)

User avatar
darthmoll
Posts: 196
Joined: Fri, 11. Sep 09, 16:24
x4

Post by darthmoll » Mon, 14. Jul 14, 11:11

hello guys, is this tutorial still valid? and if yes then where can i download osr_universe cause i wanna see if i can pickup the modding as well.

User avatar
YorrickVander
Posts: 2689
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander » Mon, 14. Jul 14, 11:40

The latest version of the osr_universe code is on workshop as Transcend mod :) Also grab the XR tools from forum sticky to unpack it. Good luck, have fun and ask questions!
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

User avatar
darthmoll
Posts: 196
Joined: Fri, 11. Sep 09, 16:24
x4

Post by darthmoll » Mon, 14. Jul 14, 14:03

thanks yorrick. i got the file and axtracted it into extension folder like they said in the first post. but i need to figure out how the structure works.

i just want to work on a basic script and see how that works. dont even know how to start actually.lol. but i guess i got alot of reading to do.

i do wonder if there is a way to test the script if it has errors. i know there was another program i tried that had a build in test fuction cause we had to set the def path and def files in the program. does visual studio express also have this?

User avatar
YorrickVander
Posts: 2689
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander » Mon, 14. Jul 14, 14:24

One way is to check debug output

"C:\Users\Me\Documents\Egosoft\X Rebirth\54443424\rebirth.log"

with

-debug all -logfile rebirth.log

in launch options (via steam client).
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

User avatar
alexalsp
Posts: 1820
Joined: Fri, 18. Jul 14, 05:28
x4

Post by alexalsp » Sun, 3. Aug 14, 02:20

Who knows how to make a mod voice . can it be done or not. Will the voice to work as a mod, if Yes then how to do it. Everything is ready but not work.

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

Post by UniTrader » Sun, 3. Aug 14, 09:32

figured out that one last week (took me around 10 hours, including the preperation work to create the voice files automatically which was the biggest part), its part of my current project and therefore unreleased currently. But i will give you my current progreass as-is and without any warranties here ;) (if you or someone else finds errors please PM me about them so i can remove them, but note that this one is not finished yet and some things are still missing..)


for your question the related files are:
=> the whole "voice"-Folder
=> t/0001-L044.xml (the others there are just to generate the voice folder under a Linux OS, feel free to use if you can manage it)
=> libraries/sound_library.xml

similiar named files which end with L049 are for the German Version of this Extension
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 ;)

Realspace
Posts: 1339
Joined: Wed, 15. Nov 06, 10:21
x4

Post by Realspace » Thu, 9. Oct 14, 01:23

is there any galaxy editor on the way? :wink:

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

Post by UniTrader » Thu, 9. Oct 14, 01:30

if you ask because you think i used some kind of tool fot that Map: nope, i am a masochistic raw XML Editor. i think Westbeam started something in that direction, but except simple viewing nothing is included there yet afaik.
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 ;)

User avatar
nidaren
Posts: 66
Joined: Wed, 27. Nov 13, 14:33
x4

Post by nidaren » Mon, 20. Oct 14, 09:15

Hey,

I have a question to the new 2.50 game build.

Is it possible to update specific ship components via script?

For example: Make it find all Scaldis ships existing within player's game and upgrade their cargo component with different one.

Thanks!

User avatar
Litauen
Posts: 193
Joined: Fri, 22. Nov 13, 21:09
xr

Post by Litauen » Mon, 20. Oct 14, 10:21

Check this file: libraries/patchactions.xml

I was unable to make it work for me. If you will succeed - please let me know.

User avatar
wysiwyg
Posts: 585
Joined: Thu, 26. Feb 04, 00:08
x4

Post by wysiwyg » Wed, 22. Oct 14, 21:44

nidaren wrote:Hey,

I have a question to the new 2.50 game build.

Is it possible to update specific ship components via script?

For example: Make it find all Scaldis ships existing within player's game and upgrade their cargo component with different one.

Thanks!
Changing components in-game looks a little tricky :-
Has anyone looked at how the player ship handles its upgrades. In the properties section of the skunk's macro there is a list of upgrades referenced by macro and tagged to the installed component e.g. tags="engine" etc.

e.g.

Code: Select all

In /assets/units/player/macros/unit_player_ship_macro.xml we see:

<macros>
   <macro>
       <properties>
           <upgrades multimacro="1">
                 .......
                 <upgrade upgrade="engine_player_man_mk2_macro" tags="engine" />
                 <upgrade upgrade="engine_player_man_mk3_macro" tags="engine" />
                 <upgrade upgrade="engine_player_man_mk4_macro" tags="engine" />
                 <upgrade upgrade="engine_player_man_mk5_macro" tags="engine" />
                  .........
              </upgrades>
           </....etc
There are scripting commands then to upgrade the ship but I'm not quite sure how they work as they require a percentage value as well as a tag or macro name/value. The upgrades for the skunk are actually handled through the upgrade trader's menu Lua script. Either way the same principle may be able to be applied to cap ships or other assets.

Code: Select all

From /libraries/common.xsd :
      <xs:element name="upgrade_object_by_macro">
        <xs:annotation>
          <xs:documentation>
            Upgrade an object by using a macro and percentage ($object.hasmultimacroupgrades must be true)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="macro" type="macro" use="required" />
          <xs:attributeGroup ref="range" />
        </xs:complexType>
      </xs:element>

      <xs:element name="upgrade_object_by_tag">
        <xs:annotation>
          <xs:documentation>
            Upgrade an object by using a tag and percentage ($object.hasmultimacroupgrades must be false)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attributeGroup ref="action" />
          <xs:attribute name="object" type="object" use="required" />
          <xs:attribute name="tag" type="expression" use="required">
            <xs:annotation>
              <xs:documentation>
                Upgrade tag
              </xs:documentation>
            </xs:annotation>
          </xs:attribute>
          <xs:attributeGroup ref="range" />
        </xs:complexType>
      </xs:element>
I'll dig a bit more when I get time and see what I can come up with.

P.S. I think the patchactions stuff in the library only deals with patches to MD and AI scripts and not component macros - I could well be wrong though as I'm very new to the XML stuff - feel much more comfortable in the Lua script.

Post Reply

Return to “X Rebirth - Scripts and Modding”