[WIP][Tutorial] Building your own ship for dummies 2

The place to discuss scripting and game modifications for X4: Foundations.

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

BrummBear02
Posts: 308
Joined: Fri, 3. Oct 08, 20:43
x3ap

[WIP][Tutorial] Building your own ship for dummies 2

Post by BrummBear02 » Mon, 18. Feb 19, 23:28

Hello again,

Ill try to create a complete walkthrough to creat an S sized ship that fully works with 6.0 upwards.


Please keep in mind that everything i say here is the result of try and error and a lot is unclear to me so some things i say are wild guesses.
If u know im talking bullcrap about something u can correct me and if i can verify that i was wrong ill change/add/remove that.

It seems i cant put pictures directly into the post anymore. So... that one is not on me.

This will be a work in progress and i cant promise ill ever finish it, so contributions are welcome. If you are willing to write part of the tutorial please contact me via PM or in Discord.



please ALWAYS use lower case letters when naming files. Only use capital letters in the t files for naming ingame and the .ANI files.
if a reference is with a capital C while the file it refers to is with a lower case one it will cause the mod to not work.

[ external image ]


Contents:

- Software
- Creating a copy of a existing ship, renameing it and adding it to a shipyard
- Parts of a ship
- What can be done and what cant be done
- Choosing a ship fitting for our needs
- Getting the ship in a format suitable for the Egosoft Blender tools
- Editing the mesh
- Creating a convex Hull/Collision
- UV textures and vertex paint
- Moving connections around and other XML file stuff
- Creating custom materials
- Animations
- Troubleshooting




Software

We will work with the folowing tools:

X Rebirth Catalog Tool 1.10
Notepad++
Blender
Egosoft Blender tools
XRConverter
How to use: viewtopic.php?f=129&t=360045


Another important tool is the modding community itself. You can reach out to us here on the board or on Discord. Really, give discord a try.

https://discord.gg/QgDJ69j




Creating a copy of a existing ship, rename it and add it to a shipyard


Getting prepared

Ok, first we need to unpack our game.
For this we need to start up the X Rebirth Catalog Tool 1.10 we grabbed earlier.
Read up on how to do that here: viewtopic.php?f=181&t=402452
Alternatively u can simply use the GUI that thing provides. Its pretty much self explanatory. Unpack ur whole game.

[ external image ]
Should look like this. Take note of the path i used. I recomend u create a seperate folder for ur unpacked X4 without spaces in it.
Somehow the converter we use later seems to have issues with spaces. at least for me. maybe its superstition from my side but better safe than sorry.



Now to convert all the models. Grab the XRConverter and put it into X4Mod root directory.
[ external image ]
Create a new text file, also in the root directory, and open it with windows editor.
paste this inside there and then go save as -> ConvertBAT_import.bat

Code: Select all

FOR /R "..\X4Mod\assets\" %%f IN (*.xml) do (
  XRConvertersMain.exe importxmf "..\X4Mod" "%%f"
  )
pause
[ external image ]

this will create a bat file that will convert almost all 3d models inside of the assets folder into .dae files.
Beware that this might take a while so double klick the freshly created .bat and wait.
Also create a second .bat with

Code: Select all

FOR /R "..\X4Mod\extensions\cubix\" %%f IN (*.dae) do (
  XRConvertersMain.exe exportxmf "..\X4Mod" "%%f"
  )
pause
this will convert all .dae files inside the cubix folder to .xmf and a corresponding xml file.
We dont need this last step anymore but i leave it here. Just in case.


Copy a existing ship

Now we will grab an existing ship. Since i worked with the Argon Discoverer the most we will copy that one.
Create a folder named "extensions" in the root directory u installed X4 into. The one u use to actually play X4.
From now on i refer to this one as X4 Foundations and the copy we unpacked our game to will be X4Mod.

We will use the files from my koha mod and modify them because its simpler than creating new ones.

Now download my Koha mod here
and unpack it into the extensions folder. Then rename the Koha folder into Cubix.
Dive deeper into now X4 Foundations\extensions\cubix\assets\units\size_s and rename the folder the koha_data into cubix_data and delete the koha.xml in there.
also delete everything thats inside the now cubix_data.
Go to X4 Foundations\extensions\cubix\assets\units\size_s\macros and delete koha_macro.

In the end it should look like this
[ external image ]

go to X4Mod\assets\units\size_s and grab ship_arg_s_scout_01.xml and SHIP_ARG_S_SCOUT_01_DATA.ANI to copy those two into X4 Foundations\extensions\cubix\assets\units\size_s
Depending on your windows settings u might not see the file extensions. Ignore the .sig files. those are signature files to not flag ur game modified. they wont work on our ship.
[ external image ]

now go X4Mod\assets\units\size_s\macros and copy ship_arg_s_scout_01_b_macro to X4 Foundations\extensions\cubix\assets\units\size_s\macros
and everything inside X4Mod\assets\units\size_s\ship_arg_s_scout_01_data into X4 Foundations\extensions\cubix\assets\units\size_s\cubix_data


Editing the XML files

Ok, moving on. Now the xml part is a huge topic on its own and u can(and probably should do so sooner or later) read more about it here

For all editing we will use Notepad++

