SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH4 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 07-08-10, 07:06 PM   #1
Kaoru
Bilge Rat
 
Join Date: Jul 2010
Posts: 1
Downloads: 5
Uploads: 0
[TEC] Upgrade-Modding Question, Help Appreciated!

Warning! Wall of text. Actual question cleanly-stated at end, all else is information on where I'm coming from, what I already know, etcetera. Much of this also doubles as a bit of a technical guide to the filestructure of the game, and how much of the technical data in the game fits together. Thus, the [TEC] tag.

Hey, there! A little background on me - skip this first paragraph if you just want the question, thanks! I'm a relatively-new Silent Hunter 4 player - first heard about this great series as a result of someone mentioning the JSGME-program over on the Paradox forums as something created for this craaaazy game called Silent Hunter 3. That was years ago, though - I was recently browsing through my old games, came across Aces of the Deep, which I greatly enjoyed, and couldn't get it to work on Vista. Looked for a more modern update, or sub game, and..well. Here I am!

I've been playing for about three weeks now, I think. Looked into quite a few mods (I'm currently playing with a self-modified homebrew of Webster's GFO, and a few aesthetic mods, with the Ship Pack 1) - looking to get through a vanilla campaign before I jump into anything like Operation Monsun, or TMO+RSRD. In the interim, though, I've been doing a few mods of my own to make the game both more rewarding, and more challenging. As part of that, I'm looking to add a few more (reasonably-priced and spaced) upgrades for the in-game subs, mayhap not perfectly matched to historical specifications, but really, not too outlandish. (If you consider upgrading things like the battery and the electric motors 'not too outlandish', I suppose.)

Here's what I know thus far, thanks to various tutorials, and fiddling around with things: The "Equipment.upc" contains the plaintext reference for all components of a submarine (except weapons, covered in "Weapons.upc.") This file is referenced by the various submarine "UnitParts" files, the "UpgradePacks" files, and the assorted "NSS_<Classname>.upc" files.

The UnitParts files are pretty exclusively for conning tower upgrades, from what I've seen, and contain data about the various data that's exclusively associated with these parts (AA Gun slots on each model, crew-quarters and slots, etcetera.) The "NSS_<Classname>.upc" files contain the actual static data for the submarine, a full accounting of all their possible upgrade-slots, potential upgrade-types, compartment information, and the like. The separation is obviously (at least in part) a coding 'trick' to allow the game, instead of the player, to determine when new conning towers are upgraded to, while the player still has the opportunity to upgrade weapons and electronics. Simple enough.

The "UpgradePacks" are the most transparent of the group. They're just conceptual 'purchasable' groupings of 'parts' or elements that can be assigned to specific upgrade-slots, defined either in the NSS-files or the UnitParts files. Here's where I ran into some difficulty, though.

All of the UpgradePacks reference an entry either in Equipment.upc or in Weapons.upc, from what I can see. But very obviously, there's no actual data about the capabilities of the various elements in these files. All of that data is in the Library directory, under "USSubParts" or "GerSubParts". (For reference, I have S3D, I've looked through these files and am slowly getting a handle on them.) All data on (for the guns) damage, ammunition and the like is contained in these files (along with, obviously, render and model data) and (for the sensors) range, efficiency, capabilities, etcetera. For the Germans, coating-and-decoy data is also contained here.

Both "Equipment.upc" and "Weapons.upc" have links into these library files using the various "ExternalLinkName3D" lines. In particular, the .dat files (which seem to contain the internal IDs referenced by the game) and the .sim files (which have parent-nodes in the .dat files, and define the actual behavior of the component, be it a coating, a decoy launcher, a hydrophone, radar or sonar.)

Still with me? Good!

