Jump to content
Sign in to follow this  
Khalashnikovf

Nuclear Explosion - Physics Improved

Recommended Posts

Hi there. So I was playing in editor with some mission and I stucked at Nuke explosion.

There were absolutely awesome help in script by lk (in example mission "lkscriptsv08.utes").

But there was one thing I could not live with it. Damage system and affecting of units.

So I decide to made some calculating script to make some physical effects.

UPDATE 22.06.2013 - Hey, Im happy to say Im coming back and starting work on Arma 3 version of my script. I will try to do a little research for some stuff, it will take time, but will do that :)

UPDATE 06.06.2013 - Since Im not coming here so fast, you can write me mail on Khalashnikovf A gmail.com, I will notice of your message much faster then here :)

08.21.2011 - New version. Watch for log.

Lot of New Features

Vy8c_Bu4WN4

Latest video.

SK4Y5kiIUB8

-----------------------------------------------------------------

NEW v(08.21.2011)

Example Arma 2 mission v2.2: https://docs.google.com/file/d/0B7UaDhWVX77hYjJYek9Fd0N0TGs/edit?usp=sharing (Chernarus)

For those who want to work inside the math side excel for understanding (But its a mess from times when I was making it so it really needs time to study and compare with scripts)

https://docs.google.com/file/d/0B7UaDhWVX77hT3IxaG52aXBrWVk/edit?usp=sharing

- there is completely saved original lk script (with lot of modifications in nuke it self + init)

- to launch nuke pres:

- 0-0-0 (that will launch 1kT Nuke in 10 seconds after tirgger)

- Arma 2 version

-----------------------------------------------------------------

Change log

Future

- Create doMove script to force all Man units run into nearest building and lay down

- Make it possible to disable countdown timer by easy way

- Somehow ... lower the hardware exhaustion

- Improve Aperture overshine after explosion

- Make some wave turbulence flow in space, so when unit is "hidden" behind hill the shockwave impact will be different according to Huygens–Fresnel principle

2.2

- Repaired Soldier survivality by adding Huge list or CoverAble buildings for Arma 2 + OA Maps (Man unit can hide into building, lay on ground and hope for surviving, or cover behind that building)*

- Lowered another more hardware exhaustion (also a bit)

- Air units now usually survive shockwave, but their are usually so damage they cant use it anymore

2.0

- Repaired Countdown for missiles for zero time

- Lowered hardware exhaustion (a bit)

- and other little repairs

- new function in nuke set up (disabling Fallout)

2.0b

- More accurate physical attributes of vehicles

- Advanced Cloud durability and aftershock color correction timing

- Precautions when is unit hidden in building to get lower damage if building is not destroyed too (in beta)

- Different attributes of Blast and Cloud according to Power of Nuke

- Added Fallout cloud spreading into space (in beta)

1.1

- Repaired and improved Lean system

1.0

- Added "real" physical attributes to most of vehicles like length, width, height, weight and survivability according to some basic element

- Completely reworked Force and Damage system according to a wikipedia

- Added possibility to set up Nuke by your own choice (power,countdown,player indestructibility,random trigger to make more believe that someone want to blast it in "some" time

- Brightness of screen is functional to a Power of Nuke

- Added lot of sounds like Incoming Shockwave, impact into metal or body material in close/medium/far distance by a heat/shockwave, Rhumble sound of shaking ground for a little bit longer and at last: sound of shaking vehicle and metal friction according to distance

0.9

- Advance Force and Damage system

- Added countdown system with random trigger

- Modified colorCorrection system to be look more like aftershock

0.8

- Base kinematics were made

-----------------------------------------------------------------

Bugs:

- Random Trigger of Nuke does not work properly :/

- players as class "Man" are not affected by it in MP ???

- Sometimes it just happens that some Unit pushed will weirdly lean and just fly compeltely other way than it should

PLS BE AWARE THAT I NEED HELP WITH PRELOAD... when the Nuke is launched for first time after starting up game

-----------------------------------------------------------------

* If you want to use this script on community map where are community buildings, you need to create your own list or add it to one already existing.

Look in lk/nuke/coverableBuildings.sqf and add your buildings like the rest of there already. You can also share your addition here pls :)

