|Creating Weapons for Micro Flight|
Weapons in Micro Flight have the following types:
- Machine guns
You can add as many as 12 weapons per vehicle, these weapons are defined in a file called stores.cfg inside the vehicle directory, a typical
stores file looks like this sample.
This file has a fixed format, its first line specifies the number of weapons
to use, the other lines specify the name of weapon and its position in x,y,z.
Each weapon has its own directory inside the weapons directory of the
program, inside this directory are the weapon configuration file and related
textures and mesh files.
The weapon configuration file
Inside each weapon directory there is a configuration file called weapon.cfg,
this file contains the parameters for defining the type of weapon and its
behavior, these are the types of parameters and their decryptions.
[explodes_in_water] - weapon is active in water or not (1 or 0)
[fixed_rotation] - the base of the weapon rotates or not (1 or 0)
[fixed_elevation] - the base of the weapon can tilt or not (1 or 0)
[weapon_guided] - the weapon is guided or not ( 1 or 0 )
[mass] - mass of projectile (kg)
[cross_section] - cross section of projectile (m^2)
[cd0] - drag coefficient of projectile
[thrust] - thrust of rocket (Newton)
[burn_time] - burn time of rocket (sec)
[time_max] - self destruct time of projectile
[launch_vel] - launch velocity of projectile (m/sec)
[launch_x] - x position of projectile relative to turret (m)
[launch_y] - y position of projectile relative to turret (m)
[launch_z] - z position of projectile relative to turret (m)
[turret_x] - x position of turret relative to barrel (m)
[turret_y] - y position of turret relative to barrel (m)
[turret_z] - z position of turret relative to barrel (m)
[barrel_x] - x position of barrel relative to base (m)
[barrel_y] - y position of barrel relative to base (m)
[barrel_z] - z position of barrel relative to base (m)
[beta_base] - yaw angle of base if fixed ( radian )
[gama_base] - pitch angle of base if fixed ( radian )
[beta_base_min] - min yaw angle of base if fixed ( radian )
[gama_base_min] - min pitch angle of base if fixed ( radian )
[beta_base_max] - max yaw angle of base if fixed ( radian )
[gama_base_max] - max pitch angle of base if fixed ( radian )
[scale] - scale factor of the weapon
[salvo_rate] - rounds per second (for machine guns)
[salvo_size] - size of shell in meters (for machine guns )
[max_rounds] - maximum number of rounds weapon can fire
[weapon_group] - all weapons with same group number fires together.
[damage] - damage points added to object hit by this weapon.
[reflect] - reflection strength (0 to 1)
[bump] - bump strength (0 to 1)
[bump_name] - bump texture name
[kill_radius] - killing radius of all targets around shell.
Weapons do not require all of these parameters to be specified, for each type
of weapon there is a minimal set of parameters that can be used to specify the
weapon configuration, when some parameters are not specified default values are
// Simple machine gun configuration file
The file above shows a simple machine gun with barrel, turret and shell at
// simple torpedo configuration file
The file above shows a simple torpedo launched at a fixed orientation.
// Simple bomb configuration file
The file above shows a simple un powered un guided bomb launched at a fixed
Each weapon has optionally some graphic files inside its directory, these
include the following:
- The base mesh file base.x
- The turret mesh file turret.x
- The barrel mesh file barrel.x
- The shell mesh file shell.x
- The machine gun texture flame.dds
These files are loaded according to the following structure:
The shell is attached to the barrel and fired from it, the barrel can swing
in elevation only, and is attached to the turret, the turret swings in yaw only
and is attached to the base.
All of the components can be used to compose a great variety of weapon types,
for example to specify a barrel which swings in pitch and elevation simply
ignore the turret.
For machine guns the actual shells are not using the shell.x mesh file,
instead they use the flame.jpg file and the salvo_size parameter to draw
glowing points similar to a line of tracers.
For machine guns there are also splash.jpg and blast.jpg for
showing explosion and splash effects when hitting ground or water.
Weapon sound files:
Each weapon has optionally some sound files inside its directory, these
include the following:
- The firing sound fire.wav - heard when a rocket is shot.
- The flight sound flight.wav - heard during the flight of the weapon.
- The explosion sound explode.wav - heard when the shell explodes.
- The release sound check.wav - heard when a bomb is released.
Sound files should be mono sounds, 22 kHz, 16 bit sounds, other formats
can be loaded as well.
Using Limited Ammo:
Weapons can have limited or unlimited shells that can be fired, when
"Limited "Ammo" option is enabled for the vehicle options, the
weapons have a limited number of shells which is 500 for cannons and 1 for other
types by default, this number can be specified for each weapon in the
When limited ammo is used, the weight and innertia of each shell
fired is subtracted from the weight and innertia of the vehicle.