Special Aircraft Service

Please login or register.

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

Author Topic: C&C Special FX  (Read 1296 times)

0 Members and 1 Guest are viewing this topic.

agracier

  • Modder
  • member
  • Offline Offline
  • Posts: 3048
    • The Great War in a Different Light
C&C Special FX
« on: March 05, 2022, 06:26:41 AM »

There are 2 C&C Special FX effects I was wondering about, the barrage - explosions over a 1kmx1km area and the fire - spawns fires in multiple locations.

I am curious if there are ways to change the effects. The barrage just seems to create concussion effects on the ground, which are nice enough, but would it be possible to have this effect create random explosions with smoke like with artillery shells exploding and impacting with smoke and debris up into the air? that way it would be more visible.

The fires being spawned seem to be a bit excessive, being massive conflagrations with large areas covered with flames. Would it be possible to create somewhat smaller fires randomly, say with more smoke rising up in the air?





Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6013
Re: C&C Special FX
« Reply #1 on: March 05, 2022, 09:44:36 AM »

I've not delved into these effects. Which class or classes define the effects used?


I see that the arty barrage uses existing explosion effects for what appears to be the 10kg class. Unless these effects also generate an explosive effect, they will be decorative only. I suppose one could specify some occasional fires/smoke of a certain duration.

I recognize the texture used for the fires, but am not certain of the effect name. This effect can certainly be changed to look better.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

agracier

  • Modder
  • member
  • Offline Offline
  • Posts: 3048
    • The Great War in a Different Light
Re: C&C Special FX
« Reply #2 on: March 05, 2022, 10:00:52 AM »

I see that the arty barrage uses existing explosion effects for what appears to be the 10kg class. Unless these effects also generate an explosive effect, they will be decorative only. I suppose one could specify some occasional fires/smoke of a certain duration.

Decorative is fine for the explosive effect ... in older versions I had, in DBW, this effect was mostly auditive, meaning it could be heard inside the cockpit which added some nice immersion. Now in BAT I can only hear the effect when outside the cockpit, when landed nearby for instance, but when flying over the area you hear and see almost nothing in the way of explosions.

I think it would add a bit more immersion if the explosions were more visible from in the air ...
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6013
Re: C&C Special FX
« Reply #3 on: March 05, 2022, 10:12:54 AM »

I haven't found the relevant class to look inside of, but with a wee deduction it looks like the random fires are:
Effects\Smokes\CityFire.eff (larger) and CityFire3.eff (smaller).

You could simply copy the contents of FireBoilingBig.eff and FireBoiling.eff, respectively, which reside in the same folder. Then you'll have more realistic looking fires. At least, if you're using my effects pack.  :D

Anyway, in order to exert more <ahem> 'control' (get it?  ;)  ), I would need to work with the class or classes. I've not found it/them thus far...
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

Checkyersix

  • Modder
  • member
  • Offline Offline
  • Posts: 1220
  • Dr. Frankenplane
Re: C&C Special FX
« Reply #4 on: March 05, 2022, 10:31:08 AM »

The effect for the Fire Unit is indeed the CityFire.eff file, while the barrage uses effects/Explodes/Air/Zenitka/Germ_88mm/Burn.eff.

CY6.
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6013
Re: C&C Special FX
« Reply #5 on: March 05, 2022, 10:41:34 AM »

The arty barrage effect must use more than that one Zenitka Burn.eff, because that's just the brief flash. There's smoke as well, and for hits on land or water there are those effects invoked as well.

Here's a first stab at the CityFire.eff situation. Could be improved...

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

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6013
Re: C&C Special FX
« Reply #6 on: March 05, 2022, 10:43:19 AM »

I do find the pattern of fires to be too dense. I'd like to cut the number in half, if not more.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6013
Re: C&C Special FX
« Reply #7 on: March 05, 2022, 11:59:21 AM »

OK. In com.maddox.il2.objects.vehicles.stationary.CandC.class we have the following three classes which control the C&C arty barrage and fire effects.