in X4 Foundations\extensions\cubix we will find the "content.xml" this file describes your mod in the extensions manager tool the game has ingame (where u can turn on and off extensions)
Simply swap out the word "Koha" with "Cubix" here and we are good to go.
If u press CTRL+F in Notepad++ and then select replace u can search for a specific word and replace it with something. Also swap out my name with yours.
Ive never cared about the date and version but if u are not a complete brain mess like me u can update that whenever u make a new version of ur mod. thats probably even useful.

Folder: t
\X4 Foundations\extensions\cubix\t are language files for the ingame naming and description.
if u **** this up it will show up as =ReadText= or something like that.
I havent played around with this too much and im pretty sure u can find some more info on this if u search the forum. For now simply replace the word "Koha" with "Cubix" in every file
For example: <page id="999832" title="Koha" descr="Koha" voice="yes"> becomes <page id="999832" title="Cubix" descr="Cubix" voice="yes">
also you should change the page id to one thats free. idk if there is already a post here on used ids or not.
this might interfer with other mods if they also use the page id u choose. for now stay on the one i used for the Koha.
The other files can be a simple copy of your 0001 or, if u feel generous, u can actually translate it. 0001-L049 for example is german. So if u want your mod to be translated to german if someone uses the german game version simply put a translation here. Keep in mind that if u leave the others untouched, for example only change 044 and leave 049 be, the german X4 players will have "Koha" in they shipyard while english players will have "Cubix" So change all of them.
Another option would be to delete all of the files except the 0001. This means every player has the same name and description on the ship.

Folder: libraries
X4 Foundations\extensions\cubix\libraries are... well. libraries. for now we only need to have a wares.xml there.
Inside there we can add wares to stations i guess. in any case its used to add the ware "Cubix" to the argon shipyard.
It also defines whats needed for the production, the time it takes to produce, the credits it will cost and which licence one needs to buy it.
Again u simply change koha to cubix. for example koha_ware becomes cubix_ware.
Also adjust the page id if u changed it earlier. ( name="{999832,2}" description="{999832,3}" )

Folder: index

Inside here we will find components and macros.
We will start with components.
In our case the components file simply refers to our ship .xml which means we simply swap out koha for cubix again.

Code: Select all

<entry name="koha" value="extensions\koha\assets\units\size_s\koha" />
becomes

Code: Select all

<entry name="cubix" value="extensions\koha\assets\units\size_s\cubix" />
if we use more than one part on our ship wed need to refer to it here. for example i created a new L engine for my Raport port and to use it i need to refer to it in the components.xml.

Code: Select all

<entry name="engine_arg_l_allround_01_mk2" value="extensions\Raptor\assets\props\Engines\engine_arg_l_allround_01_mk2" />

macros.xml refers to every macro file we use. In our case again its simply one single file. If we use more than one macro in our mod wed need to paste a path here.
so again

Code: Select all

<entry name="koha_macro" value="extensions\Koha\assets\units\size_s\macros\koha_macro" />
becomes

Code: Select all

<entry name="cubix_macro" value="extensions\cubix\assets\units\size_s\macros\cubix_macro" />

Ship XML and macro

Now we take a deep dive into X4 Foundations\extensions\cubix\assets\units\size_s and rename the ship_arg_s_scout_01.xml into cubix.xml and the SHIP_ARG_S_SCOUT_01_DATA.ANI into CUBIX_DATA.ANI
This is the ships waifu xml. its basically a description of what the ship consists of.
For now we will open it and change only line 3 and 4

Code: Select all

	<component name="ship_arg_s_scout_01" class="ship_s">
		<source geometry="assets\units\size_s\ship_arg_s_scout_01_data"/>
into

Code: Select all

	<component name="cubix" class="ship_s">
		<source geometry="extensions\cubix\assets\units\size_s\cubix_data"/>
the first one needs to be in sync with whatever we did in the components.xml and the second one refers to the folder we store our 3D data in.

moving on by opening the macro folder. First we rename ship_arg_s_scout_01_b_macro into cubix_macro
Now open the file and change line 4, 5 and 7.

Code: Select all

  <macro name="ship_arg_s_scout_01_b_macro" class="ship_s">
    <component ref="ship_arg_s_scout_01" />
    <properties>
      <identification name="{20101,10103}" basename="{20101,10101}" description="{20101,10113}" variation="{20111,1201}" shortvariation="{20111,1203}" icon="ship_s_fight_01" />
into

Code: Select all

  <macro name="cubix_macro" class="ship_s">
    <component ref="cubix" />
    <properties>
      <identification name="{999832,2}" basename="{999832,1}" description="{999832,3}" variation="{20111,2001}" shortvariation="{20111,1003}" icon="ship_s_fight_01" />
again, we correct the macro and component name to keep things in sync and we refer to the correct page ID for naming the cubix. if u choose to use a different page id u need to adjust here accordingly.
also i have no idea what variation and shortvariation does since i didnt bother with that yet. probably the Vanguard stuff


If u start ur game now u should see the mod in the manager
[ external image ]
and it should also appear ingame in an argon shipyard.
[ external image ]
Last edited by BrummBear02 on Sun, 7. May 23, 21:05, edited 25 times in total.
Gebt mir einen Spiegel dann schlage ich ihn mit seinem eigenen Gesicht