Now, then. My question is as follows:
In order to implement, say, upgrades for the battery, I would have to take the following steps, yes?
1. Add two extra entries to the bottom of the proper nationality's "Equipment.upc" files, and modify the two current ones for batteries, in the vein of, perhaps,
Code:
[Equipment 7]
ID=GatoSternBatteryBasic
NameDisplayable= Batteries (Stern)
FunctionalType= EqFTypeBatteries
EquipmentInterval= NULL, NULL
EquipmentSlotType=NULL
ExternalLinkName3D= NSS_EarlyBatteryStern
Hitpoints= 100
DamageDescription1= NULL,    0,    0.2,    0,    1,    1,    small malfunction,        0,    0,    NULL,    0.3,    0.4,    4
DamageDescription2= NULL,    0.2,    0.6,    0,    1,    1,    Misaligned Axis,        0,    0,    NULL,     0.5,    0.4,    10
DamageDescription3= NULL,    0.6,    1,    0,    1,    1,    fuse blown,            0,    0,    NULL,    1,    0.2,    15

[Equipment 8]
ID=GatoBowBatteryBasic
NameDisplayable= Batteries (Bow)
FunctionalType= EqFTypeBatteries
EquipmentInterval= NULL, NULL
EquipmentSlotType=NULL
ExternalLinkName3D= NSS_EarlyBatteryBow
Hitpoints= 100
DamageDescription1= NULL,    0,    0.2,    0,    1,    1,    small malfunction,        0,    0,    NULL,    0.3,    0.4,    4
DamageDescription2= NULL,    0.2,    0.6,    0,    1,    1,    Misaligned Axis,        0,    0,    NULL,     0.5,    0.4,    10
DamageDescription3= NULL,    0.6,    1,    0,    1,    1,    fuse blown,            0,    0,    NULL,    1,    0.2,    15

[Equipment 48]
ID=GatoSternBatteryStandard
NameDisplayable= Batteries (Stern)
FunctionalType= EqFTypeBatteries
EquipmentInterval= NULL, NULL
EquipmentSlotType=NULL
ExternalLinkName3D= NSS_StandardBatteryStern
Hitpoints= 100
DamageDescription1= NULL,    0,    0.2,    0,    1,    1,    small malfunction,        0,    0,    NULL,    0.3,    0.4,    4
DamageDescription2= NULL,    0.2,    0.6,    0,    1,    1,    Misaligned Axis,        0,    0,    NULL,     0.5,    0.4,    10
DamageDescription3= NULL,    0.6,    1,    0,    1,    1,    fuse blown,            0,    0,    NULL,    1,    0.2,    15
 
 [Equipment 49]
