← Home SEEBIE90 DOCS
The RIM-116 & Phalanx mod is published under the Arma Public License (APL)Example code is free to useSuggestions: Discord to the author

RIM-116 & Phalanx

The gun variant

A very fast-firing gun against incoming ordnance, in an engine that cannot represent every round as an entity. Build it as a subclass: almost everything about an air defence mount is not weapon-specific.

In plain wordsA six-barrel gun built as a subclass of the missile mount. One visible projectile stands for several rounds, because thousands of real entities would melt the server.

Inheritance, not a second component

Both mounts share nearly everything: target acquisition, faction assignment, supply from their own container, damage grades with repair, status lamp, alarm, radar coverage, battery logic, slewing. That is a couple of thousand lines nobody maintains twice – a correction to the damage logic would have to be made in two places, and the second would eventually be forgotten.

Remarkably little is weapon-specific, and that little is what the subclass contains. The moving parts map one to one:

Missile mountGun mountMotion
turret entityturret with the armstraverse
box entitycradle with radome and gunelevation
–barrel clusterrotation – new in the subclass

The cradle carries the radome, which is correct: it sits on the gun's frame and has to move with it.

Example code – free to use
class MyAD_GunMount : MyAD_Mount
{
	protected IEntity m_Barrels;		// the only new moving part

	override int AmmoPerUnit()		{ return 100; }		// supply cost per reload step
	override float FireRateVsOrdnance()	{ return 4500; }	// rounds per minute (example value)

	// everything else - tracking, factions, damage, lamps, radar - is inherited unchanged
}
NoteLet the cells become rounds: keep the field names, count cartridges instead of missiles. Supply display, lamp states and resupply then keep working unchanged, with no second count beside them.

One projectile stands for several rounds

At four thousand rounds per minute that is dozens of entities per second per mount, which is not viable. Let one visible projectile represent a number of rounds: deduct the ammunition accordingly and give the projectile prefab matching damage.

Example code – free to use
void MyAD_GunMount_Fire()
{
	SpawnProjectile(m_Muzzle);
	m_iRounds -= ROUNDS_PER_PROJECTILE;		// one visible projectile = several real rounds
}
PitfallA barrel spin that matches the real gun can alias against the frame rate, so the barrels appear to rotate BACKWARDS. Spin the cluster slower than reality – a case where the correct number is the wrong one.

Reverse-engineer the damage from the target rather than guessing it: if a helicopter has a known hull value and only part of the requested damage lands, work back from “two hits should bring it down” to the figure for the cone centre.

Sound has to follow the gun, not the burst

A single shot is very short and needs a small tail to sound like a burst at all. Make the tail too long and short bursts sound longer than the weapon visibly fires – fire sound, muzzle flash and tracers come apart. Keep the tail just long enough to join single shots, then play a separate spin-down sound.

Shot→Looping fire sound→Short tail after the last shot→Spin-down sound

It catches shells in the ascent

With the ballistic predictor from the fire control page, mortar rounds are intercepted on the way up rather than on the way down. Let the gun open fire with a larger aim tolerance than the launcher, because a gun fires while still slewing.

Example code on this page is free to use in your own projects (credit appreciated). The RIM-116 & Phalanx mod is published under the Arma Public License (APL). Suggestions: Discord. Arma Reforger / Enfusion are trademarks of Bohemia Interactive.
Impressum · Privacy Policy