BrummBear02
Posts: 308
Joined: Fri, 3. Oct 08, 20:43
x3ap

Re: [WIP][Tutorial] Building your own ship out of existing and own parts

Post by BrummBear02 » Mon, 18. Feb 19, 23:28

Parts of a ship

Well. Now lets look at the different parts a ship consists of.
As we already learned from the Discoverer copy we made a ship consists of a component XML file, a macro file, a data folder and a .ANI file.
Lets take a closer look at the actual 3D model of our cubix which is stored inside the X4 Foundations\extensions\cubix\assets\units\size_s\cubix_data folder.
If we open it up in blender it looks like this. How to get it into blender comes later, for now keep reading.
[ external image ]

As we can see here the ship is split in different parts that make up the whole thing.
Im not really sure what the anim_ or detail_ there does since the airlock is also animated but stored as detail while the poslights are simply flashing and im not sure if that counts as animated.
Also some parts are more than simple 3D models. For example detail_xl_switch
[ external image ]

As you probably know its something you can interact with ingame while the hull of the ship isnt really interactive. in blender those parts are simple 3d meshes and their interactiveness is added later in the component XML

Then there are the different modules of a ship. Engine, weapons and shields. As you can see here they are missing because those are not part of the ships 3D model and also simply added via the component XML
[ external image ]

Now we will take a closer look at the parts itself.

[ external image ]

Each part consists of an 3D mesh and its corresponding collision mesh. The later is not needed anymore.
Each 3d mesh has a material and a texture assigned which are also in the name.


Outdated. Im just keeping this here in case i somehow need it in the future.
Spoiler
Show
The naming here is important but i cant really tell for sure how it works since i havent played around with it too much. Im guessing its something like this:
The capital X is a seperation and its important that its a Capital one.
lod0, lod1, lod2 and lod3 means level of detail. lod0 is, unlike one might think, the highest level of detail while lod3 is the lowest one. this is used to lower the load we put on our PC when the ship is far away and we dont need to render the thing in full detail since noone will be able to see it anyway.
[ external image ]
Also keep in mind that the bigger the ship the less parts it has.
an L or XL ship does not need for example landing gear, cockpit and airlocks. instead you just use the component XML to define a point where the game should add a pre-fabricated cockpid and landing pad.
and since docking is done differently and u cant walk near ur L ship and bump into it as station-walker it also doesnt need a exit.



What can be done and what cant be done

I dont really know when to talk about this one since its something that might kill your will to create a ship so we should talk about it from the get go
but if you are completely new to this youll need some knowledge to understand what we are talking about i guess. so i put it somewhere in the middle.


The Egosoft tools are still in development so this part might be outdated by the time you are reading this.


Anyway. In the past weeks we figured out quite a lot and can do just as much. im pretty sure X:rebirth modders knew at least half of what we learned the hard way and thats the sole reason im writing this.

Optical wise, meaning everything you can see ingame, there are almost no limitations. we can add, change or remove stuff freely.
Here is a picture of my Split Wolf ship i got ingame and actually working:
[ external image ]


Main guns, meaning those controlled by the player in the cockpit, can only face forward and can not be rotated. if done otherwise they show up in the shipyard ship building menue but when the ship is build they magically disappear into... idk, narnia probably.

Engines need to face backwards and cant be rotated along the Z or X axis. Y axis, meaning tilting, is possible afaik. Ive never tried.

And last the animations. While this is quite interesting and i got some things i would like to animate myself it cant really be done. There is some wonky binary edit way of making animations but ive never bothered with that so i cant talk about it. Some dude involved in the Star Wars mod is doing custom animations. Thats all i know.

There is a whole part on this tutorial reserved for animations because the Egosoft tools should be able to make animations some time in the future.
But as always we are not completely powerless here, even at the moment. We can change the mesh, and with that the ingame appearance of existing animations. We can also change the position of them via component XML

For example this is an early version of my Split Wolf and i changed the appearance of the Airlock here. I used the discoverer one and it sure doesnt look like it. the animation works perfectly fine.
[ external image ]
Last edited by BrummBear02 on Sun, 7. May 23, 21:21, edited 16 times in total.
Gebt mir einen Spiegel dann schlage ich ihn mit seinem eigenen Gesicht

BrummBear02
Posts: 308
Joined: Fri, 3. Oct 08, 20:43
x3ap

Re: [WIP][Tutorial] Building your own ship out of existing and own parts

Post by BrummBear02 » Mon, 18. Feb 19, 23:31

Choosing a ship fitting for our needs

This is a difficult one.
Earlier we learned what we can do and what we cant. So Choosing a ship that fits our needs means we need to take a look at the parts we cant really change.

Meaning mainly animations. Lets just take a look at different argon ships so it becomes clear what im talking about.


[ external image ]
The Discoverer has 3 Animations. Landing gear (1) Airlock (2) and Drone hatch, which also serves as docking bay for the space suit (3)


[ external image ]
The Nova has the docking bay here
[ external image ]
and then we can see the cockpit has an animation since the ship has no airlock, there is a ladder as usual and only one landing gear. (1) we can probably add more of those landing gears but im not sure about that.
also the engines are animated and rotate depending on our fly movements (2)


