Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Development of bomb-carrying plane detonations  (Read 312 times)

0 Members and 1 Guest are viewing this topic.

WxTech

  • Modder
  • member
  • Online Online
  • Posts: 6040
Development of bomb-carrying plane detonations
« on: April 17, 2024, 01:12:11 PM »

I've been adding a new feature whereby the mass of ordnance on a plane is used to generate the probability of a suitable explosion when crashing onto land or water, or blowing up in the air. There are three main effects used for different payload mass, and there is some randomness in the selection of which effect to use so as to avoid a repetitious sameness.

I'll be tweaking the probabilities of these explosions, working on the premise that they would be comparatively uncommon. Perhaps, if I have the ability, I might look at a special treatment for Kamikaze, where these detonations should be more common given that the plane payloads were rigged to blow on contact.


In this view from the Kamikaze track, a Zero carrying a bomb has blown up in the air just before reaching its target. Because the explosion is near enough to the surface, high velocity shrapnel splash on the surface directly under the blast is generated also. Note the Betty getting very near to the carrier's waterline.




The Betty mentioned previously has just crashed in the water just shy of the hull and very near the stern, but its payload has not exploded. Another Zero has just about hit the hull's waterline amidships, the big burst creating shrapnel splash. Yet another Zero has just hit the deck near the stern, with a shock wave emanating forth. (This is a new, extra version of the shock wave for Pacific maps, having a fuller aspect to simulate the higher moisture content in the air.) The last Hellcat that was waiting to take off has just erupted into a fireball.

Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Online Online
  • Posts: 6040
Re: Development of bomb-carrying plane detonations
« Reply #1 on: April 17, 2024, 01:22:22 PM »

Here's the stock Aircraft.doExplosion() method. Pretty basic! It calls just the one and same method for each of water crashes, land crashes and air explosions. (For the surface crashes, they're considered to be so when the plane's position has it no farther above the surface than 1/2 the plane's length as specified in the FM. Any higher and the air explosion effect set is utilized.)

Code: [Select]
protected void doExplosion()
{
if(FM.Loc.z < Engine.cur.land.HQ_Air(FM.Loc.x, FM.Loc.y) + (double)(FM.Length / 2.0F))
{
World.cur();
if(World.land().isWater(FM.Loc.x, FM.Loc.y))
Explosions.AirDrop_Water(FM.Loc);
else
Explosions.AirDrop_Land(FM.Loc);
} else
{
Explosions.ExplodeFuel(FM.Loc);
}
}


Here's the current state of the new treatment. It utilizes new methods elsewhere, such as in Explosions.class. I should point out that not just these new explosions are part of the new treatement. The 'basic' crash effects have variation as well, based on the number of engines (as a measure of size) and with some randomness.