===============================================================================
For the arty barrage:
Code: [Select]
    public static class BoxUnit extends CandCGeneric
    {

        public boolean danger()
        {
            super.pos.getAbs(point3d);
            Orient orient = new Orient();
            super.pos.getAbs(point3d, orient);
            List list = Engine.targets();
            int i = list.size();
            for(int j = 0; j < i; j++)
            {
                Actor actor = (Actor)list.get(j);
                if(actor.pos.getAbsPoint().distance(point3d) < 10000D && actor.getArmy() != super.myArmy)
                {
                    String s = "weapon.bomb_std";
                    point3d.x += TrueRandom.nextDouble(-500D, 500D);
                    point3d.y += TrueRandom.nextDouble(-500D, 500D);
                    point3d.z += ((Tuple3d) (actor.pos.getAbsPoint())).z + TrueRandom.nextDouble(-150D, 150D);
                    Explosions.AirFlak(point3d, 1);
                    MsgExplosion.send(this, s, point3d, getOwner(), 0.0F, 0.9F, 0, 30F);
                    l.set(point3d, orient);
                    Eff3DActor eff3dactor = Eff3DActor.New(l, 1.0F, "effects/Explodes/Air/Zenitka/Germ_88mm/Burn.eff", 1.0F);
                    eff3dactor.postDestroy(Time.current() + 1500L);
                    LightPointActor lightpointactor = new LightPointActor(new LightPointWorld(), new Point3d());
                    lightpointactor.light.setColor(1.0F, 0.9F, 0.5F);
                    lightpointactor.light.setEmit(1.0F, 300F);
                    ((Actor) (eff3dactor)).draw.lightMap().put("light", lightpointactor);
                    super.setTimer(15);
                }
            }

            return true;
        }

        private Point3d point3d;
        private static Loc l = new Loc();


        public BoxUnit()
        {
            point3d = new Point3d();
            super.Timer1 = super.Timer2 = 0.1F;
        }
    }

The Burn.eff is used only as a 'reference' for the lightpointactor, the latter being the illumination source which lights up the immediate area. It is set to last 1.5 seconds, which is an eternity, and over a range of 300m, which is rather far. I want to lower the duration to be of about the same as for the flash effect, or ~0.1 second. The illumination range could be reduced, too. I see that the bursts are set to occur within 150m above and below the object's placement. The AirFlak method in Explosions.class sets the burst effects.


===============================================================================
For the larger fires:
Code: [Select]
    public static class FireUnit extends CandCGeneric
    {

        public boolean danger()
        {
            boolean flag = false;
            super.pos.getAbs(point3d);
            List list = Engine.targets();
            int i = list.size();
            for(int j = 0; j < i; j++)
            {
                Actor actor = (Actor)list.get(j);
                if(!flag && actor.pos.getAbsPoint().distance(point3d) < 10000D && (actor instanceof TypeBomber) && actor.getArmy() != super.myArmy)
                {
                    int k = TrueRandom.nextInt(500);
                    int l = k - 250;
                    k = TrueRandom.nextInt(500);
                    int i1 = k - 250;
                    Eff3DActor.New(this, null, new Loc(l, i1, 0.0D, 0.0F, 90F, 0.0F), 1.0F, "Effects/Smokes/CityFire.eff", 600F);
                    flag = true;
                    int j1 = TrueRandom.nextInt(10);
                    wait = (float)(1.0D + (double)j1 * 0.10000000000000001D);
                }
            }

            return true;
        }

        private float wait;
        private Point3d point3d;

        public FireUnit()
        {
            point3d = new Point3d();
            wait = 1.0F;
            super.Timer1 = super.Timer2 = wait;
        }
    }

I'm not sure how the number of fires is determined, but it seems to depend on a list count determined in class Engine.targets. Each fire lasts 600 seconds. There is a wait time, presumably for generation of a replacement fire, that randomly lasts 1-11 seconds.


===============================================================================
For the smaller fires:
Code: [Select]
    public static class BombUnit extends CandCGeneric
    {

        public boolean danger()
        {
            super.pos.getAbs(point3d);
            Aircraft aircraft = CandC.GetNearestEnemy(this, 10000F, 9);
            if(counter > 10)
            {
                counter = 0;
                startpoint.set(((Tuple3d) (point3d)).x + TrueRandom.nextDouble(-500D, 500D), ((Tuple3d) (point3d)).y + TrueRandom.nextDouble(-500D, 500D), ((Tuple3d) (point3d)).z);
            }
            if(aircraft != null && (aircraft instanceof TypeBomber) && aircraft.getArmy() != super.myArmy)
            {
                counter++;
                String s = "weapon.bomb_std";
                startpoint.x += TrueRandom.nextInt(40) - 20;
                startpoint.y += TrueRandom.nextInt(40) - 20;
                Explosions.generate(this, startpoint, 7F, 0, 30F, !Mission.isNet());
                startpoint.z = World.land().HQ(((Tuple3d) (startpoint)).x, ((Tuple3d) (startpoint)).y);
                MsgExplosion.send(this, s, startpoint, getOwner(), 0.0F, 7F, 0, 30F);
                Engine.land();
                int i = Landscape.getPixelMapT(Engine.land().WORLD2PIXX(((Tuple3d) (startpoint)).x), Engine.land().WORLD2PIXY(((Tuple3d) (startpoint)).y));
                if(firecounter < 100 && i >= 16 && i < 20)
                {
                    Eff3DActor.New(null, null, new Loc(((Tuple3d) (startpoint)).x, ((Tuple3d) (startpoint)).y, ((Tuple3d) (startpoint)).z + 5D, 0.0F, 90F, 0.0F), 1.0F, "Effects/Smokes/CityFire3.eff", 300F);
                    firecounter++;
                }
                super.setTimer(15);
            }
            return true;
        }

        private Point3d point3d;
        private static Point3d startpoint = new Point3d();
        private int counter;
        private int firecounter;


        public BombUnit()
        {
            point3d = new Point3d();
            counter = 11;
            firecounter = 0;
            super.Timer1 = super.Timer2 = 0.05F;
        }
    }