[ external image ]
The Kurier (dont know the english name but i think u know what ship this is) probably has the docking bay somewhere. an airlock with kind of a catwalk instead of a ladder (1) and an rotated landing gear (2)
also this one sports quite a lot of interior we can recycle.


[ external image ]
[ external image ]

And lastly the Elite which has the usual ladder and a small door on its side (1) as well as animated flaps which move depending on our fly movement (2)


So when choosing a ship as base for our new ship we should look at the animations and aim to pick one we dont have to change too much. Simply to save work. Also we can combine meshes of different ships we cant combine animations. if u want moving flaps youll have to pick the elite. if u want moving engines it has to be the nova.
Dont try to save time on this step and take a look at the ships of the other races as well. If id have to do my Wolf again id use the elite or a teladi fighter coz they fit the theme better.
What you can do, to combine animations, is turning a animation into a "component" and call that component in the ships component file similar to what we do with engines.
But if u wanna do that... im not going down that rabbit hole here.




Editing the mesh

Now starts the fun part. Well cant show u everything here, that would be way too much work and probably would not fit in 4 or 5 posts.

So open blender and delte the cube and the camera. Let the light be.
[ external image ]

Since we used the importxmf .BAT file earlier the .DAE files should already sit ready in our mod folder.
So we go File - Import - Collada
move your way to <Yoursteamfolder>\steamapps\common\X4Mod\assets\units\size_s\ and pick ship_arg_s_scout_01.dae
Double klick it or select it and press "Import COLLADA"
[ external image ]

Now we sale up the model to 1 so we can actually look inside without stuff vanishing. (If u press Numpad 5 stuff will also not vanish but u cant look inside ur mesh anymore)
[ external image ]

After this we get rid of the other lods since they will only bother us. instead of deleteing them you can also move them away. if u wanna keep them for whatever reason.
[ external image ]

now we wanna select the mesh we are going to edit. in this case its part_mainXlod0XgenericXgeneric_p1_hulltexture select it, then move your mouse back into 3d view and press "Numpad /"
this will hide everything thats not selected. Also press "Numpad ," to center your camera on your current selection.
[ external image ]

now press TAB to enter edit mode
With the middle mouse button you can rotate your camera. also the numpad provides you with a front, side and top view by pressing 1, 3 or 7. with 9 u invert it. for example top view becoms bottom view.
we are going to use the top view for now.
[ external image ]

short excursion: there are Verticles, which are points, edges which are.... edges? and faces which are the fiels between edges or Verticles. ull understand...
anyway, we need to turn of the limited selection so we can select stuff thats hidden behind faces
[ external image ]

Now press CTRL and drag a circle as shown. Pressing CTRL allows us to select multible things at once wihtout klicking all of them.
[ external image ]
[ external image ]

Now press DEL and select Verticles.
We ended up with this kind of mess:
[ external image ]
I turned on limited selection again so i dont see everything at once.

You can clean it up by selecting something you dont want and deleting the verticle or edge or face. depending on what you delete the result may vary. play around yourself a little.
Also remember that you can focus your camera on your selection by pressing "Numpad ," and rotate the camera freely by pressing the middle mouse button.
Scrolling zooms in and out. Keeping CTRL or Shift pressed and scrolling moves the camera sideways or upwards/downwards.
Also you can change your type of selection (shown inside the red box)
You can add connected things to your current selection by pressing "CTRL and Numpad +"
[ external image ]


After we cleaned the model we will add our new parts. As u might have guessed it will be a bunch of cubes.

To do that we select part_mainXlod0XgenericXgeneric_p1_hulltexture in Object mode and press Shift + D. This will create a exact copy of the whole mesh.
Now lets press the right mouse button to undo any transformations we might have done so the duplicated mesh stays in the same position as its original.
Enter edit mode by pressing Tab and then Press A and after that Del. select Verticles.

[ external image ]

This will select all and delete that to get a clean node that already has all the propertys we want.
We stay in part_mainXlod0XgenericXgeneric_p1_hulltexture.001 and go in edit mode. Also make sure you are in view mode Solid. Then we press Shift + A or select from the left Create - Cube.



We move the new cube to the side in any Position we like. Keep the cube selected and produce as many as u like to form a Wing. By using the snap tool we can make sure all is neatly alligned.
U can also add other shapes. Play around a little here. Fooling around is a great way to learn! Remember that transformations in Object mode get ignored so make them in Edit mode.
Also model only the right half. We will mirror it later.

[ external image ]

After we are done go to Object mode, select the newly created things in the Outliner and use a Modifier to mirror it to the other side.

[ external image ]

select the new mesh and while keeping shift pressed we select the old one. then we press Shift + J to join the all selected into the last selection.
Lastly we need to delete the lights. Just select it and press Del.

[ external image ]


Outdated
Spoiler
Show
Now lets get this into our game to look at what we have done. First create a folder "X4 Foundations\extensions\cubix\assets\units\size_s\Export"
Go File - Export - Collada. Change from Materials to UV Textures and uncheck "Use Blender Profile" i dont know what that actually does but it sounds suspicious.
Anyway, select the Export folder we just created and save it as cubix.dae.

