Short engine modding tutorial
Posted: Sun Dec 31, 2006 11:15 am
This is a short and quick (and rough) guide to how to create new engines. This deals only what is needed to do to make a new engine. I will not talk about unpacking or repacking PK4 or what is possible to do with the skin files.
Disclaimer! English is not my first language (actually not even second), and thus I make a lot of mistakes and sometimes even forgot words from the sentences. If this makes the document hard or confusing to read, I can only humbly request that please ask additional questions. Also I will not deal with the Hexediting issue as I hope that someone more familiar with hexedit than me could elaborate these.
NOTE! Please study Pjay’s data files, as this document expects you to be familiar with his work. Also I suggest that when you test new engines, open the game in windowed mode. This way eventual crashes are recoverable and you get an error message, which may give hints on what went wrong.
Essentially three things are needed to make a new locomotive. 1. Hexediting .lco and .car files. 2. Acquiring and renaming .3dp files 3. Skin texture and beauty shot and profile files.
1. So that the game would recognise new loco 3D and skin files, it is needed to edit .lco and .car files. (These can be find in EngineTypes subfolder) It is possible to create separate ids (names) for Engine files, 3D files and skin files, but it is not really needed and a single common id is enough. (causes less confusion) Poptop uses letter L to signify files belonging to locomotive and letter T with files associated with tender. After the final L or T letter there must be a 00 in byte form (not as a text string). This way program knows that the name ends. NOTE! Double 0 must be after all text strings, otherwise funny things happen.
For example, if one wants to make a TGV model, a good id would be TGVL, and it would be ok to name new files as TGVL.lco, TGVL.car and TGVT.car (if needed).
.lco files are easier to edit as only one string is needed to change. It is line 004 and a text string. This id is needed to be same than 3D file name (.3dp), but if you are using universal id, there will be no problems.
.car carries more information. Line 012 is the name, which appears in the game. Thus it can be longer and more complicated than the id. Line 072 is id for .lco and .car file name. Thus it must be same than the newly named .lco and .car files. Line 132 is id for 3D files (.3dp) and line 162 (left out from Pjay’s list) is id for skin files. (As mentioned above these ids could be different, but using same one for all doesn’t hurt.) (I will talk about the profile id at the end)
For example, line 012 could be something like “Train de Gran Vitesse†and lines 072, 132 and 162 could be TGVL.
If a tender (or a second engine) is required, then a tender .car file is needed too. The same principle than above is used, with a new id. (For example TGVT) The game (probably) skips most of the lines, so for tender only lines 072, 132, 162 and 268 (tender weight) are needed to be filled.
(Using tender files, it is possible to create a modern double-headed engine. Only thing needed is a double set of the 3D and skin files, and also that the second unit (tender) has hex 004 to set byte number 03. (set it as a tender)
2. To create new engines individual .3dp files are needed. These are included in packed game data files and needed to be unpacked before to be accessible. The required engine data files are in Data folder. Rt3_3DPF.PK4 has the original engine files and rt3_Expansion.PK4 includes coast-to-coast engines. A modern diesel engine could have only about half-dozen .3dp files, but a steam engine could have over 20 separate files.
For a new engine, the required files are copied and renamed. (same as .car file line 132 id) For example, making a TGV, only thing is needed is renaming EurostarL.3dp files as TGVL.3dp.
It is possible leave out some .3dp files and mix files from other engines. The easiest and perhaps most useful is to introduce a new type of tender from another engine. Also it is possible to take away some lights or introduced new types of wheel. (setting the texture file for foreign wheels is complicate and I will not deal it in this document. However, Pjay’s has files, which give all the needed information) NOTE! If some lights (or wheel etc.) are removed, those remaining must be renumbered so that there aren’t any gaps on the numbering. (If there is a gap, the game will stop looking for additional files.)
3. Finally new skin texture files are needed. While the game uses .dds picture file type, it is possible to use .tga picture files. .dds uses less memory and it is possible to use Coast-to-coast expansion pack’s skin converter to create these dds files. This requires unpack PK4 trainskin file and picking up needed files. (I personally don’t like the dds compression and I use tga files)
To save memory the game uses a number of smaller skin pictures. So if you don’t convert skin files to dds, you must make 50% smaller copies of tga picture and name these as xxx_A.tga, xxx_B.tga etc. (Five is usually enough) The name id must match with .car file line 162. For example, TGV would have from TGVL_A.tga … to TGVL_E.tga.
It is possible to alter loco’s look, by making areas transparent using the Alpha channel. The Alpha channel is also used making the window and light’s nighttime glow.
The profile view is created using C2C Trainskin conventor. When converted PK4 file is unpacked, files XXX_Profile.imb and XXX_Profile_A.dds are needed. Imb file can be used as it is and this name is to be written in .car file line 192. (As it is, XXX_Profile.imb). For example, TGV_Profile.imb. No changes are needed to dds file.
The beauty shot can be created with same conversion. Needed files are XXX_BeautyShot.imb, and XXX_BeautyShot_A.dds etc. The difference is that the name id is not written in .car file. The .imb file name is changed to XXX_NE.imb (XXX is line 132 in .car file/universal id) For example, TGVL_NE.imb. Dds file are not needed to be changed, anything came from the conversion is useful as it is already written in .imb file.
(It is possible to use original profile and beautyshot files. Profiles are included in three large pictures and .car file line 252 id number is used to identify right profile. (This is not needed when making new separate profiles) Beautyshot are needed to be renamed same way than converted pictures.)
I probably left out or forgot a lot, but using this guideline a new engine should be able to be created. Please comment if something is missing or is confusing. There is still so much that I don’t know myself. In principle the same process can be used to create new buildings, industries, cargoes and wagons.
Disclaimer! English is not my first language (actually not even second), and thus I make a lot of mistakes and sometimes even forgot words from the sentences. If this makes the document hard or confusing to read, I can only humbly request that please ask additional questions. Also I will not deal with the Hexediting issue as I hope that someone more familiar with hexedit than me could elaborate these.
NOTE! Please study Pjay’s data files, as this document expects you to be familiar with his work. Also I suggest that when you test new engines, open the game in windowed mode. This way eventual crashes are recoverable and you get an error message, which may give hints on what went wrong.
Essentially three things are needed to make a new locomotive. 1. Hexediting .lco and .car files. 2. Acquiring and renaming .3dp files 3. Skin texture and beauty shot and profile files.
1. So that the game would recognise new loco 3D and skin files, it is needed to edit .lco and .car files. (These can be find in EngineTypes subfolder) It is possible to create separate ids (names) for Engine files, 3D files and skin files, but it is not really needed and a single common id is enough. (causes less confusion) Poptop uses letter L to signify files belonging to locomotive and letter T with files associated with tender. After the final L or T letter there must be a 00 in byte form (not as a text string). This way program knows that the name ends. NOTE! Double 0 must be after all text strings, otherwise funny things happen.
For example, if one wants to make a TGV model, a good id would be TGVL, and it would be ok to name new files as TGVL.lco, TGVL.car and TGVT.car (if needed).
.lco files are easier to edit as only one string is needed to change. It is line 004 and a text string. This id is needed to be same than 3D file name (.3dp), but if you are using universal id, there will be no problems.
.car carries more information. Line 012 is the name, which appears in the game. Thus it can be longer and more complicated than the id. Line 072 is id for .lco and .car file name. Thus it must be same than the newly named .lco and .car files. Line 132 is id for 3D files (.3dp) and line 162 (left out from Pjay’s list) is id for skin files. (As mentioned above these ids could be different, but using same one for all doesn’t hurt.) (I will talk about the profile id at the end)
For example, line 012 could be something like “Train de Gran Vitesse†and lines 072, 132 and 162 could be TGVL.
If a tender (or a second engine) is required, then a tender .car file is needed too. The same principle than above is used, with a new id. (For example TGVT) The game (probably) skips most of the lines, so for tender only lines 072, 132, 162 and 268 (tender weight) are needed to be filled.
(Using tender files, it is possible to create a modern double-headed engine. Only thing needed is a double set of the 3D and skin files, and also that the second unit (tender) has hex 004 to set byte number 03. (set it as a tender)
2. To create new engines individual .3dp files are needed. These are included in packed game data files and needed to be unpacked before to be accessible. The required engine data files are in Data folder. Rt3_3DPF.PK4 has the original engine files and rt3_Expansion.PK4 includes coast-to-coast engines. A modern diesel engine could have only about half-dozen .3dp files, but a steam engine could have over 20 separate files.
For a new engine, the required files are copied and renamed. (same as .car file line 132 id) For example, making a TGV, only thing is needed is renaming EurostarL.3dp files as TGVL.3dp.
It is possible leave out some .3dp files and mix files from other engines. The easiest and perhaps most useful is to introduce a new type of tender from another engine. Also it is possible to take away some lights or introduced new types of wheel. (setting the texture file for foreign wheels is complicate and I will not deal it in this document. However, Pjay’s has files, which give all the needed information) NOTE! If some lights (or wheel etc.) are removed, those remaining must be renumbered so that there aren’t any gaps on the numbering. (If there is a gap, the game will stop looking for additional files.)
3. Finally new skin texture files are needed. While the game uses .dds picture file type, it is possible to use .tga picture files. .dds uses less memory and it is possible to use Coast-to-coast expansion pack’s skin converter to create these dds files. This requires unpack PK4 trainskin file and picking up needed files. (I personally don’t like the dds compression and I use tga files)
To save memory the game uses a number of smaller skin pictures. So if you don’t convert skin files to dds, you must make 50% smaller copies of tga picture and name these as xxx_A.tga, xxx_B.tga etc. (Five is usually enough) The name id must match with .car file line 162. For example, TGV would have from TGVL_A.tga … to TGVL_E.tga.
It is possible to alter loco’s look, by making areas transparent using the Alpha channel. The Alpha channel is also used making the window and light’s nighttime glow.
The profile view is created using C2C Trainskin conventor. When converted PK4 file is unpacked, files XXX_Profile.imb and XXX_Profile_A.dds are needed. Imb file can be used as it is and this name is to be written in .car file line 192. (As it is, XXX_Profile.imb). For example, TGV_Profile.imb. No changes are needed to dds file.
The beauty shot can be created with same conversion. Needed files are XXX_BeautyShot.imb, and XXX_BeautyShot_A.dds etc. The difference is that the name id is not written in .car file. The .imb file name is changed to XXX_NE.imb (XXX is line 132 in .car file/universal id) For example, TGVL_NE.imb. Dds file are not needed to be changed, anything came from the conversion is useful as it is already written in .imb file.
(It is possible to use original profile and beautyshot files. Profiles are included in three large pictures and .car file line 252 id number is used to identify right profile. (This is not needed when making new separate profiles) Beautyshot are needed to be renamed same way than converted pictures.)
I probably left out or forgot a lot, but using this guideline a new engine should be able to be created. Please comment if something is missing or is confusing. There is still so much that I don’t know myself. In principle the same process can be used to create new buildings, industries, cargoes and wagons.