SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SH5 Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=249)
-   -   [TEC] Adding/Importing new units / SH5 Damage/collision models (https://www.subsim.com/radioroom/showthread.php?t=182667)

Madox58 04-18-11 07:34 PM

Quote:

Originally Posted by TheDarkWraith (Post 1644371)
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 :cool:

Let's open up the NLL ship in the goblin editor (it's .GR2 file, .sim and .zon files):
http://www.subsim.com/radioroom/pict...pictureid=4045

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:
http://www.subsim.com/radioroom/pict...pictureid=4046

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:
http://www.subsim.com/radioroom/pict...pictureid=4047

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 :shifty: 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 :nope:

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:
http://www.subsim.com/radioroom/pict...pictureid=4048


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:
http://www.subsim.com/radioroom/pict...pictureid=4049

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.

:|\\

FINALLY!
:up:
:03:

Reece 04-18-11 10:50 PM

Quote:

Originally Posted by privateer (Post 1646209)
FINALLY!
:up:
:03:

Yeh he's damned good!:yeah:

The following formula applies: SH5 + TDW = Awesome

sirbum69 04-19-11 04:39 PM

Silent hunter 5...--Battle of TheDarkWraith--

Coming to PC soon, with no Internet required

:rock::rock:

stoianm 04-19-11 04:50 PM

Quote:

Originally Posted by sirbum69 (Post 1646802)
Silent hunter 5...--Battle of TheDarkWraith--

Coming to PC soon, with no Internet required

:rock::rock:

I will tell you a secret... TDW is not a person ...is a computer ..:DL

Stormfly 04-19-11 05:00 PM

Quote:

Originally Posted by stoianm (Post 1646809)
I will tell you a secret... TDW is not a person ...is a computer ..:DL

lets hope then that we wont end up with "Skynet" then :O:

sirbum69 04-19-11 05:05 PM

funny my wife works for a place called Cray computers that make super computers used all over the world...I think if i remember right she was talking the other day about one they had rolled off the floor about 2 years ago....The name was ummm hmmm TheDarkWraith i believe:yeah::haha::har:

iambecomelife 04-22-11 03:32 PM

I just tried importing a SH3 unit and it's crashing the game. I don't know what the problem could be; I added the node in the dat file, added the ship to the British roster, & checked the eqp file for any SH3 weapons. Everything seems to be OK but it won't work. In either Museum or missions.

I'll give it another go, I think.

TheDarkWraith 04-22-11 04:13 PM

Quote:

Originally Posted by iambecomelife (Post 1648852)
I just tried importing a SH3 unit and it's crashing the game. I don't know what the problem could be; I added the node in the dat file, added the ship to the British roster, & checked the eqp file for any SH3 weapons. Everything seems to be OK but it won't work. In either Museum or missions.

I'll give it another go, I think.

If you want you can send me the work and I'll look it over :up:

Stormfly 04-22-11 04:49 PM

Quote:

Originally Posted by iambecomelife (Post 1648852)
I just tried importing a SH3 unit and it's crashing the game. I don't know what the problem could be; I added the node in the dat file, added the ship to the British roster, & checked the eqp file for any SH3 weapons. Everything seems to be OK but it won't work. In either Museum or missions.

I'll give it another go, I think.

does that mean your thinking about importing the Merchant Fleet Mod into SH5 ? :o :D

iambecomelife 04-22-11 04:49 PM

Quote:

Originally Posted by TheDarkWraith (Post 1648883)
If you want you can send me the work and I'll look it over :up:



http://www.gamefront.com/files/20253...ght+Tanker.rar

TheDarkWraith 04-22-11 05:17 PM

Quote:

Originally Posted by iambecomelife (Post 1648909)

I see many problems. First of which is your telling the game to reference the 3D model T08B but that doesn't exist in the .dat file. I'll correct the errors and send it back to you :up: It will take some time.

iambecomelife 04-22-11 09:09 PM

Quote:

Originally Posted by TheDarkWraith (Post 1648937)
I see many problems. First of which is your telling the game to reference the 3D model T08B but that doesn't exist in the .dat file. I'll correct the errors and send it back to you :up: It will take some time.