Then run the ConvertBAT_export.bat we created when we started this tutorial. This will create a bunch of new folders. Navigate to "X4 Foundations\extensions\cubix\assets\units\size_s\Export\ship_arg_s_scout_01_data"
and since we only made changes to part_main-lod0 we also will only copy that one over into "X4 Foundations\extensions\cubix\assets\units\size_s\cubix_data"
say yes to overwrite.

Congratulations, you made your first changes to the Cubix.

[ external image ]
Last edited by BrummBear02 on Sun, 7. May 23, 21:34, edited 16 times in total.
Gebt mir einen Spiegel dann schlage ich ihn mit seinem eigenen Gesicht

BrummBear02
Posts: 308
Joined: Fri, 3. Oct 08, 20:43
x3ap

Re: [WIP][Tutorial] Building your own ship out of existing and own parts

Post by BrummBear02 » Mon, 18. Feb 19, 23:34

- Creating a Collision mesh for our ship


Now since we edited the looks of our ship the collision is completely off.
We are going to fix that now. To do that we need to pin down a collision mesh we can edit. Most of the time "anim_mainXcollision" or "part_mainXcollision" can be edited.

Since we are working with the Discoverer as a base we can edit the part_mainXcollision.
Now since we dont know what hinders us to edit some of the collision meshes we simply deactivate all the collision meshes in the waifu.xml by adding the tag "nocollision"
keep in mind to not add this tag to moving/animated things if u need them to have a collision. for example the ladder or the airlock.

[ external image ]

After we turned off all the collisions we dont need we are going to create a new one. They way we are going to do this is kind of "brute force" to knock out as much as possible error sources in one go.

First we select the existing "part_mainXcollision" then we press Tab, then A, then Del and then we select Verticles. That will delete everything inside but it leaves the node intact with material, offsets and all.
[ external image ]

Now we select every mesh we need a collision for and create a duplicate of it. Select it in Object mode, press Shift + D and then rightklick somewhere so u dont move this around and it stays at the exat same spot the original is. done.
In our case thats basically
"part_mainXlod0XgenericXgeneric_p1_hulltexture" and
"part_cockpitXlod0Xp1Xmultimat" and
"part_cockpitXlod0XgenericXgeneric_p1_hulltexture"


Now we got 3 new nodes

"part_mainXlod0XgenericXgeneric_p1_hulltexture.001" and
"part_cockpitXlod0Xp1Xmultimat.001" and
"part_cockpitXlod0XgenericXgeneric_p1_hulltexture.001"

Now we select the new nodes by keepig Shift pressend and klicking on them in the outliner and then we press CTRL + J to join them together.

[ external image ]

This leaves us with only one of the new nodes and an empty collision node. Select first the new node and then the empty collision node while keeping shift pressed. then again CTRL + J. it will always get joined inside the node we selected last.

Now we joined everything inside the collision node. That also includes materials, UV maps and vertex colours. We dont want that.

[ external image ]

So we go and remove all Materials other than "multimat" (leave that one alone since it was there in the beginning) UV maps and vertec colouring from the collision node.

[ external image ]
[ external image ]
[ external image ]

after that we export the model as .dae as we did before and run it through the converter. then we replace the existing part_main-collision.xmf with the newly generated part_main-collision.xmf...
magic happens and we got a matching collision to our edited ship.






- UV textures and vertex paint


Now we wanna add texturing to our model. To do that we need to go into "material" display. You can set it up so the textures also get displayed in solid display, ill comment on that later.

So the first thing we do is we switch into material mode.
[ external image ]


After this we need to add a light source or the whole thing will be black.
Make sure we are on Object mode and then press "Shift + A" and select Lamp - Hemi. This will add a hemispheric light. meaning its basically constant lighting from above if u dont rotate it. you can change its brightness my manipulating the energy value. you can also rotate it or add another one rotated by 180° to have light everywhere.
[ external image ]
[ external image ]


Now we are all set. So lets do dis.
First we need to select the mesh we wanna texture. In our case its the red box.
[ external image ]


Then we put Blender into UV editing.
[ external image ]


Now we select the whole mesh, still in edit mode, by pressing the "A" button. then we assign the .dds texture file we wanna use. keep in mind that u change the file u wanna use by editing the name of the node, not by just switching it here. This is only so blender displays it right.
[ external image ]


now we need to select the specific part we want to assigne a texture to. after thats done press "U" and select "Unwrap"
[ external image ]


As we can see now the UV map on the left does not match how it actually looks on the right. Thats because some verticles exist as doubles. This is usefull for Vertex colouring and sometimes also for UV mapping but in our case its bull. so we clean it up and remove the doubles.
[ external image ]


after that we go "U" and "Unwrap" again. voilà.
[ external image ]


The left red box shows selection mode, the right red box shows snapping mode and if snapping is on or off.
If the cursor is in the left part we can rotate by "R" scale by pressing "S" and move by pressing "G" just like in the normal edit mode. With "Shift + tab" we activate or deactivate snapping.
Now we press "A" to select all, if snapping is active we deactivate it by pressing "shift + tab"
rotate the mesh by 90° by pressing "R" and then typing 90 on the numpad. then move it in the general position show on the next picture and scale it down by pressing "S" and moving the mouse towards the UV mesh? idk how that thing is called. lets call it that.
[ external image ]