Code: [Select]
protected void doExplosion()
{
Vector3d vector3d = new Vector3d();
vector3d.set(FM.Vwld);
if(FM.Loc.z < Engine.cur.land.HQ_Air(FM.Loc.x, FM.Loc.y) + (double)(FM.Length / 2.0F))
{
iEng = FM.EI.getNum();
iExplode = 0;
World.cur();
if(World.land().isWater(FM.Loc.x, FM.Loc.y))
{
if(FM.CT.getWeaponMass() > 10F)
{
if(FM.CT.getWeaponMass() > 500F)
{
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.BOMB1000a_Object(FM.Loc, -1.0F, 1.0F);
MsgExplosion.send(null, null, FM.Loc, null, 1000F, 500F, 1, 200F);
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.BOMB250_object(FM.Loc, -1.0F, 1.0F);
MsgExplosion.send(null, null, FM.Loc, null, 250F, 125F, 1, 100F);
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.ExplodeAmmo(FM.Loc, 2);
iExplode = 2;
}
}
else
if(FM.CT.getWeaponMass() > 100F)
{
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.BOMB250_object(FM.Loc, -1.0F, 1.0F);
MsgExplosion.send(null, null, FM.Loc, null, 250F, 125F, 1, 100F);
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.ExplodeAmmo(FM.Loc, 2);
iExplode = 2;
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.ExplodeAmmoSmall(FM.Loc, 2);
iExplode = 1;
}
}
else
{
if(TrueRandom.nextFloat() < 0.5F)
{
Explosions.ExplodeAmmoSmall(FM.Loc, 2);
iExplode = 1;
}
}
}
else
{
if(iEng > 1 && TrueRandom.nextFloat() < 0.25F)
{
if(TrueRandom.nextFloat() < 0.1F + cvt((float) vector3d.z, -10F, -50F, 0F, 0.15F))
{
Explosions.BOMB250_object(FM.Loc, -1.0F, 1.0F);
MsgExplosion.send(null, null, FM.Loc, null, 250F, 125F, 1, 100F);
}
else
if(TrueRandom.nextFloat() < 0.3F)
{
Explosions.ExplodeAmmo(FM.Loc, 2);
iExplode = 2;
}
else
{
Explosions.ExplodeAmmoSmall(FM.Loc, 2);
iExplode = 1;
}
}
if(iEng == 1 && TrueRandom.nextFloat() < 0.2F)
{
if(TrueRandom.nextFloat() < 0.1F + cvt((float) vector3d.z, -20F, -75F, 0F, 0.1F))
{
Explosions.BOMB250_object(FM.Loc, -1.0F, 1.0F);
MsgExplosion.send(null, null, FM.Loc, null, 250F, 125F, 1, 100F);
}
else
if(TrueRandom.nextFloat() < 0.5F)
{
Explosions.ExplodeAmmoSmall(FM.Loc, 2);
iExplode = 1;
}
}
}
Explosions.AirDrop_Water(FM.Loc, iEng, iExplode);
}
else  //if land  =========================================================================
{
if(FM.CT.getWeaponMass() > 10F)
{
if(FM.CT.getWeaponMass() > 500F)
{
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.BOMB1000a_Land(FM.Loc, 4.0F, 1.0F, false, true);
MsgExplosion.send(null, null, FM.Loc, null, 1000F, 500F, 1, 200F);
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.BOMB250_Land(FM.Loc, 4.0F, 1.0F, false, true);
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.ExplodeAmmo(FM.Loc, 0);
iExplode = 2;
}
}
else
if(FM.CT.getWeaponMass() > 100F)
{
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.BOMB250_Land(FM.Loc, 4.0F, 1.0F, false, true);
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.ExplodeAmmo(FM.Loc, 0);
iExplode = 2;
}
else
if(TrueRandom.nextFloat() < 0.25F)
{
Explosions.ExplodeAmmoSmall(FM.Loc, 0);
iExplode = 1;
}
}
else
{
if(TrueRandom.nextFloat() < 0.5F)
{
Explosions.ExplodeAmmoSmall(FM.Loc, 0);
iExplode = 1;
}
}
}
else
{
if(iEng > 1 && TrueRandom.nextFloat() < 0.25F)
{
if(TrueRandom.nextFloat() < 0.2F + cvt((float) vector3d.z, -10F, -50F, 0F, 0.3F))
{
Explosions.BOMB250_Land(FM.Loc, 4.0F, 1.0F, false, true);
}
else
if(TrueRandom.nextFloat() < 0.3F)
{
Explosions.ExplodeAmmo(FM.Loc, 0);
iExplode = 2;
}
else
{
Explosions.ExplodeAmmoSmall(FM.Loc, 0);
iExplode = 1;
}
}
if(iEng == 1 && TrueRandom.nextFloat() < 0.2F)
{
if(TrueRandom.nextFloat() < 0.2F + cvt((float) vector3d.z, -20F, -75F, 0F, 0.3F))
{
Explosions.BOMB250_Land(FM.Loc, 4.0F, 1.0F, false, true);
}
else
if(TrueRandom.nextFloat() < 0.5F)
{
Explosions.ExplodeAmmoSmall(FM.Loc, 0);
iExplode = 1;
}
}
}
Explosions.AirDrop_Land(FM.Loc, iEng, iExplode);
}
} else
{
Explosions.ExplodeFuel(FM.Loc, iEng);

if(FM.CT.getWeaponMass() > 500F && TrueRandom.nextFloat() < 0.2F)
{
Explosions.BOMB1000a_Object(FM.Loc, -1.0F, 1.0F);
MsgExplosion.send(null, null, FM.Loc, null, 1000F, 500F, 1, 200F);
}
else
if(FM.CT.getWeaponMass() > 100F && TrueRandom.nextFloat() < 0.2F)
{
Explosions.BOMB250_object(FM.Loc, -1.0F, 1.0F);
MsgExplosion.send(null, null, FM.Loc, null, 250F, 125F, 1, 100F);
}
}
}
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

Kopfdorfer

  • member
  • Offline Offline
  • Posts: 2167
  • PULVERIZER
Re: Development of bomb-carrying plane detonations
« Reply #2 on: April 17, 2024, 02:15:06 PM »

Does this encompass the effect of a non-ordnance carrying aircraft when colliding with a ship (other body?)?
Logged