-----------------------------------------------------------------

What I need?

- Does anyone know name of rocket model used in OA placed on SCUDs?

- I need to test behaviour of diferent types of units (if there is "real" looking force pushed certain unit)

- I need to try every possible building if unit is inside really hidden

- create a particular effects with shockwave spreading far into landscape (its really good visible here in 35 seconds)

- create particles of paint "waporazing" from vehicle (like in video)

- create particles of some parts like some metal desks, rotor, screws, etc.

H4uHVFMcpXA

--------------------------------------------------------------------------------------------

No force and damage graphs anymore.

The math is now so complex that there is no graph to be done.

Just look at http://en.wikipedia.org/wiki/Effects_of_nuclear_explosions.

This one is how Shockwave now works (of course only approximation with R = 0,91

500px-Blastcurves_psi.svg.png

This is showing how damage works

500px-Abombdamage1945.svg.png

You can find on wiki url how is determined power of Nuke according to its Blast and Cloud height.

By my studies is Power of nuke in Arma 2 circa 0,4kT :D

---------- Overpressure graph ------------------------------------------

http://img412.imageshack.us/img412/8569/shockwavep.jpg

What is that?

Its a schema how is shockwave powerful in certain area of space.

There is BLUE CURVE which is Ideal position of maximal Overpressure in air

The GREEN CURVE is where is happening to change function into circle.

So if some vehicle (1) is on that position where is ORANGE DOT, it need to be computed on zChange curve then via y = -kx + q compute it on zMaxima curve and than find its cross on Height = 0 because that is the place where is known equation about overpressure force. So the every unit which could actually be on those three curves would be Overpressured within same power.

Once it gets x0 value you can see how many Overpressure is there by that RED hyperbolic curve which is actually three times larger to be easily readable on this graph

----------------System of radiation ----------------------------------

This graph shows us how much radiation will unit get in time zero of blast for a three seconds.

http://img59.imageshack.us/img59/5419/radiationinspace.jpg

And this one shows us what is happening with heat in time of 300 seconds

http://img16.imageshack.us/img16/900/radiationintime.jpg

--------------- For show ---------------------------

This shows how Heat and Shock waves are spreading in space.

heatWaveSpreadDistance = 0;
shockWaveSpreadDistance = 0;
radTime = (ln(_kT)+1) * 6666; // Endurance of Radiation time in air
heatTime = (ln(_kT)+1) * 167; // Endurance of Heat time in air
shockDistance = (ln(_kT)+1) * 3333; // How far will shockwave spread
heatDistance = (ln(_kT)+1) * 6666; // How far will heatwave spread
AllArray = [];
timeAfter = 0;
plus = (2.5 + random 1);
while {shockWaveSpreadDistance < (shockDistance - 1)} do {
heatPlus = ln(heatDistance - heatWaveSpreadDistance)*((ln(_kT)+1)*58)/10;
if (heatPlus > 0) then {heatWaveSpreadDistance = heatWaveSpreadDistance + heatPlus; };
if (heatWaveSpreadDistance >= (heatDistance - 1)) then {heatWaveSpreadDistance = (heatDistance);};
shockWaveSpreadDistance = shockWaveSpreadDistance + ln(shockDistance - shockWaveSpreadDistance)*((ln(_kT)+1)*21)/10;
sleep 0.1;
};

This will count Overpressure in air:

	// -- Overpressure in air
_xPos = ((position _unit select 0) - (position _pos select 0));
_yPos = ((position _unit select 1) - (position _pos select 1));
_zPos = ((position _unit select 2) - (position _pos select 2));

_GR = sqrt(_xPos^2 + _yPos^2); // GR = Ground radius
_zMaxima = 8 * _GR^0.5;
_zChange = 15 * _GR^0.5;

// IF VEHICLE IS ABOVE CHANGING CURVE y = 15*x^0.5 AND IS IN y = sqrt(R^2 - x^2)
if (_zPos > _zChange) then
	{
	_rad = _unit distance _pos;
	_crossXUp = 1/2*(sqrt(4*_rad^2+50625)-225);
	_crossZUp = 15 * _crossXUp^0.5;
	_k2 =(_crossZUp + 300)/(_crossXUp - 4000);
	_q2 = _crossZUp - _crossXUp*_k2;
	_crossXInter = (- _k2*_q2-8*sqrt(16-_k2*_q2)+32)/_k2^2;
	_crossZInter = 8 * _crossXInter^0.5;
	_k1 =(_crossZInter + 500)/(_crossXInter - 150);										
	_x0 = (500 + _k1*150)/ _k1;
	};	
// IF VEHICLE IS BETWEEN CHANGING CURVE y = 15*x^0.5 AND MAXIMUM CURVE y = 8*x^0.5 AND IS IN y = -kx + q
if (_zPos > _zMaxima and _zPos <= _zChange) then
	{
	_k2 =(_zPos + 300)/(_GR - 4000);
	_q2 = _zPos - _GR*_k2;
	_crossXInter = (- _k2*_q2-8*sqrt(16-_k2*_q2)+32)/_k2^2;
	_crossZInter = 8 * _crossXInter^0.5;
	_k1 =(_crossZInter + 500)/(_crossXInter - 150);										
	_x0 = (500 + _k1*150)/ _k1;
	};
// IF VEHICLE IS BELLOW MAXIMUM CURVE y = 8*x^0.5 AND IS IN y = kx + q
if (_zPos <= _zMaxima) then
	{
	_k1 =(_zPos + 500)/(_GR - 150);
	_x0 = (500 + _k1*150)/ _k1;
	};
//FOR MORE INFO ABOUT THESE APROXIMATED FUNCTIONS VISIT http://en.wikipedia.org/wiki/Effects_of_nuclear_explosions

_overPressure =((15.071*_kT^0.5131)*(_x0/1000)^(-0.016*ln(_kT) - 1.4113));

And this will set damage:

_dir = getDir _unit;
_diference = abs(_blastDir - _dir);
_cubature = (abs(_lenght* sin(_diference)) + abs(_width * cos(_diference))*_height);
_force = _overpressure * _cubature;

_acc = 100*(_force / _weight);

// -- Defining damage to a vehicle + extra damage to its own weak parts like Engine,Electronics
_dam = _overPressure / (_steel * 8);

if (_dam > 1) then {_dam = 1;};
_unit setDamage ((Damage _unit) + _dam);
{_x setDamage ((Damage _x) + _dam)} forEach crew _unit;

How to setup your Wanted Nuke?

nul = [nukePos,1,true,480,true,false,true,20] execvm "lk\nuke\nuke_countdown.sqf";

- nukePos = Position where will Nuke detonate or Land

- 1 = yield of Nuke, it is defined in kT (so Hiroshima is 16)

- true = if the Nuke should Land like a missile from Air

- 480 = Countdown to Nuclear Detonation

- true = Fallout active

- false = Should be players immortal according to Nuke?

- true = Should Nuke detonate randomly?

- 20 = Is time spread when Nuke can detonate earlier before countdown drops to zero or later after zero Contdown.

The only thing you have to setup is position of the Nuke, anything else is set in default way.

Edited by Khalashnikovf

Share this post


Link to post
Share on other sites
This is awesome! I love the effects and physics. Have you sent it to LK?

Not yet, this is just only start of my work.

In short ... For now: Every type of vehicles have got its own "Coeficient" which defines how much is that type resistant against that blast. That will be a lot of work to do.

This is the basic equation which defines a Force which affect vehicle:

_force = (cos (((_rad - _min)/(_max - _min)) * 180)+1)/2*(_coef/ln(_rad));

This defines size from 1 to 0 according to how far from center is that unit and than some multiplier based on that certain coeficient and natural logarithm of distance. Its makes kinda sense and similar kind of equation fits to damage and that "leaning" of vehicle or any unit.

I need lot of testing and ppl able to test it for me before I send this to anywhere :)