There is a shitload more to know about UV mapping. But there is at least another 3 shitloads of videos about it. Im bad at this myself so this is as far as ill explain it. but this should give you a rough idea of how its done and small changes can be done like that. texturing a whole ship is.... well. a lot of work.

If someone has nice and usefull tips on this topic im thankfull for them
Last edited by BrummBear02 on Mon, 27. May 19, 20:54, edited 5 times in total.
Gebt mir einen Spiegel dann schlage ich ihn mit seinem eigenen Gesicht

BrummBear02
Posts: 308
Joined: Fri, 3. Oct 08, 20:43
x3ap

Re: [WIP][Tutorial] Building your own ship for dummies

Post by BrummBear02 » Mon, 18. Feb 19, 23:38

-fourth. one to go-

Spoiler
Show
Spoiler
Show
@MacBain just looked into the details of the used textures. try this in the libraries/material_library.xml (THIS IS JUST A GUESS INTO THE BLUE!!!)
<diff>
<!-- replacing Original Shader "XU_surface_test.fx" with currently used "P1_complex_surface.fx" for Argon legacy Textures-->
<replace sel="/*/collection[@name='argon']/material[@name='ar_hulls_01']/@shader">P1_complex_surface.fx</replace>
<replace sel="/*/collection[@name='argon']/material[@name='ar_hulls_02']/@shader">P1_complex_surface.fx</replace>
</diff>

MacBainheute um 22:27 Uhr
but will this not replace all textures for argon?

UniTraderheute um 22:27 Uhr
nope. this will replace the shader used and only that.
note the @shader at the end of the path

MacBainheute um 22:27 Uhr
i try it out

UniTraderheute um 22:28 Uhr
the rest is just to locate the correct shader value to replace

MacBainheute um 22:28 Uhr
but i dont understand it ^^

UniTraderheute um 22:28 Uhr
(note: this is basically ready to use - just create said file and then copypaste)
Spoiler
Show
here https://www.freeformatter.com/xsl-transformer.html
put xml of your component file and in 2nd textarea put XSL

moves every connection without parent. also doesn't move connections which don't have coordinates at all. just change value of select="(.+1000) to whatever value you want to for x, y and z. It works

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs">

<!-- attributes -->
<xsl:template match="@*">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
<xsl:template match="*/connection[not(@parent)]/offset/position/@x">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="(.+10)"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="*/connection[not(@parent)]/offset/position/@y">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="(.+100)"/>
</xsl:attribute>
</xsl:template>
<xsl:template match="*/connection[not(@parent)]/offset/position/@z">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="(.+1000)"/>
</xsl:attribute>
</xsl:template>

<!-- elements -->
<xsl:template match="*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>

</xsl:stylesheet>

multible meshes attached - cleanup(delete loose) needed
multible meshes can also mean you have multible materials attached. also the converter really dislikes things like hulltexture.001
expected cood texture thingy - UV map linked, need unlink / in blender 3.0 unclear. try to delete material from node. same meshid or colorid on different meshes?
you cant have the same meshid or colorid on different meshes.


L & XL

<connection name="con_cockpit" - Position of the Bridge

Last edited by BrummBear02 on Tue, 4. Oct 22, 00:29, edited 8 times in total.
Gebt mir einen Spiegel dann schlage ich ihn mit seinem eigenen Gesicht

BrummBear02
Posts: 308
Joined: Fri, 3. Oct 08, 20:43
x3ap

Re: [WIP][Tutorial] Building your own ship for dummies

Post by BrummBear02 » Mon, 18. Feb 19, 23:39

- Troubleshooting


Common errors when converting

Node part_detailXlod0XgenericXgeneric_p1_hulltexture has multiple meshes attached
Last edited by BrummBear02 on Tue, 28. May 19, 18:47, edited 1 time in total.
Gebt mir einen Spiegel dann schlage ich ihn mit seinem eigenen Gesicht

StormMagi
Posts: 1335
Joined: Sat, 17. Mar 07, 03:53
x4

Re: [WIP][Tutorial] Building your own ship for dummies

Post by StormMagi » Tue, 19. Feb 19, 03:24

Oh sweet. I am very much looking forward to this!
MOD XR Show Skills

Flying spaceships since 1993.

sco1981
Posts: 282
Joined: Fri, 14. Sep 18, 14:47
x4

Re: [WIP][Tutorial] Building your own ship for dummies

Post by sco1981 » Tue, 19. Feb 19, 08:25

Looks good so far. :thumb_up:
Keep up the good work!

BrummBear02
Posts: 308
Joined: Fri, 3. Oct 08, 20:43
x3ap

Re: [WIP][Tutorial] Building your own ship for dummies

Post by BrummBear02 » Tue, 19. Feb 19, 20:36

