Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Dragon on June 20, 2012, 03:31:01 pm

Title: How exactly collision damage is calculated?
Post by: Dragon on June 20, 2012, 03:31:01 pm
I'd like to know the exact formula used by the FSO code to calculate collision damage. It's dependent on density and impact velocity, but I'd like to know how does the equation look like.
Title: Re: How exactly collision damage is calculated?
Post by: Mongoose on June 20, 2012, 04:01:23 pm
From what I've heard about the collision code, I'd imagine that int here_there_be_dragons is involved somewhere.
Title: Re: How exactly collision damage is calculated?
Post by: headdie on June 20, 2012, 04:18:44 pm
 :wtf: you want the team to explain voodoo magic?
Title: Re: How exactly collision damage is calculated?
Post by: Dragon on June 20, 2012, 04:20:47 pm
Nope.
This time, collision detection code (the labyrinthine one) is of no interest to me. What I'm asking about is what happens after things collide, specifically the damage equation. I've heard this system is surprisingly well written, with a realistic collision simulation with modifiers laid on top of it.
Title: Re: How exactly collision damage is calculated?
Post by: headdie on June 20, 2012, 04:26:44 pm
ahhhh, so an answer might be possible, cool.

in that case can I +1 this request
Title: Re: How exactly collision damage is calculated?
Post by: Valathil on June 20, 2012, 05:34:21 pm
Why dont you read the code for yourselves, it's open source for a reason.
Title: Re: How exactly collision damage is calculated?
Post by: Sushi on June 20, 2012, 05:41:38 pm
I looked at this once.

I don't remember the specifics, but it goes something like this.

It starts of simple, as a function of velocity (and maybe density).
The results are then scaled down by a fixed amount.
Then a soft cap is applied: beyond 4 points or so of damage, the damage is scaled down even further.
Somewhere in this mess, a global multiplier based on difficulty level is also applied.

Oh, I should also mention that there are separate calculations for different interactions, including ship vs ship and ship vs asteroid. I think the one above is for ship vs ship.

Here there be dragons, indeed!


--
Somewhere on my TODO list is an item that reads something like "game_settings.tbl flag for simple linear collision damage scale", so you can have those high-speed collisions be actually dangerous. I'll most likely never get to it. :p
Title: Re: How exactly collision damage is calculated?
Post by: Droid803 on June 20, 2012, 05:44:30 pm
High-speed collisions are dangerous.
Go play Dimensional Eclipse and fly into an asteroid.

YOU. WILL. DIE.

(and bouncing off a capship can do like 10+% damage depending on which fighter you have/what you're smacking into).

This is with unchanged collision mechanics, just 2-300m/s speeds

It'd be nice if it were better documented though.
Title: Re: How exactly collision damage is calculated?
Post by: Dragon on June 20, 2012, 06:09:59 pm
Somewhere on my TODO list is an item that reads something like "game_settings.tbl flag for simple linear collision damage scale", so you can have those high-speed collisions be actually dangerous. I'll most likely never get to it. :p
That could really come in handy. In fact, I'd like to have finer control over collision damage scaling. Depending on the function (it'd be great if you could check it and try to present it as an equation), it could be possible to mess with density, but that may not work on debris nor asteroids (both of which have unusually damaging collisions).
Title: Re: How exactly collision damage is calculated?
Post by: MatthTheGeek on June 21, 2012, 02:37:13 am
Somewhere on my TODO list is an item that reads something like "game_settings.tbl flag for simple linear collision damage scale", so you can have those high-speed collisions be actually dangerous.
Or how to make the AI (both hostile and friendly) 10x more dangerous to the player...

