How to create a custom dock
This tutorial will explain how to make external docking point for a ship. The same technique can be used to make internal dock (hangar).
What you will need:
- have previous experience with graphics (ship) modding
- understand to scenes and DBOX2
- understand to Dummies.txt
How docking works
In its simplest form, there are only four things you must do in order to create a custom dock in X3:
- First, you must create an object (body) which will act as a placeholder for your dock. If your dock is to have physical properties once it is rendered in-game, then the body should be correctly sized and shaped. This will help you to correctly position the dock in your ship or station scene. However, it is important to remember that this body will not become part of the actual scene in X3...it is simply a dummy part (e.g. placeholder).
- Second, you will need to create a docking scene which contains one or more special docking point bodies. These special bodies are predefined in Bodies.txt, and have meaning to the X3 game. They are used to define the specific point and orientation at which a ship will be physically docked. The docking scene can include physical mesh objects and textures that will be rendered in the game. Further, these objects can be animated in the same way as any other part (like the motion of the docking arms you see on stations).
- The next step is to use your favorite text editor, and add a new entry into the Dummies.txt which will perform the actual mapping of your placeholder object (from step 1) to the scene you created in step 2. This is also the place where you can set additional properties for the dock, such as the action you want the X3 engine to take when you un-dock a ship.
- Finally, you will position the placeholder object into your actual ship or station scene that you will eventually export into X3.
The game will do the following magic for you:
- X3 will find your placeholder object in the ship scene, and recognize it as a special part (by finding it in in the Dummies file).
- It will automatically replace the dummy placeholder with the actual docking scene that you created, and subsequently defined in the entry you added to the Dummies file.
- Once you are actually playing the game, the physical landing and launch positions for a ship will be determined by the special docking bodies that you included in your docking scene in step 2, above.
Explanation of existing docking schemes
This will explain how station docking and carrier docking works.
All carriers have landing and launch bays. If you import an M2 class ship (such as the Argon Colossus - objects\ships\argon\argon_M1_scene.bod), you can see that there is body named 19027 located at the place where the landing bay is found on the ship when you see it in X3.
The placeholder object, 19027 (stations\docks\dockCarrier_scene_dummy) is mapped via an entry in the Dummies file to a docking scene 9014 (stations\docks\DockCarrier_scene), which is where the physical parts of the docking bay are defined, and which contains the special docking body for a fighter-class ship.
If you import the stations\docks\DockCarrier_scene file with DBOX2, you will see that it contains three bodies named 535. Those are recognized by the X3 game as the docking point - this is defined in Bodies.txt.
Launch bays are marked with body 19026 which is an alias for stations\docks\dockCarrier_quicklaunch_scene_dummy.
In the Dummies file, there is an entry for 19026 (stations\docks\dockCarrier_quicklaunch_scene_dummy) which maps it to the docking scene 9013 (stations\docks\DockCarrier_quicklaunch_scene), which again contains the special docking body 535 to define the physical docking point used for the launch.
As a point of interest, if you will take a moment to analyze the Dummies file in your text editor you will notice that the entries for the 19027 and 19026 parts also contan a number of flags. These are used by X3 to define the actions that should be taken when a ship docks or undocks. We can see the 19027 part uses the HANGAR & LANDONLY flags, while the 19026 part has the QUICKLAUNCH & STARTONLY flags. These flags tell X3 that the 19027 part is only used for landing, and that it is to remove your ship into the HANGAR when you reach the 535 docking point. In the same way, X3 knows that the 19026 part can only be used for launching ships, and to spawn your ships at speed (QUICKLAUNCH) to get them away from the ship quickly when you undock.
Stations mostly use the docking arms. If you look at some station scene (for example objects\stations\station_scenes\tech\argon_tech_S_missile_F_scene.bod) you can see that it contains body 19022 which is alias for stations\docks\dock5portsdummy.
- Note: Do not import the station scene with DBOX unless you are really patient. It may take about 5 minutes to load.
19022 (stations\docks\dock5portsdummy) is mapped via record in Dummies file to scene 9008 (stations\docks\dock5portsscene).
stations\docks\dock5portsscene contains body 19023 which is alias for stations\docks\dock5ports_arm_dummy.
19023 (stations\docks\dock5ports_arm_dummy) is mapped via record in Dummies file to scene 9010 (stations\docks\dock5ports_arm_scene) which contains three docking points:
- 535 - docking point for small ships
- 10495 - docking point for standard ships
- 10496 - docking point for huge ships
How to create a custom dock
First you will need to create the dock scene. Because we are making just a simple external dock, similar to those used on M6 ships in X2, we will just put a single body into the scene - the docking point 535.
- Run 3ds Max and open DBOX2
- import the body objects\v\535.bod
- export the object as scene. Name it objects\ships\ext_docking_scene
- export the 535 object again, this time as body. Name it objects\ships\ext_docking_dummy
Now you have both the dummy object and the real scene. Although they are in fact the same in this example, you should already understand from the previous explanation how it works.
The final step is to create new entry in the Dummies.txt.
Add the following line to the SDTYPE_ANIMATED section:
Do not forget to increase the record count! - the number immediately after the
SDTYPE_ANIMATED; (there are 5 entries as of X3 ver. 1.43)
Now you just have to add the objects\ships\ext_docking_dummy body into your ship scene:
- create new scene in 3ds Max and import scene of some M6 ship (for example the Split Dragon - objects\ships\split\split_m6_scene.bod)
- import the ships\ext_docking_dummy body - don't forget to correctly name it! (ships\ext_docking_dummy)
- position the body where you want the dock to appear
- export the scene
Now you must also modify the TShips.txt and change the Docking slots property to 1.
At this moment you should have a ship which can externally dock a fighter class ship (M3, M4, M5).
Requirements for ships
In order for the docks to work, the ship must comply to following:
- the ship class must be:
- the ship class description must be:
- 2032 (TL)
- 2021 (M1)
- 2022 (M2)
- 2026 (M6) - this is the only one really tested by me - Doubleshadow
The original content of this article was imported from DeadlyDa and doubleshadow's X-Wiki.