StormMagi wrote:
Tue, 19. Feb 19, 03:24
Oh sweet. I am very much looking forward to this!
Well, glad to make u excited. Tell me if u have ideas to improve this. Formatting and colouring will be done when its finished.
sco1981 wrote:
Tue, 19. Feb 19, 08:25
Looks good so far. :thumb_up:
Keep up the good work!
thanks. i actually added another part today :D
Gebt mir einen Spiegel dann schlage ich ihn mit seinem eigenen Gesicht

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Re: [WIP][Tutorial] Building your own ship for dummies

Post by MegaJohnny » Tue, 19. Feb 19, 20:43

Thanks so much for all the detail you've put in! I've had thoughts about tinkering with ship models, and this will no doubt make it much easier to get into.

sco1981
Posts: 282
Joined: Fri, 14. Sep 18, 14:47
x4

Re: [WIP][Tutorial] Building your own ship for dummies

Post by sco1981 » Tue, 19. Feb 19, 21:02

BrummBear02 wrote:
Tue, 19. Feb 19, 20:36
Also keep in mind that the bigger the ship the less parts it has. klingt blöd, is aber so.
:D

BrummBear02
Posts: 308
Joined: Fri, 3. Oct 08, 20:43
x3ap

Re: [WIP][Tutorial] Building your own ship for dummies

Post by BrummBear02 » Sat, 23. Feb 19, 01:38

MegaJohnny wrote:
Tue, 19. Feb 19, 20:43
Thanks so much for all the detail you've put in! I've had thoughts about tinkering with ship models, and this will no doubt make it much easier to get into.
glad to hear you find it usefull. please tell me if u tried to follow this and everything worked out for you.

Also i added another part. editing the model itself will probably come tomorrow.
Gebt mir einen Spiegel dann schlage ich ihn mit seinem eigenen Gesicht

Cg089
Posts: 80
Joined: Fri, 18. Jan 19, 19:25
x4

Re: [WIP][Tutorial] Building your own ship for dummies

Post by Cg089 » Sat, 23. Feb 19, 21:20

Hi guys,

(Hopefully) a unicorn here. I managed to find source code for arc_'s old x rebirth converter (which had disappeared due to dropbox automatically closing inactive accounts, ugh) courtesy of a thread on the X4 reddit I came across, which got it from someone on Discord. I'm looking into why the converter has issues, I think it'd be awesome if we could add animations. Unfortunately, arc_'s code, while it seems to be reasonably well written, has no tests. So I need to add some. And the libraries are several years out of date. But I'm cautiously optimistic, since he had (apparently) a basically flawless converter for X rebirth, and I'd guessing the X4 foundations file format is mostly the same (with some tweaks or additions which are causing problems). I'll let you guys know how it goes.

StormMagi
Posts: 1335
Joined: Sat, 17. Mar 07, 03:53
x4

Re: [WIP][Tutorial] Building your own ship for dummies

Post by StormMagi » Sat, 23. Feb 19, 22:39

Cg089 wrote:
Sat, 23. Feb 19, 21:20
Hi guys,

(Hopefully) a unicorn here. I managed to find source code for arc_'s old x rebirth converter (which had disappeared due to dropbox automatically closing inactive accounts, ugh) courtesy of a thread on the X4 reddit I came across, which got it from someone on Discord. I'm looking into why the converter has issues, I think it'd be awesome if we could add animations. Unfortunately, arc_'s code, while it seems to be reasonably well written, has no tests. So I need to add some. And the libraries are several years out of date. But I'm cautiously optimistic, since he had (apparently) a basically flawless converter for X rebirth, and I'd guessing the X4 foundations file format is mostly the same (with some tweaks or additions which are causing problems). I'll let you guys know how it goes.
Have you talked to sco1981 or Ojump? They have been working on importing X Rebirth ships and might be able to help.
MOD XR Show Skills

Flying spaceships since 1993.

Cg089
Posts: 80
Joined: Fri, 18. Jan 19, 19:25
x4

Re: [WIP][Tutorial] Building your own ship for dummies

Post by Cg089 » Sat, 23. Feb 19, 23:10

I haven't; I should & will a bit later, I'm killing time before a flight right now. I suspect they manually fixed their XML files, which is unfortunately likely completely unavoidable with porting ships from X Rebirth; the modules or whatever you want to call them just weren't there, so there's no way to just reconstruct them from scratch. But yeah, I should definitely get in touch with them, this work might come in handy for them.

Good news - I got the tool to build from source and it seems to work the same as it did.

More good news - I'm not sure the xmf format has actually changed whatsoever (it may have, I haven't really checked yet). It may be that the main problem is that new stuff in the XML files is ignored when making the .dae, and thus when converting back from .dae to .xmf, important stuff gets lost. For instance, the mounts for the engines etc get broken, hence crashes. Lots of stuff in "tag" attributes gets lost for instance. The Paranid Scout, for instance, goes from being a 78 KB xml to 22 KB xml. So it's no wonder everything breaks.

Also, while I bought it on sale, I skipped actually installing or playing X Rebirth. If there are any assets people can identify for me that exist in both (mass traffic?), that would be super helpful. Seeing what changed between the two XML files and seeing whether the .xmf files have actually changed at all would be the best resource (short of the devs actually being allowed to give us documentation, anyway - I blame the lawyers).

Also, BrummBear02, I hope it's ok with you that this discussion is happening in this thread - if you'd rather I make a separate thread for discussing this stuff, I'm happy to. But your post piqued my interest about the animation issues, and you seemed interested in it, so I thought posting here was probably wise.