ID=GatoBowBatteryStandard
NameDisplayable= Batteries (Bow)
FunctionalType= EqFTypeBatteries
EquipmentInterval= NULL, NULL
EquipmentSlotType=NULL
ExternalLinkName3D= NSS_StandardBatteryBow
Hitpoints= 100
DamageDescription1= NULL,    0,    0.2,    0,    1,    1,    small malfunction,        0,    0,    NULL,    0.3,    0.4,    4
DamageDescription2= NULL,    0.2,    0.6,    0,    1,    1,    Misaligned Axis,        0,    0,    NULL,     0.5,    0.4,    10
DamageDescription3= NULL,    0.6,    1,    0,    1,    1,    fuse blown,            0,    0,    NULL,    1,    0.2,    15
(Entirely new entries are in blue, new lines are in red.)
2. Modify the required "NSS_<ClassName>.upc" files to include a new UpgradePackSlot with a unique ID and Name, the proper LinkUpgradePackSlots to affect the submarine's batteries, and reasonable intervals referencing different types of UpgradePacks (as well as a new AcceptedType to be defined in the UpgradePacks.upc file.)
Such as (using the Sargo's slots as an example):
Code:
[UserPlayerUnit 1.UpgradePackSlot 1]
ID= UpgSurfaceSearchRadar
NameDisplayable= Surface Search Radar
Type=NULL
AcceptedTypes=SalmonSurfaceRadars
UserCustomizable=Yes
IDLinkUpgradePackSlots= EqSlot42, EqSlot43, SurfRadarAntenna, SurfRadarAntennaMed, SurfRadarAntennaLate
IDLinkUpgradePackSlotsIntervalDefault1= 1942-07-05, 1943-06-30, UpackSalmonSJRadar
IDLinkUpgradePackSlotsIntervalDefault2= 1943-07-01, NULL, UpackSalmonSJ1Radar

[UserPlayerUnit 1.UpgradePackSlot 2]
ID= UpgAirSearchRadar
NameDisplayable= Air Search Radar
Type=NULL
AcceptedTypes=AirRadars
UserCustomizable=Yes
IDLinkUpgradePackSlots= EqSlot33, AirRadarAntenna
IDLinkUpgradePackSlotsIntervalDefault1= 1941-12-25, 1943-03-10, UpackGatoSDRadar
IDLinkUpgradePackSlotsIntervalDefault2= 1943-03-11, NULL, UpackGatoImpSDRadar

[UserPlayerUnit 1.UpgradePackSlot 3]
ID= UpgDeckGun
NameDisplayable= Deck Gun
Type=NULL
AcceptedTypes=USDeckGunBasic
UserCustomizable=Yes
IDLinkUpgradePackSlots= BowDeckGun, SternDeckGun
IDLinkUpgradePackSlotsIntervalDefault1= NULL, 1943-09-01, Upack3in50calDGStern
IDLinkUpgradePackSlotsIntervalDefault2= 1943-09-02, NULL, Upack3in50calDGBow

[UserPlayerUnit 1.UpgradePackSlot 4]
ID= UpgBattery
NameDisplayable= Electrical Batteries
Type=NULL
AcceptedTypes=GatoElecBatteries
UserCustomizable=Yes
IDLinkUpgradePackSlots= EqSlot7, EqSlot8
IDLinkUpgradePackSlotsIntervalDefault1= 1942-09-03, 1943-07-04, UpackSargoBatteryEarly
IDLinkUpgradePackSlotsIntervalDefault2= 1943-07-04, NULL, UpackSargoBatteryStandard
(Incidentally, is there anything special I'd need to do in order to get the Upgrade Slot to display correctly on the Upgrade Screen?)
3. Create a new entry or two in UpgradePacks.upc covering my new batteries, like:
Code:
[UpgradePack 32]
ID= UpackSargoBatteryEarly
NameDisplayable= Early Batteries
FunctionalType= UpFTypePropulsionBatteries
UpgradePackSlotType= GatoElecBatteries
Type=NULL
UnitUpgradePackIntervalOptionCurrent= NULL, NULL, 0
UnitUpgradePackIntervalOptions1=1941-12-01, 1942-09-03, 100
UnitUpgradePackIntervalOptions2=1942-09-03, NULL, 0
IDLinkUpgradePackElements= GatoSternBatteryBasic, GatoBowBatteryBasic

[UpgradePack 33]
ID= UpackSargoBatteryStandard
NameDisplayable= Mid-War Batteries
FunctionalType= UpFTypePropulsionBatteries
UpgradePackSlotType= GatoElecBatteries
Type=NULL
UnitUpgradePackIntervalOptionCurrent= NULL, NULL, 0
UnitUpgradePackIntervalOptions1=1942-09-03, 1943-07-04, 1500
UnitUpgradePackIntervalOptions2=1943-07-04, 1944-03-15, 400
UnitUpgradePackIntervalOptions3=1944-03-15, NULL, 0
IDLinkUpgradePackElements= GatoSternBatteryStandard, GatoBowBatteryStandard
4. Finally, add new 'chunks' to (at the very least) the "Sensors_sub_US" .sim and .dat files (since I presume the game wouldn't load any 'new' .sim and .dat files that it didn't know to check for - would it? If it would, how would I go about telling it to do that?) - in order to actually tell the game what my spiffy-fancy-handsome-new-batteries and old ones do.

I presume this addition process would go something like: Find last non-"End" node in .dat file, append a new 4/100 node after that last node (which would be 170 in Sensors_sub_US.dat, making our new node 171) and add a child-node "Label" to it matching the ExternalLinkID I assigned before (so, in this case, reference back to NSS_EarlyBatteryStern) and repeat this for as many new references as I have (I.E; EarlyBatteryBow, and StandardBattery Bow and Stern) creating new nodes for each one.

Now, since the game now has its internal labels for our batteries, we go over to the .sim version of the above file, and (presumably anywhere, since order isn't as important here? But probably at the bottom, too, for clarity...) add a new Controller entry (type 10/-1) and link its Id-value with the Id-value in the .dat file of whatever component (NSS_etcetera, for instance, NSS_EarlyBatteryStern) you want it to control, and give it a proper name (for instance, BatteryData) and then its own child-chunk, a Properties child-chunk, specifically an SH4 -> SHSim -> unit_Submarine chunk, in this case.

For a battery-component, the only applicable change that needs to be made is to Ranges -> Submerged, correct? (That is, if I don't include any value-changes in the rest, it won't apply any changes to the rest of the submarine's existing values, will it?) In this case, since this would be the starting battery, it'd just have the same range-at-x-knots value the submarine starts with. Then I'd create the other base-controller in the pair with the same info, and two other controllers for the "Standard" batteries, with (reasonably)-upgraded values. Make sure all IDs are matched to their correct entries in the .dat file, and boom. Batteries.

*Takes a deep breath!* Right?

I apologize in advance if I've made any big, stupid mistakes anywhere in here, or if I missed an obvious tutorial or help-topic that covered how to do this! I didn't see any during forum-searches or checking the 'Popular Mods and Links' topic, though. But, yes: Simple question is, would the above process give me functional and upgrade-able batteries, if repeated for every given submarine I wanted to thusly empower? And, would the process work for other components? There are other subquestions scattered throughout the above, but if they don't get answered, I'll just ask them elsewhere - this is the big one.

I actually got started on this whole big project in deciding to learn how to mod this game about three days or so ago, after I read that in SH3, you were able to upgrade your engines and batteries, somewhere. I thought that would be a neat thing to be able to do in SH4, so I've just been looking into how to make that happen. Any help you can render would be appreciated - if I've got anything wrong, please correct me! If there's a tutorial on this, please direct me to it! Thank you for everything in advance, anyhow, even reading this far!

~Kaoru
Kaoru is offline   Reply With Quote
Old 07-09-10, 02:09 AM   #2
sergei
Sea Lord
 
Join Date: May 2008
Location: London UK
Posts: 1,788
Downloads: 405
Uploads: 29
Default

Hi Kaoru.
I can't answer your questions, I have never really dug around in these files.
Just wanted to say - wow, what a first post
Welcome aboard
Hopefully someone will be along shortly to answer your questions.
sergei is offline   Reply With Quote
Old 07-09-10, 06:43 AM   #3
rein1705
Samurai Navy
 
Join Date: Mar 2010
Location: somewhere in the Past.
Posts: 582
Downloads: 541
Uploads: 0
Default

you should meet Peabody.

And welcome aboard Skipper.
__________________

"Diesel Pig"

Not so long ago...
rein1705 is offline   Reply With Quote
Old 07-09-10, 03:22 PM   #4
peabody
Admiral
 
Join Date: Jan 2008
Location: New York State, USA
Posts: 2,390
Downloads: 126
Uploads: 7
Default

Quote:
Originally Posted by rein1705 View Post
you should meet Peabody.
He needs to meet somebody that knows more than I do.

Welcome Kaoru, give it a try. But in my opinion if you link a battery to a "unit_submarine" controller, you will probably get a submarine. But stranger things have happened.

Peabody
__________________

System Spec: Gigabyte GA-965P-DS3, PentiumD Dual Core Presler 945 3.4Ghz, Gigabyte Geforce 7600GS, 2-1GB Corsair XMS2 800Mhz in Dual Channel, 2-WD 250 SATA 3Gb/s, Onboard Realtek HD 7.1 Audio, DVD ROM, DVD burner, Hiper 580 Watt Power supply, WinXP SP2.

peabody is offline   Reply With Quote
Reply

Tags
amidoinitrite, everythingabouteverything, pagebreaker, talkstoomuch, walloftext


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 03:11 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.