Special Aircraft Service

Please login or register.

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

Author Topic: Unguided rocket irregular flight path  (Read 127 times)

0 Members and 1 Guest are viewing this topic.

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6040
Unguided rocket irregular flight path
« on: June 24, 2024, 12:58:26 PM »

I've already written hereabouts in the not too distant past about my efforts in cooking up an algorithm for introducing user controllable randomness in unguided rocket firings. The stock realism setting for "realistic rocket spread" is hardly that! It's simply effectively has each group of launch rails/tubes bolted on with some random aim offset. All rockets fired from that group follow EXACTLY the same launch direction. Bad!

I've broken down rocket spread into three components, all user settable to taste via conf.ini [Mods] section entries:
- The aforementioned rail/tube group mounting error.
- An additional initial, random aim error for each and every rocket individually (true randomness).
- Flight path irregularity due to inherent fabrication error and air turbulence.

In the screenie below I highlight that last element, flight path irregularity, as revealed by the departures from straight-line flight in the smoke trail. This is about 2/3-3/4 the maximum value that one can set in conf.ini. I dynamically vary the magnitude of the oscillations by height above the surface, as a reflection of the way turbulence tends to vary with height. At the surface the magnitude is 89% of full intensity (as set by the player), at 100m full intensity, at 400m 2/3 intensity, at 2,000m and higher 1/3 intensity. From the surface to 2,000m the magnitude is smoothly changing, as the code below shows.

It looks really neat to see rockets do a bit of a 'wiggle' as they fly down range, after seeing real unguided rockets do the same in film clips. The averaging of the random impulses results in the impact point not departing too greatly due to this effect alone, but there is definitely a randomizing error due to this. Add in the additional initial, random launch direction offset, and the impact point of the rockets becomes even more uncertain. The first source of error listed above, that being the rail/tube group attachment offset (which is the only stock element introduced), I personally leave as pretty small; the other two sources of aim error are quite enough to deal with. ;)

Again, these three error sources are individually and smoothly tuneable to taste, from non-existent to rather 'strong'.

This view is highly zoomed in, resulting in no small apparent compression in depth. This makes the flight path departures stand out more clearly. Note that the smoke trail length here is for the full 1 second duration for such smoke generation. Note also the denser smoke at the beginning of the rocket firing. This is a separate smoke effect to apply briefly for the motor start, which B.A.T. has deleted. I've restored it in my effects mod pack.



For those interested, here's the brand new method for unguided rocket flight oscillation I added in Wind.class:
Code: [Select]
    public void getVectorRocket(Point3d point3d, Vector3d vector3d)
//NEW by WxTech; applies turbulent oscillation to unguided rockets only; called by MODDED Ballistics.class (and Rocket.tick())! Must include wind
//REQUIRES that difficulty settings for wind 'n turbulence AND realistic gunnery be enabled!
{
float AGL = (float) (point3d.z - Engine.cur.land.HQ(point3d.x, point3d.y));  // height AGL
vector3d.set(steady);  //must be here (invoke wind nowhere else)
vector3d.scale(windVelocity(AGL));  //must be here (invoke wind nowhere else)
Disp = RocketOscillation / 3.0F;  //1/3 magnitude >= 2000m AGL
if (AGL < 2000.0F)
Disp = RocketOscillation / 1.5F;  //2/3 magnitude 400m to 2000m AGL
if (AGL < 400.0F)
Disp = RocketOscillation * (1F - (Math.abs(AGL - 100F)) + 900F) / 900F;  //0.89 amplitude at surface, full amplitude at 100m AGL, 2/3 amplitude 400m AGL
if (Time.current() - tmgst > 100L + (long) ext)  //duration range 100-300ms; time interval 0.1-0.3s
{
duration = Time.current() - tmgst;
ext = TrueRandom.nextInt(0, 200);
tmgst = Time.current();
vx = TrueRandom.nextFloat(-Disp, Disp);
vy = TrueRandom.nextFloat(-Disp, Disp);
vz = TrueRandom.nextFloat(-Disp, Disp);
vx *= 1F - (Math.abs(vx) / Disp) * (1F - (1F - (1.7F - duration) / 2F) / 300F);  //for min duration/max Disp, scales vector down to as little as 2/3 intensity (to reduce sharp lurches)
vy *= 1F - (Math.abs(vy) / Disp) * (1F - (1F - (1.7F - duration) / 2F) / 300F);
vz *= 1F - (Math.abs(vz) / Disp) * (1F - (1F - (1.7F - duration) / 2F) / 300F);
}
if (Time.current() - tmgst < duration && Time.current() > duration)
{
vx_1 = (vx * (float) (Time.current() - tmgst) / (float) (duration - 10L));
vy_1 = (vy * (float) (Time.current() - tmgst) / (float) (duration - 10L));
vz_1 = (vz * (float) (Time.current() - tmgst) / (float) (duration - 10L));
vector3d.add((double) vx_1, (double) vy_1, (double) vz_1);
}
}
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 26 queries.