Share this post


Link to post
Share on other sites

I'm sorry, but this is not physics. The numbers looks arbitrary, stepped zones vs actual range calculations, etc.

It may be an improvement, but please don't call it realistic.

Share this post


Link to post
Share on other sites
I'm sorry, but this is not physics. The numbers looks arbitrary, stepped zones vs actual range calculations, etc.

It may be an improvement, but please don't call it realistic.

Pls, tell where I said its realistic?

And comparing to rest of Arma physics, this is actual on same level... I guess

Share this post


Link to post
Share on other sites

You did imply it strongly by talking about the need to improve the physics, including scripts, plots of force curves, and mentioning "real looking forces". But let's not haggle semantics.

While some things are simplified, BI does not use arbitrary functions in their code. Measuring damage at fixed intervals from a bomb or satchel blast will clearly show how it works.

Basic physics shows that, ignoring absorption by intervening media, weapon blast damage should be proportional to 1/distance^3, a curve that drops dramatically. Your damage curve is practically linear - which would cause far too much damage at long range.

You could still use stepped zones as quick approximation, just adjust your numbers to match the inverse cube relation I mentioned. However using nested nearObjects commands is quite expensive computationally. FYI.

Share this post


Link to post
Share on other sites

Well, my functions are based on fact, that in original lk script is constant damage set to 1 in radius 1000 metres which i basicaly kept but a bit improved so there could some chance to survive if you are in any armored or whatever else than Man unit.

