Important Message

You are browsing the archived Lancers Reactor forums. You cannot register or login.
The content may be outdated and links may not be functional.


To get the latest in Freelancer news, mods, modding and downloads, go to
The-Starport

Hit Boxes

The general place to discuss MOD''ing Freelancer!

Post Sat May 06, 2006 10:13 am

Hit Boxes

I have noticed that on some ship packs, the ships hit box is either very small or non-existant. I am currently in the process of making my own admin ship for a mod, and i have read thru many tutorials and i havent seen one mentioning about hitboxes. Is there a way to create hitboxes or do they automaticly implement them selves in the game?

Many thanks Cheese on toast (aka -=[Ta[X=-Gallick)

Post Sat May 06, 2006 1:36 pm

Hitboxes are governed by a file known as a Sur File.

Cracking the Sur File code is one of the last parts of Freelancer coding left to crack by modders. Most mods work at the moment by taking an existing sur file from a ship in Freelancer and using programs like FL Model Tool and FLResize, stretch and reposition the sur file to the 'best' fit they can. However, it is far from a perfect hitbox solution.

There is also a Sur file exporter out there, but it is still very much in it's beta stage and is 'fiddly' to say the least.

If you want to know more, search these forums for topics containing the word 'sur'.

Freeworlds Mod Developer
Author of Modular Station

'There is no Good nor Evil in the universe, just perceptions and circumstances.'

Post Sat May 06, 2006 5:44 pm

Thanks very much for information on the Fl model tool . But now this causes me another problem, i dont know what any of it means lol, all i see is text and numbers and thats it lol. So is there a tutorial on this, i will be looking in the tutorials sections for this and i will post back when i have found it to save you guys from wasting time if u do

Thanks!

Cheese on toast:
Like the name
Beware the player

Post Sat May 06, 2006 6:40 pm

Well, you don't need to know all of the details. I certainly don't and i've still been able to create/export over 120 ships.
All you need to do is copy any sur into the same folder and rename it the same as the cmp. There is no other link between the two other than their name. So, it would be co_fighter.cmp and co_fighter.sur in the same folder.
Then just open up Flmodel tool, load the cmp, resize if needed and save any radius changes. Then load the sur from the sur part ond choose:
resize>automatic (to cmp), make sure its a ship and all components part of the hull (as standard) and save.
Thats about it, its so easy that even i can do it..

Dev

Post Sat May 06, 2006 11:06 pm

A critical point/clarification to make here is that in addition to .sur files being linked to .cmp (or .3db) files by name, components within the .sur file and components within the .cmp are also linked by name. For example, consider the Eagle's .cmp file: in addition to the main body, it has a tail fin, a ventral fin and two wings that can all be shot off (there are some other parts as well, but we'll stick with these). In order for those parts to be broken off, they all need their own components in the .sur file, and the way the game matches .sur components to .cmp components is by matching names.

Why does this matter? Consider that the majority of custom ships have just a single component, Root. Also consider that most people use the .sur files belonging to multi-component FL ships for their custom ships. What this means is that when the game goes to match parts in the .sur with parts in the .cmp, the only parts that will match will be those named Root. This is a problem: the shape of the Root component for most FL ships is NOT representative of the overall shape of the ship, so you end up with a hit box on your custom ship that does not fit well at all (usually it is far too small). I have noticed in many mods that the custom ships have not had their components renamed and often are close to unhittable once you bring down their shields.

Fortunately, .sur resizing utilites give you the option of renaming all those other components in the .sur file (such as wings as fins) to Root, effectively making them hittable on custom ships. Be sure to always use this option when sizing a .sur to a custom ship for the first time.

That being said, there is a real art to choosing the .sur file from a normal FL ship that is the best match with your custom ship, and of course scaling/translating the .sur to exactly fit the ship takes some work, too. HardCMP allows you to view the .cmp and .sur together (just push 'S', though you will need to open the .cmp from the file menu). This is useful for providing some visual feedback on how close your match is, although typically I import both the .sur and .cmp into MS3D first and tinker with the .sur until it looks about right; it is then very easy to take the scale and translate numbers and feed them into a .sur resizer. It is a tried and tested method that I've used hundreds of times with very good success.

Post Sun May 07, 2006 12:02 am

Why don't you create your own SURs? It's possible. All you won't be able to do right now with the SUR exporter are ships with destroyable components. Everything else works just fine.

Post Sun May 07, 2006 4:22 am

You see, i have tried making .sur files in ms3d but that too doesnt make any sense. I have looked thru the tutorials section and i have found nothing (gunna look thru agen may have missed something at 3 in the morning )so my question is this - how do you create a working .sur file in ms3d exculuding parts of the ship that are desructable?

Cheese on toast:
Like the name
Beware the player

*EDIT*

I have had a go using the ms3d one agen, but now i get a error message saying Weldvertices Function has failed :s what the hell is tht? im guessing its to do with the sur exporter finding the groups? possibly?

Edited by - cheese on toast123 on 5/7/2006 5:55:28 AM

Post Sun May 07, 2006 10:11 am

TBH those getting a perfect SUR from the exporter are very lucky... It isnt perfect yet by a long way.

And there is no real documentation for FLModelTool except in my mind cos I'm horribly lazy like that

Essentially, poick the existing fl ship that is closest in shape to your custom ship. Load the cmp of the custom ship, goto sur tab, load the sur you chose, resize to cmp and save as <name of cmp>.sur

et voila a resized sur. This method does have a bug but it works a lil better than custom surs atm

+++ out of cheese error - redo from start +++

Post Sun May 07, 2006 12:47 pm

Anton, while you are here, in shiparch there is the shield_link that point to the object in select_equip. I've used your Flmodeltool to create a "all components part of the root" type sur and used it for a capital ship's shield_link. It seems to work ok, but will this actually work properly?

Post Sun May 07, 2006 5:09 pm

ATM the SUR Exporter is problematic to say the least, but I'm making some headway with it.

All of the CMP files that we currently have in the mods will never get a SUR to work from the Exporter, so stick to using FlModelTool to resize a vanilla SUR for them. Shipwrights this will come like a sledgehammer between the eyes but you guy's are going to have to relearn how to export your CMP's.

Exporting a CMP as 1 group and then exporting a SUR to match will give you a 98/99% shield bubble, but once the shield is down every shot will pass harmlessly through your ship, you might as well have not bothered with the SUR.

Exporting your model as multiple groups/subgroups will give a partial hull SUR, you will bounce off of most things with it but shots aimed at the models center will mostly pass through without doing any damage. The models extremities will however take damage as thier hitboxes appear to work most of the time.

This is where the WTF, OMG and GTF's start

HARDPOINTS , yes I did say hardpoints, the equipment hardpoints MUST be added in Milkshape, no if's but's or maybe's, they have to be part of the model when the SUR is created as they form part of the damage detection, without them the SUR doesn't even get close to working. The hardpoints I mean are HpWeapon, HpTurret, HpTorpedo, HpMine, HpCM, HpThruster, HpShield and HpMount. Yes I know HpMount isn't equipment but old habits die hard and I haven't had any adverse effects from adding it.

Multiple groups and adding the hardpoints in MS3D have given me the best results so far, but that's only a 75% SUR and no destructable parts (yet).

@ MG, my latest tester is low poly (800) and is giving me good results, nearly every shot is registering, I don't know if its the low poly count or if it's because the ship is compact(just a little bigger than a starflier), I'm going to set it up with Dp's and see what I get. *crosses fingers*

@ Anton, yes it renames all of the component hitboxes "root"
**shuffles of with a new headache**

Edited by - Bejaymac on 5/7/2006 6:14:35 PM

Post Mon May 08, 2006 12:05 pm

Well, I loaded my ship into 3ds max and built simple boxes or cylinders around it as close as I could, but making sure there were no external angles larger than 90 degrees. That's about all I did expecially cared about, with the exception of the whole FLModelTool resizing process of course.

I also tried to save the resized SUR as txt, compare it to the pre-resize SUR via a DifTool and restore the original group names in the resized model (complete with changing the reference for each indivudual poly), than import the text into FLModelTool again and save the SUR, but this (maybe a bit naive) try failed miserably. I will try this again for another ship, however and see if I just made some kind of typo.

Other than that, the so-called "Null Hitbox" cannot be found changed in the text the SUR exporter gives the user, so we'd have to compare the HEXes of the two versions two see wich other differenced there are. I reckon this will be hard and time-consuming work...

Post Tue May 09, 2006 1:57 am

@ MACE - it works fine as long as u dont want destructable components. Its a bodge basically.

@ Beyja - lol thats bodge not bug. bug is in collision sphere sizing. its messed up but nothing like as messed up as it is in current SUR exporter (IMHO thats the only major issue, needs properly working on and testing tho)

* edit ok 2nd major issue... I dont think using directx to optimise the sur and ensure it is convex is good at all. ANY gaps in model will send FL engine screaming to errors (dumped or not). QHull is the way, if only i can get time to tinker and learn

+++ out of cheese error - redo from start +++

Edited by - anton on 5/9/2006 3:00:02 AM

Post Mon May 15, 2006 2:55 am

@Manhattan_Guy
have you tried copying your model in 3ds max, delete the original, make a sphere
around it ( has to be changed a bit) and make this the sur???

Post Wed Jul 26, 2006 7:35 am

Actually, why not use the ms3d sur-exporter?

Post Wed Jul 26, 2006 3:45 pm

FWIW guys I'm currently getting excellent results by using Dev's SUR splice program in conjunction with the MS3d SUR exporter. Provided you don't need to draw more than 18 basic shapes to provide the SUR coverage you want, I reckon that a good matching SUR file can be made for any ship. I've even been able to edit the basic MS3D shapes to make them a good fit and the SUR still registers hits very well e.g. I edit box shapes to make them into wedge shapes and distort spheres and cylinders ... provided I start of by drawing a basic ship and then distort it a little, the SUR can be made to match the ship pretty well and the hits register just fine.

Return to Freelancer General Editing Forum