The placement of these fires would seem to be limited to map_T pixel greyscale values of 16-19 (I guess they correspond to the the load.ini City0 to City3 texture slots). Looks like up to 100 fires can exist, and each lasts for 300 seconds. They are also set to lie 5m above the object's elevation.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6013
Re: C&C Special FX
« Reply #8 on: March 05, 2022, 01:03:46 PM »

In trying out some ideas with CandC.class, I have a number of instances of a type mismatch error (totally unrelated to my wee alteration). An example from this snippet:

Code: [Select]
                    char c = (char)(int)(65D + Math.floor((d / 676D - Math.floor(d / 676D)) * 26D));
                    char c1 = (char)(int)(65D + Math.floor((d / 26D - Math.floor(d / 26D)) * 26D));
string s1;
                    if(d2 > 260D)
                        s1 = "" + c + c1;
                    else
                        s1 = c1;  //<---------------------- type mismatch

I can't see why this occurs, as it seems the variables c and c1 are characters that can be handled as strings. Adding to my confusion; the preceding construction of s1 does not induce an error...
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6013
Re: C&C Special FX
« Reply #9 on: March 05, 2022, 01:12:55 PM »

To begin with, I was wanting to try this in the BombUnit class; halve the number of fires (firecounter reduced from 100 to 50), and randomly add a smaller number of smoke columns (SmokeBoiling.eff). To start with, one smoke column per 4 fires, as follows (changes very near the end):

Code: [Select]
    public static class BombUnit extends CandCGeneric
    {

        public boolean danger()
        {
            super.pos.getAbs(point3d);
            Aircraft aircraft = CandC.GetNearestEnemy(this, 10000F, 9);
            if(counter > 10)
            {
                counter = 0;
                startpoint.set(((Tuple3d) (point3d)).x + TrueRandom.nextDouble(-500D, 500D), ((Tuple3d) (point3d)).y + TrueRandom.nextDouble(-500D, 500D), ((Tuple3d) (point3d)).z);
            }
            if(aircraft != null && (aircraft instanceof TypeBomber) && aircraft.getArmy() != super.myArmy)
            {
                counter++;
                String s = "weapon.bomb_std";
                startpoint.x += TrueRandom.nextInt(40) - 20;
                startpoint.y += TrueRandom.nextInt(40) - 20;
                Explosions.generate(this, startpoint, 7F, 0, 30F, !Mission.isNet());
                startpoint.z = World.land().HQ(((Tuple3d) (startpoint)).x, ((Tuple3d) (startpoint)).y);
                MsgExplosion.send(this, s, startpoint, getOwner(), 0.0F, 7F, 0, 30F);
                Engine.land();
                int i = Landscape.getPixelMapT(Engine.land().WORLD2PIXX(((Tuple3d) (startpoint)).x), Engine.land().WORLD2PIXY(((Tuple3d) (startpoint)).y));
                if(firecounter < 50 && i >= 16 && i < 20)  //firecounter threshold was 100
                {
                    Eff3DActor.New(null, null, new Loc(((Tuple3d) (startpoint)).x, ((Tuple3d) (startpoint)).y, ((Tuple3d) (startpoint)).z + 5D, 0.0F, 90F, 0.0F), 1.0F, "Effects/Smokes/CityFire3.eff", 300F);
if (TrueRandom.nextFloat() < 0.25)
Eff3DActor.New(null, null, new Loc(((Tuple3d) (startpoint)).x, ((Tuple3d) (startpoint)).y, ((Tuple3d) (startpoint)).z + 5D, 0.0F, 90F, 0.0F), 1.0F, "Effects/Smokes/SmokeBoiling.eff", 300F);
                    firecounter++;
                }
                super.setTimer(15);
            }
            return true;
        }
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

Wing Walker

  • member
  • Offline Offline
  • Posts: 347
Re: C&C Special FX
« Reply #10 on: March 17, 2022, 12:54:57 PM »

I do find the pattern of fires to be too dense. I'd like to cut the number in half, if not more.

Yes.

I felt the same, the flakk or the artty was nice and big, but way too concentrated to actually use.
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6013
Re: C&C Special FX
« Reply #11 on: March 17, 2022, 02:53:31 PM »

I tried to introduce some alterations to the class, but my primitive compiler throws errors (in other parts) that I don't have the ability fix. Someone more accomplished than this monkey would have to tackle this.
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.031 seconds with 24 queries.