your hyperbolic curve would be truly nice, but vehicles in 200 metres distance wouldnt be even scratch by that nuke.

FYI - whole Nuke blast effect is "quite expensive computationally" thats the reason why i quited damaging of buildings by this same way and I made it in zones.

Share this post


Link to post
Share on other sites

Where did you get your facts from?

I use multiple curves, based on the various weapon effects. Calibrated to real data and functions from legitimate unclassified sources. And that curve is not hyperbolic, its a inverse-power function.

Clearly both of us cannot be correct, so is the US Dept of Energy wrong or are you making things up?

I respect your attempt to develop a better nuke, that is commendable. But wish the result would more closely model the real thing. If that is not the goal, then just be upfront about it to not deceive those expecting something else.

Share this post


Link to post
Share on other sites

Of course that I made it up, what you thought?

I made this function to at least simulates what lk made within his own nuke script. and than apply some hyperbolic rules (what that cos function works for)

If I would use only simple triple hyberpolic curve it would just do some damage to 100 metres units and there nothing.

But: If you have some suggestion to function ... tell me pls, I will make some graphs to watch it and lets see :)

Share this post


Link to post
Share on other sites

i dont know much about the physics of explosions, but i think echo has a point about the force graph. But the reason why the force would stop at 100m and do nothing would be because the number is not high enough. You would have to get a hold of some real data that measures the force of a nuclear bomb at certain ranges, and then apply the tables to scale with your nuke.

from that test video, the force of impact stretched out for more than a km, but the last 500 m or so was nothing but a slightly strong wind.

but correct me if im wrong, but wouldnt the force of a nuke have further range then the damage of it? the effects of the heat from the blast dissipates over time, most of it going into the atmosphere, but the force of impact would travel much further. (not sure about this tho, i may be wrong here)

also, maybe adding a flashbang sort of effect that if you stare at the blast, you would go blind (which is a reality depending on what range you were watching the blast from) the intense brightness and heat would probably melt your eyes if watching 2km away.

Share this post


Link to post
Share on other sites

if one looks in the newest mando missiles.. EE did the blast waves for him:)

Share this post


Link to post
Share on other sites

also, maybe adding a flashbang sort of effect that if you stare at the blast, you would go blind (which is a reality depending on what range you were watching the blast from) the intense brightness and heat would probably melt your eyes if watching 2km away.

That's already in Loki's, he's just doing the shockwave effect.

Share this post


Link to post
Share on other sites
if one looks in the newest mando missiles.. EE did the blast waves for him:)

Cant find it... how does it work? Can you link me pls?

Well, I will try to make new functions for damage. Can be damage, like number, hugher than 1 an it still will count like damage 1 ?