I can hear from here all the "I keep getting instagibbed in the first two minutes of the mission" complains incoming.
Title: Re: How exactly collision damage is calculated?
Post by: Dragon on June 21, 2012, 07:53:49 am
In high speed mods like DE, fighter to fighter collisions are virtually nonexistant. Of course, an improvement in collision avoidance AI would also be a welcome (and long overdue) addition.
Title: Re: How exactly collision damage is calculated?
Post by: assasing123 on June 21, 2012, 08:45:32 am
on my ST mod i have gotten several times insta owned by collisions due to using "realistic" numbers on the POF file for the mass of ships... that is assuming that thing is mean to be tons...
Title: Re: How exactly collision damage is calculated?
Post by: pecenipicek on June 21, 2012, 10:13:52 am
In high speed mods like DE, fighter to fighter collisions are virtually nonexistant. Of course, an improvement in collision avoidance AI would also be a welcome (and long overdue) addition.
TAP says hi and would like to tell you that you are a moron. in a shieldless enviroment, with speeds around 325, a lot of fights end up as jousting matches or playing chicken with the ai. if neither budges, both of you are liable to end up in the low 20 percentile of your health, not counting shot damage.
Title: Re: How exactly collision damage is calculated?
Post by: Dragon on June 21, 2012, 01:29:27 pm
In high speed mods like DE, fighter to fighter collisions are virtually nonexistant. Of course, an improvement in collision avoidance AI would also be a welcome (and long overdue) addition.
TAP says hi and would like to tell you that you are a moron. in a shieldless enviroment, with speeds around 325, a lot of fights end up as jousting matches or playing chicken with the ai. if neither budges, both of you are liable to end up in the low 20 percentile of your health, not counting shot damage.
All other mods say hi to tell you that you should update your AI and stop insulting people.
Title: Re: How exactly collision damage is calculated?
Post by: Flipside on June 21, 2012, 04:04:15 pm
Play nice please, no need to get heated over it :)
Title: Re: How exactly collision damage is calculated?
Post by: Alan Bolte on June 21, 2012, 09:12:36 pm
on my ST mod i have gotten several times insta owned by collisions due to using "realistic" numbers on the POF file for the mass of ships... that is assuming that thing is mean to be tons...
Retail ships and asteroids all have the same density. Based on asteroids, I estimated (http://www.hard-light.net/forums/index.php?topic=78920.msg1561669#msg1561669) that a FS mass unit is 100 metric tons. On the other hand, that would make the fighters incredibly heavy, so 1 ton might be a more reasonable guess.
Title: Re: How exactly collision damage is calculated?
Post by: assasing123 on June 22, 2012, 10:18:38 am
In high speed mods like DE, fighter to fighter collisions are virtually nonexistant. Of course, an improvement in collision avoidance AI would also be a welcome (and long overdue) addition.
TAP says hi and would like to tell you that you are a moron. in a shieldless enviroment, with speeds around 325, a lot of fights end up as jousting matches or playing chicken with the ai. if neither budges, both of you are liable to end up in the low 20 percentile of your health, not counting shot damage.
All other mods say hi to tell you that you should update your AI and stop insulting people.

This ^^^^

and to allan, yeah i assumed it to be tons too, but then ships started to behave rather strangely, i m thinking it actually is 10 tons, and that te formula for density is sort of a curve because the mass differences between capital ships and figthers dont seem to be properly related.

has anyone on the SCP team been able yet to decipher the inner workings of this?
Title: Re: How exactly collision damage is calculated?
Post by: NGTM-1R on June 22, 2012, 10:40:24 am
In high speed mods like DE, fighter to fighter collisions are virtually nonexistant. Of course, an improvement in collision avoidance AI would also be a welcome (and long overdue) addition.

This probably has more to do with DE's use of weapons knock meaning a head-on pass causes both fighters to have difficulty holding a stable course, and frequently end up stopping each other. It's hard to make ramming contact in DE with another fighter head to head even if you mean to.
Title: Re: How exactly collision damage is calculated?
Post by: sigtau on June 22, 2012, 03:02:42 pm
<slightly offtopic> It always bothered me that my ship, when killed by a collision, had the courtesy to power down and then explode, instead of just blowing up like, y'know, a normal ship would.  :nervous: </slightly offtopic>
Title: Re: How exactly collision damage is calculated?
Post by: Sushi on June 22, 2012, 04:35:47 pm
<slightly offtopic> It always bothered me that my ship, when killed by a collision, had the courtesy to power down and then explode, instead of just blowing up like, y'know, a normal ship would.  :nervous: </slightly offtopic>

http://www.hard-light.net/wiki/index.php/Ships.tbl#.24Vaporize_Percent_Chance:

Not collision-specific, but closer. :)
Title: Re: How exactly collision damage is calculated?
Post by: Dragon on June 22, 2012, 05:16:13 pm
It seems that the whole collision damage calculation is due to a revision and value exposing. Right now, it's rather inflexible, and the formula seems arcane.
For example, it'd be nice if collision damage could be easily controlled, and ships could be forced to vaporize on a crash. Perhaps a special effect could be defined when crashing into a specific model (useful for ships with unusual hulls or landscape models). I'd also like to be able to make a ship vanish upon a crash (combined with the previous effect, it'd make for a neat "splashdown" effect in the water). I'm sure other modders can think of more uses.
Title: Re: How exactly collision damage is calculated?
Post by: MatthTheGeek on June 23, 2012, 01:40:02 am
inb4stopBackseatCoding
Title: Re: How exactly collision damage is calculated?
Post by: karajorma on June 23, 2012, 03:28:42 am
inb4nextidiotwhothinkstheywon'tgetasmackforaninb4

Seriously though, there is nothing wrong with Dragon's post.
Title: Re: How exactly collision damage is calculated?
Post by: Nuke on June 23, 2012, 04:40:10 am
damage calculation code is insanely complicated (im not even sure if the same code is used to compute collision damage). i dont ever want to look at that code again.
Title: Re: How exactly collision damage is calculated?
Post by: assasing123 on June 26, 2012, 12:44:50 pm
Yet you will have to look at it eventually, personally tho i m more curious about the mass behavior inertia and related, specially when defining it on POF files.
Title: Re: How exactly collision damage is calculated?
Post by: Nuke on June 26, 2012, 03:29:46 pm
hell no. ive seen it when trying to figure out how to set where difficulty based damage scaling is computed, so that people writing an armor table can decide to do it first, last, or in an arbitrary spot in their computations. i still have nightmares about it. im just going to stay away from damage code from this point forward.
Title: Re: How exactly collision damage is calculated?
Post by: assasing123 on July 03, 2012, 11:27:42 am
hmm do collisions type damage can be defined in tables? could at least be used along with armors tbl to hack them into doing more or less damage.