Draw a diagram of the insides of a spring piston airgun, and keep your pen in hand to make some changes.
First, in the space in front of the piston, and behind the projectile, cross out "compression chamber" and write "combustion chamber"
Second, draw in a fuel injector, aimed towards the combustion chamber.
Third, label the area behind the piston head as "new compression chamber".
Draw in an air transfer port which will connect the new compression to the combustion chamber whenever the piston head is far enough back.
Draw in a one way check valve to let atmospheric air into, but not out of, the new combustion chamber.
Draw an arrow pointing at the piston head, labelled "Metal Piston Rings!!1!"
When the user of the gun squeezes the trigger, the spring expands, propelling the piston forward rapidly.
The piston covers up the air transfer port, and compresses the air in the combustion chamber. As the air compresses, it heats up adiabatically.
A certain number of microseconds after the trigger was pulled, the fuel injector begins spraying a fine mist of diesel fuel into the combustion chamber. Due to the high temperature of the air, and the small size of the droplets, the fuel boils and the fuel vapor ignites. The burning of the vaporized diesel increases not just the temperature, but the pressure, inside the combustion chamber.
A certain number of microseconds later, the fuel injector stops.
The pressure of the gas in the combustion chamber pushes forwards on the projectile and backwards on the piston.
The piston gets enough rearwards kinetic energy to go far enough back that it can be caught by a latch, while the projectile gets enough forwards kinetic energy to depart though the gun barrel quite rapidly.
The microsecond-precise timing of the fuel injector is controlled by a computer, which tries to achieve some specific muzzle velocity.
Similar to an engine computer, the gun's computer has a handful of temperature sensors, and we want the projectiles to fire at consistently speed, regardless of the weather, and regardless of whether this is the first shot of several, or the dozenth, or the hundredth.
The muzzle velocity selector might be a dial on the gun, or an app.
Design choices (power/extension of the spring, length/diameter of the piston) dictate the gun's minimum and maximum velocities:
There is a minimum amount of fuel needed to ensure that the piston experiences enough recoil to be caught by the latch of the trigger mechanism.
There is a maximum amount of fuel we can inject, since there is a finite amount of oxygen in the air in the combustion chamber; beyond a certain point, adding more fuel won't produce more power.
The maximum velocity can be increased by scaling up the volume of the compression/combustion cylinder, increasing the length and diameter of the piston and length and stiffness of the spring.
Depending on the gun's overall size, I believe that it could be used for shooting BBs, pellets, bullets, and conceivably even artillery shells.-- goldbb, Feb 16 2023 Poorly named gasoline version of this idea Automatic Dieseling Air GunWildly variable uncontrollable muzzle velocity, I fear [goldbb, Feb 16 2023] random, halfbakery