Bullet Shaping

Using the fragment system to create specific looks for a cannon projectile is called bullet shaping.

This chapter covers various types of common bullet shapes:

Fragball

A simple ball of 5 fragments that keeps its formation by inheriting velocity from the primary stage.

{ 17000
	features=CANNON
    cannon={
        damage=1
        roundsPerSec=1
        power=10
        muzzleVel=200
        range=0
		color=0xAAFFFFFF
		explosive=FINAL
		fragment={
			roundsPerBurst=5
			damage=25
			spread=360*pi/180
			muzzleVel=1
			range=    1
			color=0xAAFFFFFF
			explosive=FRAG_NOFLASH
		}
    }
}

Spikey Fragball

Same as the other fragball but with more bullets with a higher velocity so that they are rendered with longer tails.

{ 17000
	features=CANNON
    cannon={
        damage=1
        roundsPerSec=5
        power=10
        muzzleVel=1500
        range=0
		color=0xAAFFFFFF
		explosive=FINAL
		fragment={
			roundsPerBurst=12
			damage=25
			spread=360*pi/180
			muzzleVel=1
			range=    1
			color=0xAAFFFFFF
			explosive=FRAG_NOFLASH
		}
    }
}

Reverse Bullet

Simple bullet that appears backwards.

{ 17000
	features=CANNON
    cannon={
        damage=1
        roundsPerSec=1
        power=10
        muzzleVel=500
        range=0
		color=0xAAFFFFFF
		explosive=FINAL
		fragment={
			spread=180*pi/180
			pattern=CONSTANT
			explosive=FRAG_NOFLASH

			damage=50
			muzzleVel=1
			range=    0.5
			color=0xAAFFFFFF
		}
    }
}

2-Tail Bullet

Two angled bullets inherit velocity from the primary stage to create an arrow shape.

{ 17000
	features=CANNON
    cannon={
        damage=1
        roundsPerSec=1
        power=10
        muzzleVel=500
        range=0
		color=0xAAFFFFFF
		explosive=FINAL
		fragment={
			roundsPerBurst=2
			damage=25
			spread=30*pi/180
			muzzleVel=1
			range=    0.5
			color=0xAAFFFFFF
			explosive=FRAG_NOFLASH
			pattern=SPIRAL
		}
    }
}

3-Tail Bullet

Three angled bullets inherit velocity from the primary stage to create a bullet with three tails.

{ 17000
	features=CANNON
    cannon={
        damage=1
        roundsPerSec=1
        power=10
        muzzleVel=1000
        range=0
		color=0xAAFFFFFF
		explosive=FINAL
		fragment={
			roundsPerBurst=3
			damage=25
			spread=30*pi/180
			muzzleVel=1
			range=    0.5
			color=0xAAFFFFFF
			explosive=FRAG_NOFLASH
			pattern=SPIRAL
		}
    }
}

n-Point Star

The SPIRAL pattern can be used to create an star bullet with any amount of points.

For an n-pointed star, you can calculate the value for the secondary stage's spread by using the formula pi*((n-1)/n)).

For example, an 8-pointed star's spread would be calculated with pi*((8-1)/8), which would be put into the fragment as spread=pi*7/8.

{ 17000
	features=CANNON
    cannon={
        damage=1
        roundsPerSec=1
        power=10
        muzzleVel=1000
        range=0
		color=0xAAFFFFFF
		explosive=FINAL
		fragment={
			roundsPerBurst=8  -- Number of points of the star.
			damage=25
			spread=pi*7/8     -- Spread value here calculated from pi*((n-1)/n)).
			muzzleVel=1
			range=    0.5
			color=0xAAFFFFFF
			explosive=FRAG_NOFLASH
			pattern=SPIRAL
		}
    }
}

X Shape Lens Flare Bullet

Similar to the X shape lens flare always fire decoration.

A more complex bullet that creates an X-shaped bullet that always faces in the same direction using muzzleVel=0 and still travels in the fired direction by inheriting velocity from the primary stage.

The function of the stages are as follows:

  1. Creates a PSP and supplies the velocity inherited by the rest of the fragment.
  2. Stage with muzzleVel=0 to force the fragment to face either right or left.
  3. Rotates the fragment by 45° degrees.
  4. Splits the fragment into four bullets spread over a 270° spread.
  5. The actual bullet stage that can deal damage and is visible.
{ 17000
	features=CANNON
    -- 1st stage:
    cannon={   damage=1 muzzleVel=1000 range=0 color=0xAAFFFFFF explosive=FINAL              roundsPerSec=1 power=10 
    -- 2nd stage:
	fragment={ damage=1 muzzleVel=   0 range=0 color=1          explosive=FINAL|FRAG_NOFLASH
    -- 3rd stage:
	fragment={ damage=1 muzzleVel=   1 range=0 color=1          explosive=FINAL|FRAG_NOFLASH spread= 45*pi/180 pattern=CONSTANT
    -- 4th stage:
	fragment={ damage=1 muzzleVel=   1 range=0 color=1          explosive=FINAL|FRAG_NOFLASH spread=135*pi/180 pattern=SPIRAL roundsPerBurst=4
    -- 5th stage (actual bullet):
	fragment={
		damage=100
		muzzleVel=1
		range=    0.5
		color=0xAAFFFFFF
	}}}}}
}

n-Point Saw

A complex saw blade ring of bullets made out of n bullets defined by the roundsPerBurst value of the 3rd stage.

The spread of the 3rd stage can be calculated in a similar way to that of the n-Point Star, where the spread can be calculated using the formula pi*((n-1)/n)).

For example, a the spread of the 3rd stage of a 9-pointed star would be calculated with pi*((9-1)/9), which would be put into the 3rd stage as spread=pi*8/9.

The function of each stage is as follows:

  1. Creates a PSP and moves the fragment backwards a small distance. This accounts for the distance which the fragment moves forwards while assembling the saw formation so that it looks like the saw blade spawns from the right place.
  2. Reverses the fragment again so that it faces forwards without changing its position.
  3. Splits the fragment into n bullets (in this case, 9) which then travel outwards almost instantly.
  4. Cancels out the fragment's velocities so that it no longer changes position.
  5. This stage rotates by 60° anticlockwise using pattern=CONSTANT. This stage is also the actual bullet stage that can deal damage and is visible.
{ 17000
	features=CANNON
    -- 1st stage:
    cannon={   damage=1 muzzleVel=-1000 range= -10 color=0xAAFFFFFF explosive=FINAL              roundsPerSec=1 power=10
    -- 2nd stage:
    fragment={ damage=1 muzzleVel=-2000 range=   0 color=1          explosive=FINAL|FRAG_NOFLASH
    -- 3rd stage (defines how many bullets there are in the saw):
    fragment={ damage=1 muzzleVel=  400 range=  12 color=1          explosive=FINAL|FRAG_NOFLASH pattern=SPIRAL roundsPerBurst=9 spread=pi*8/9
    -- 4th stage:
    fragment={ damage=1 muzzleVel= -400 range=   0 color=1          explosive=FINAL|FRAG_NOFLASH
    -- 5th stage (actual bullet):
    fragment={
        damage=25
        spread=60*pi/180
        muzzleVel=1
        range=    0.5
        color=0xFFFFFFFF
        explosive=FRAG_NOFLASH
        pattern=CONSTANT
    }}}}}
}