StormMagi
Posts: 1335
Joined: Sat, 17. Mar 07, 03:53
x4

Re: [WIP][Tutorial] Building your own ship for dummies

Post by StormMagi » Sat, 23. Feb 19, 23:47

I haven't seen ANY X:R assets apart from potentially some station modules in X4. I just uninstalled X4 (due to other...issues, not going to derail topic though). I can hit up X:R and pull a list of station modules later tonight though.
MOD XR Show Skills

Flying spaceships since 1993.

BrummBear02
Posts: 308
Joined: Fri, 3. Oct 08, 20:43
x3ap

Re: [WIP][Tutorial] Building your own ship for dummies

Post by BrummBear02 » Sun, 24. Feb 19, 00:05

well i dont really care. and you guys discussing here keeps my post up so im kinda thankfull ;)

also i ported the split raptor from X rebirth to X4 and had to add most connections myself. i wonder why people ignore me on that. in fact only the assembly of the mesh stays the same, like coods of the different nodes from blender. thats because of weapons, docking bays, cockpits got all handled differently in X:R. mostly there were none.


X4 Connections:

<connection name="con_playercontrol" tags="playercontrol">
<connection name="con_weapon_01" tags="weapon large standard arg_destroyer_01 ">
<connection name="con_storage01" tags="storage ">
<connection name="con_cockpit" tags="cockpit cockpit_visible">

this one actually just refers to the macro file
<connection ref="con_cockpit">
<macro ref="bridge_arg_xl_01_macro" connection="con_cockpit" />
</connection>


<connection name="con_engine_01" group="group_back_engine " tags="engine large ">
<connection name="con_countermeasures_002" tags="countermeasures ">
<connection name="con_shieldgen_xl_XL-shield-template_3" tags="extralarge shield hittable">
<connection name="con_dockarea_arg_s_ship_03" tags="dockarea">
<connection group="turret_large_front" name="con_l_turret_left-top-bat-1_1" tags="turret large standard hittable">

while the X:R connections look like this

[ external image ]
Gebt mir einen Spiegel dann schlage ich ihn mit seinem eigenen Gesicht

Cg089
Posts: 80
Joined: Fri, 18. Jan 19, 19:25
x4

Re: [WIP][Tutorial] Building your own ship for dummies

Post by Cg089 » Sun, 24. Feb 19, 02:47

Ok, that lines up with what I thought.. I read your post, but clearly my brain is a bit fried as of late lol. It's possible there are changes in the .xmf format too, but I wouldn't be surprised if a big part of this is just xml. But the fact you didn't need to mess with the xmf to get it to work suggests that if they changed the format, they added to it rather than removed or changed it. Since the converter doesn't expect this other xml stuff it just ignores it. That's at least part of why putting stock ships back and forth breaks things, I think... It basically splits out junk for the new ships xml. Animations are probably a factor too, not sure... I'll look into it more.

Cg089
Posts: 80
Joined: Fri, 18. Jan 19, 19:25
x4

Re: [WIP][Tutorial] Building your own ship for dummies

Post by Cg089 » Sat, 2. Mar 19, 04:19

Quick update on progress - unfortunately not too much to show, but some good progress nonetheless.
Managed to source the original description of the binary format that arc_ reverse engineered (before he even put together the converter I believe) that appeared to be lost. This is nice since it gives me essentially the specification which arc_'s implementation was built for, and I will probably write a quick program to validate whether there is anything that X4's files does which doesn't align with the specification.

Many thanks to the wonderful TargetLost (who you may remember from his great X Rebirth converter stuff from before arc_ showed up and performed a miracle, not to mention his awesome blender renders of X Rebirth models) for digging through his hard drive and finding them for me. Honestly, I'm impressed he was able to dig them up in short order given how long ago it was, and he had all 4 - I'll put them up at some point (probably on github or similar so that they never vanish again). Consider this your daily reminder to backup your data well - you never know what random stuff you worked on years ago might be relevant years later. And yes, the internet never forgets when you want it to, but it can forget if basically nobody cares.

If anyone is interested in the info on the character models, those are included in that info dump (though arc_'s converter may be working properly anyway - no clue honestly).

Haven't figured out whether I'm going to write the converter from scratch or work off of arc_'s converter or what. I'll try to find some time to work on it this weekend.
My current priority list (open to input here though):
  1. Check format against actual files
  2. Decide best way to implement things (arc_'s converter vs from scratch)
  3. Handle new XML stuff - e.g. a valid x4 file should go thru the converter and back with no significant changes resulting (ideally, identical files, but failing that, equivalent).
  4. See if I can figure out why collision meshes are so finicky
  5. See if I can figure out animations

Cg089
Posts: 80
Joined: Fri, 18. Jan 19, 19:25
x4

Re: [WIP][Tutorial] Building your own ship for dummies

Post by Cg089 » Sun, 3. Mar 19, 23:20

Hey BrummBear, got a link to the Discord Server I've heard so much about? got some questions about the collision mesh stuff you discussed in the post.

Post Reply

Return to “X4: Foundations - Scripts and Modding”