EDIT: Like I said. I was just trying with these function to support old lk's script and his damage system, where were every unit damaged to 1 in 1000 metres around and all rest to another 0.4 in 1500 metres.

And there is diference between soldier and tank for sure. I will test something....

---------- Post added at 11:14 ---------- Previous post was at 10:10 ----------

Well, is this what you would like to?

http://img263.imageshack.us/img263/4064/damagedistance.jpg

New function defined like: Damage = coeficient^5 / distance^4

That coeficient is just only a number: I would like to create some equation based on material and weight of object.

---------- Post added at 12:04 ---------- Previous post was at 11:14 ----------

And this would be graph of Force (in m/s).

http://img228.imageshack.us/img228/9476/forcedistance.jpg

This function: Force = coeficient^3 / distance^2

---------- Post added at 12:30 ---------- Previous post was at 12:04 ----------

and this would be graph of Lean (1 or more is 90°)

http://img411.imageshack.us/img411/4851/leandistance.jpg

Function: Lean = ln(coeficient^3 / distance^2) / 3

---------- Post added at 13:31 ---------- Previous post was at 12:30 ----------

New video in first topic :) Works pretty good

Share this post


Link to post
Share on other sites
http://forums.bistudio.com/showthread.php?t=89912

keep up the good work. looking better :)

link is not working.

Well, I guess that Im done with physic part.

Now I really need help with that shockwave in partical effetcs, thats completely out of my league... :(

And I also need to get some sound of incoming shockwave and impact (will find some to fit)

---------- Post added at 20:13 ---------- Previous post was at 20:02 ----------

I forgot on: How can I change color theme to Sepia directly in mission like it is in module?

Share this post


Link to post
Share on other sites

hmm cant u just launch the module when the nuke goes off? im sure theres a way to activate a module any time in game.

Share this post


Link to post
Share on other sites

Cheers for this.

I'm finding the push, and the damage, to be rather low against armoured targets, yet the push against the helicopers seems rather high.

If one were <500m from a 15 KT nuke, surely their tank would be moved, and be damaged beyond the orange status (in the top left). I can't imagine what it would do... but it wouldn't be pretty.

And do these nukes have fallout/radiation afterwards?

Share this post


Link to post
Share on other sites
Cheers for this.

I'm finding the push, and the damage, to be rather low against armoured targets, yet the push against the helicopers seems rather high.

If one were <500m from a 15 KT nuke, surely their tank would be moved, and be damaged beyond the orange status (in the top left). I can't imagine what it would do... but it wouldn't be pretty.

And do these nukes have fallout/radiation afterwards?

Its based on older loki's script, so there is his kind of radiation which i remastered to image of mine. So every unit and vehicle is affected by it.

And its exactly by this formula:

// -- Aftershock (Cycle which counts with Heat and Radioation in time)
if (damage _unit < 1) then
{
while {damage _unit < 1  or timeAfter < radTime} do
{
		if (timeAfter <= heatTime) then
		{
		_heatRad = (_coef^4/(_unit distance _pos)^4)*(cos(timeAfter/heatTime*180)+1)/2*3/4;
		};
		_radRad  = (_coef^4/(_unit distance _pos)^4)*(cos(timeAfter/radTime*180)+1)/2*1/4;
		_unit setDamage (Damage _unit + _heatRad + _radRad);
		{_x setDamage  (Damage _x + (_heatRad + _radRad)/ln(_coef / 3))} forEach crew _unit;

		sleep plus;
		};

As you can see, there is some kind of hyperbolic curve which fits to this problem. And function is measured in double standard, one for Heat which will disappear in shorter time than radiation which stands much longer.

And with tank: I cannot modife it somehow. Its just all about math where tank (M1A1) weight is about 60 000 kg and that to much for even such a strong wave. But you can see how its flying when its close enough :)

Also should be noted that to prevent some really nonsence shock pushes I "waporized" some closest units also according to power of nuke.

Share this post


Link to post
Share on other sites

Energy like blast, radiation use functions that varies by radius^(-3).

Some other aspects like size of fireball vary by yield^(1/5). Just FYI.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×