WxTech

  • Modder
  • member
  • Online Online
  • Posts: 6040
Re: Development of bomb-carrying plane detonations
« Reply #3 on: April 17, 2024, 03:05:38 PM »

Collisions with objects, including while taxying at low speed, are handled elsewhere.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Online Online
  • Posts: 6040
Re: Development of bomb-carrying plane detonations
« Reply #4 on: April 17, 2024, 07:12:58 PM »

The search results for "kamikaze" in all B.A.T. 4.0 classes. Maneuver.class seems to provide the best 'universal' determinant. Is there any other mission related action that would be 'kamikaze'-like?


Code: [Select]
Search "kamikaze" (24 hits in 8 files)
  C:\IL2 Stuff\SELF_CONTAINED_DECOMP_COMP_BAT_4.0\Java_BAT_WW2\com\maddox\il2\ai\air\AirGroup.java (1 hit)
Line 993:             maneuver.kamikaze = true;
  C:\IL2 Stuff\SELF_CONTAINED_DECOMP_COMP_BAT_4.0\Java_BAT_WW2\com\maddox\il2\ai\air\Maneuver.java (6 hits)
Line 232:         kamikaze = false;
Line 4937:             groundAttackKamikaze(target_ground, f);
Line 5059:                 groundAttackKamikaze(target_ground, f);
Line 5555:     private void groundAttackKamikaze(Actor actor, float f)
Line 10396:     public boolean kamikaze;
Line 10535:     public static final int GATTACK_KAMIKAZE = 46;
  C:\IL2 Stuff\SELF_CONTAINED_DECOMP_COMP_BAT_4.0\Java_BAT_WW2\com\maddox\il2\ai\air\ManString.java (1 hit)
Line 49:         "RANVERSMAN   ", "CUBAN        ", "CUBAN_INVERT ", "GATTACK      ", "PLT_OFFLINE  ", "HANG_ON      ", "KAMIKAZE     ", "ATTACK_B_HAR ", "DELAY        ", "DITCH        ",
  C:\IL2 Stuff\SELF_CONTAINED_DECOMP_COMP_BAT_4.0\Java_BAT_WW2\com\maddox\il2\objects\air\FI_103_V1.java (1 hit)
Line 111:         ((Pilot)FM).kamikaze = true;
  C:\IL2 Stuff\SELF_CONTAINED_DECOMP_COMP_BAT_4.0\Java_BAT_WW2\com\maddox\il2\objects\air\KI_48_II_KAMIKAZE.java (8 hits)
Line 4: // Source File Name:   KI_48_II_KAMIKAZE.java
Line 23: public class KI_48_II_KAMIKAZE extends KI_48
Line 27:     public KI_48_II_KAMIKAZE()
Line 33:         return "KAMIKAZE_";
Line 101:         Class class1 = com.maddox.il2.objects.air.KI_48_II_KAMIKAZE.class;
Line 103:         Property.set(class1, "iconFar_shortClassName", "Kamikaze");
Line 104:         Property.set(class1, "meshName", "3do/plane/Ki-48-II(Multi1)/KAMIKAZE_hier.him");
Line 106:         Property.set(class1, "meshName_ja", "3do/plane/Ki-48-II(ja)/KAMIKAZE_hier.him");
  C:\IL2 Stuff\SELF_CONTAINED_DECOMP_COMP_BAT_4.0\Java_BAT_WW2\com\maddox\il2\objects\sounds\Voice.java (1 hit)
Line 138:             if(((Maneuver)aircraft.FM).kamikaze)
  C:\IL2 Stuff\SELF_CONTAINED_DECOMP_COMP_BAT_4.0\Java_BAT_WW2\com\maddox\il2\objects\vehicles\planes\KI_48_II_KAMIKAZE.java (3 hits)
Line 4: // Source File Name:   KI_48_II_KAMIKAZE.java
Line 9: public class KI_48_II_KAMIKAZE
Line 12:     public KI_48_II_KAMIKAZE()
  C:\IL2 Stuff\SELF_CONTAINED_DECOMP_COMP_BAT_4.0\Java_BAT_WW2\com\maddox\il2\objects\vehicles\planes\Plane.java (3 hits)
Line 7015:     public static class KI_48_II_KAMIKAZE extends PlaneGeneric
Line 7018:         public KI_48_II_KAMIKAZE()
Line 13862:         new PlaneGeneric.SPAWN(com.maddox.il2.objects.vehicles.planes.Plane$KI_48_II_KAMIKAZE.class);
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)
Pages: [1]   Go Up
 

Page created in 0.036 seconds with 24 queries.