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 > SH5 Mods Workshop
Forget password? Reset here

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 04-16-11, 01:19 PM   #1
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


[TEC] Adding/Importing new units / SH5 Damage/collision models

This will document how to add/import new units to SH5. It will also document the damage/collision models present in SH5. I'm pretty certain this will get stickied as the information it contains is needed for ship builders/new unit builders/unit importers for SH5

Let's open up the NLL ship in the goblin editor (it's .GR2 file, .sim and .zon files):


Now I need to discuss the damage/collision models used in SH5. SH5 has two damage/collision models. One is for damage/collision with other units and the terrain. The other is for damage/collision with shells/torpedoes/DCs.

The damage/collision model for units and terrain can be seen by showing the damage for each hull part/part of the ship. Here we'll look at hull02 of the NLL ship. We view the sphere's for collision testing by selecting a hull part or another part of the ship (any part except the root of the tree which is NLL in this case) and right clicking and selecting Edit Damage:


Notice all the sphere's. These sphere's denote areas that can be collided with. Now when a collision happens with a sphere the game engine then looks to see if any boxes are located in that area and calculates which boxes are affected by the collision. Now you may be asking how do I see the boxes? It's easy. If you right click on the topmost object (NLL in this case) and select Edit Damage you'll see all the boxes for the unit:


Now when a collision happens with another unit/terrain the game engine looks to see which sphere's are affected and then looks to see which boxes are affected to calculate damage/flooding.

So one might be asking what are these boxes for? These boxes denote the compartments on the ship. Each box has a Type value which is drawn from the Zones.cfg file. This type value then tells the game engine how the compartment behaves flooding wise via the entries in the Zones.cfg file. It also tells the game engine which effects to play when the damage to that compartment exceeds certain defined values.

One thing to note is that boxes CANNOT be used for collision detection. They are for damage/flooding model only.

Now we need to talk about the other damage/collision model used in SH5. This model is used for collision detection of shells/torpedoes/DCs with units. This model, to me, seems to be very CPU intensive. This model exists, I'm almost 100% certain, because of the granny way of doing things. Instead of using sphere's for collision detection the game engine uses a 3D model. See why I say CPU intensive? It appears that the game engine uses the resulting bounding box from the 3D model as a first test for collision detection with shells/torpedoes. If that test passes then it goes down to a face level to see where the collision happened. How this is better than the sphere way is beyond me Once the face(s) have been determined then the game engine looks at which boxes are effected some how. I haven't quite figured out how it does this but I do know this is how it's done. Once the box(es) are determined then it goes about calculating the damage to the resulting boxes from the MinEF and MaxEF and MinRadius and MaxRadius of the shell/torpedo/DC.

Now you can probably see why the magnetic detonators don't work in SH5. As the granny way of doing things needs to see a collision happen and by nature magnetic detonators never collide with anything nothing ever happens! The torpedo just sails on underneath the unit

So how do we see this 3D model that is used for collision detection with shells/torpedoes/DCs? Once again it's quite easy. First let me bring to your attention an entry found in EVERY unit in SH5. This entry is viewable in Goblin editor and it starts with this 'DMG_col_x' where x is the name of the unit/part. This entry is always in bold and in an italics font. Now something special about this entry is that it's hidden (not viewable - hence the bold text and italicized text). Another thing that is interesting about this entry is that it contains a very simplified 3D model of the unit/part it represents (to minimize CPU time calculating which face(s) was/were intersected).

Now from above we looked at hull02 of the NLL ship. You saw the 3D model that is rendered in game. Now we're going to hide the actual 3D model used in game by right clicking on NLL_Hull02 and selecting Toggle Hide/View. Thus you should see the below:



Notice that hull02 is not viewable anymore. Now let's view the 3D model used for collision detection with shells/torpedoes/DCs by right clicking on DMG_col_NLL02 located under NLL_Hull02 and selecting Toggle Hide/View. You should see the below:


Notice the very simplified 3D model used for Hull02 in this case.

And that is the two damage/collision models used in SH5.

Using this information one can import/make new units for SH5 using .dat files. My next post in this thread will be about importing a unit from SH3 and porting it over to SH5.


See here for a tutorial from Rongel on how to take a unit from SH4 and place into SH5: http://www.subsim.com/radioroom/show...&postcount=432


Last edited by TheDarkWraith; 05-18-11 at 10:57 AM.
TheDarkWraith is offline   Reply With Quote
 


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 06:23 AM.


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