I see. Thank you. I am also working on my end; I just renamed the 3d model in the dat file to T08B and deleted all of the SHD entries I could find but it is still crashing. I will keep trying.

If you get it working before I do, could you please let me know what was done wrong for future reference? Thanks; I'd appreciate it.

marleymen 04-22-11 11:38 PM

I´m crossing fingers and praying IABL.

TheDarkWraith 04-23-11 09:05 AM

Quote:

Originally Posted by iambecomelife (Post 1649030)
I see. Thank you. I am also working on my end; I just renamed the 3d model in the dat file to T08B and deleted all of the SHD entries I could find but it is still crashing. I will keep trying.

If you get it working before I do, could you please let me know what was done wrong for future reference? Thanks; I'd appreciate it.

This is obviously an SH4 ship as from the Cfg#TXR nodes. I have changed everything needed to make it render in SH5 but there is still a problem in the _B (back portion of the ship). This one has been a learning experience for me as I never converted an SH4 ship (until now!). Once I narrow down the problem in the back portion of the ship it will quit causing CTDs. I'm slowly narrowing down the problem node(s)....

Had to rename everything correctly (all the NLL_ and _NLL had to be changed to T08B_ and _T08B respectively)

Had to remove all of the following nodes (and their child nodes):
- DynamicShadow
- any nodes with _SHD or _reflect

Converted the cfg#TXR_ nodes to actual type 2/0 nodes (to be safe - not sure if SH5 supports this or not)

Basically all the changes were made because that is what I know works in SH5

EDIT:

two nodes are causing the CTD:

- T08B_B_Cabina
- T08B_B_catarg02

Now to figure out why....

EDIT2:

figured out why. Those two nodes had 'blank' 3D models for them. I removed the 3D model references (and the blank 3D model nodes) and the texture references and so far so good :up:

TheDarkWraith 04-23-11 09:58 AM

And here is the ship in game:
http://www.subsim.com/radioroom/pict...pictureid=4110

And it's damage/collision model is working. Also appears in rec-manual and SOAN:
http://www.subsim.com/radioroom/pict...pictureid=4109

There is still work to do on it but the author can do that. What's left to do:
- improve the bow and stern sprays
- redo the shipwake(s) to use the new SH5 controllers
- verify all the zone numbers referenced in the .zon file exist in SH5's \data\Zones.cfg file
- any other particle generators redo to make to SH5 spec (optional)

I'll send this to the original author now :yeah:

stoianm 04-23-11 09:59 AM

nice:)

Stormfly 04-23-11 10:06 AM

How lovely !

http://i886.photobucket.com/albums/a..._Applaud-1.gif

Zedi 04-23-11 10:32 AM

Isnt this the Cimmaron tanker? Anyway, looking good. :yeah:

TheDarkWraith 04-23-11 10:35 AM

Quote:

Originally Posted by Zedi (Post 1649338)
Isnt this the Cimmaron tanker? Anyway, looking good. :yeah:

I think iambecomelife is just trying to learn how to import SH3/4 units into SH5. His picking was a good choice because it had many errors/problems that had me scratching my head for a little while (I learned from this example as I never converted an SH4 ship [appears to be] to SH5 - I've only done SH3 ships). I sent him the revised files so he can learn from it and hopefully give us more ships :yeah:

He has the hitpoints set WAY too high for this unit. Took all my torpedoes and many shells to finally sink it :o

iambecomelife 04-23-11 10:52 AM

Thanks so much! Sorry about all the mistakes - I guess I will have to be more precise when creating new ships, because SH5 seems pretty sensitive to taking shortcuts with the .dat files.

I am creating some new merchants and will hopefully have pix to share soon.http://i56.photobucket.com/albums/g1...k/1a980730.jpg

@Zedi: This is actually not the Cimmaron; it is based on the MV "Victor Ross" (seen here, sunk 1940), MV "Geo W. McKnight", and a number of sister ships and near sister ships, which were designed in the 1930's for use by Standard Oil (Esso) and its subsidiaries.

http://www.aukevisser.nl/german/id82.htm


All times are GMT -5. The time now is 12:19 PM.

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.