Basically, what I noticed is that the bit headers section is very difficult to get a handle on. For models with multiple parts there are often many extra bit header sections that don't correspond to any actual geometry, and setting these up correctly is like shooting in the dark (at least for me). I spent many, many, many frustrated hours tring to completely figure them out, but eventually I found myself about where I'd started. That being said, any surface with just a single mesh generally has only one bit header section, which is quite manageable.
The .sur exporter that we all know and love forces you to choose either a bubble or shrinkwrapped shield. Unfortunately, this leaves you with more than one mesh in your surface, so what I did was write a simple program to strip off the shield mesh of a .sur file that came from the .sur exporter. The result: a collision surface that completely worked under all circumstances. After some more testing I discovered that to be reliable it also needed to be convex (this we already knew, but I figured I would test it anyway). Additionally, I am 95% that the arrangement of the triangles in the mesh matters; using just default boxes or other shapes in MS3D always gives me results that work, but trying to make the triangles by hand by connecting vertices tends to fail.
Also of interest was shield behavior. Prior to this I wasn't aware that Freelancer would default to using your hull hit box for shields if no shield mesh exists, but it most certainly does. Even hits against mounted equipment will count as shield hits so long as the shield is up. So, as long as you're willing to settle for your shield surface being the same as your hull surface, you really just need a single mesh; for my purposes this is what I wanted anyway.
Unfortunately, that leaves you S.O.L. if you want to create a .sur for a ship that has any sort of concavity, which is nearly every ship in existence. However, I noticed that some objects in the game, such as turrets, had multiple surfaces in the .sur file, each with a single mesh. Furthermore, hits against any of those surfaces would count against the hit points of the object, as though all were part of the root component. This is exactly what I was looking for, so I tried splicing together a bunch of my single-mesh .sur files into a single, larger .sur file. Of course I had to match names/crcs of names for each surface with components in the target .cmp file, but those components did not need to be anything meaningful (I just used a bunch of small cubes for my components).
It was partially successful. However, this ended up being due to the radii for the surfaces not being set correctly (by the way, it seems that the radius value in the surface definition relates to ship collisions, while the radius value in the bit header relates to projectile impacts). After making these values large enough, hits and collisions registered 100% of the time. I even tried flying the ship with the new .sur into itself, and it bounced right off no matter where I hit.
And now for links to show you folks what I'm talking about:
This is the .sur file for the ship (it's an Imperator, if that wasn't obvious). It is made up of eight convex parts, though I may go back and add a few more. All parts were created from MS3D boxes; in some cases I mirrored them across the z-axis and welded the two halves together. Still, they are all very simple pieces individually.
teh .sur file, viewed in MS3D
This is what the .cmp looks like in utf_edit. The main point is that there are a whole lot of components, though as I mentioned before all but the root component are just small cubes located at 0,0,0. There are 18 components (Root plus 17 zomgbayz) here but as I said the .sur currently uses only eight of them.
The .cmp tree in utf_edit
This is the .cmp + .sur viewed in HardCMP. The .sur is a pretty close fit so it's rather of hard to see, but that's kind of the point. The zomgbayz are all in the same place, circled in red. Since they are in the middle of the model you will never see them normally.
Teh ZOMGBAYZ. And the rest of the model.
Lastly, me showing off that the .sur really does work. Note how the projectiles are impacting exactly on the surface of the top superstructure, neck and bridge.
Zomgbay haxx, surface hits
And that is that. It may not be the most streamlined of processes in the universe, but it definitely works. Once I make my .sur splicing utility a bit more user-friendly I plan on releasing it here; hopefully it will make it easier for anyone to create accurate hit boxes.
Also, I must thank those that have gone before me and figured out much of the complexities of the .sur format and put together an exporter for MS3D. Building upon the insights and breakthroughs of others is what keeps a modding community strong, and I would say we have done a very fine job of that here at TLR.
Edit: The utility can be downloaded here
Edited by - Dev on 6/13/2006 6:35:41 PM