Unlike as is commonly believed, traditional India had knowledge of gunpowder. The Mughals didn’t bring fire arms into India but it may have been that the knowledge is not that widespread enough to make a massive difference. The same is dealt in detail in “On the Weapons, Army Organization, and Political Maxims of Ancient India” by Gustav Oppert as early as 1889. And it’s important to note that there are some pre-Mughal instances of non-Muslim armies like the Ahom-Sutiya Wars or the Battle of Talikota.
Sukraneeti, for instance, tells us in detail, the art of firearms. The number of recipes of gunpowder is a hint how much experimentation Hindus did over this subject. The relevant sections from Sukra Niti below(Book 4, Section 7)
381-82. Astra is that which is thrown or cast down by means of charms, machines or fire. Sastra is any other weapon, e,g sword, dagger, kunta, &c.
383-85. Astra is of two kinds, charmed or tubular. The king who desires victory should use tubular where the charmed does not exist, together with the sastras.
386-87. People expert in military instruments know of diverse agencies named astras and sastras varying according to short or large size and the nature and mode of the sharp edges. 388. The ‘nalika’ (tubular or cylindrical ) astra is known to be of two kinds according to large or small size.
389-94. The short or small ‘nalika’ is the cylindrical instrument to be used by infantry and cavalry, having an oblique (horizontal) and straight (prependicular) hole at the origin (breech), the length of five vitastis (two cubits and a half), a sharp point (tila) both at the forefront (muzzle) and at origin, which can be used in marking the objective, which has fire produced by the pressure of a machine, contains stone and powder at the origin has a good wooden handle at the top, (butt) has an inside hole of the breadth of the middle finger, holds gunpowder in the interior and has a strong rod.
395-96, The instrument strikes distant objects according as the bamboo or bark is thick and hollow and the balls are long and wide.
397-99. The large ‘nalika’ is that which has a post or wedge at the origin or breech, and according to its movements, can be pointed towards the ???, has a wooden frame and is drawn on carriage ; if well used, it leads to victory
400-404. Five palas of suvarchi salt, one pala of sulphur and one pala of charcoal from the wood of arka, sunhi and other trees, burnt in a manner that prevents the escape of Smoke, e.g., in a closed vessel have to be purified, powdered, and mixed together, then dissolved in the juices of sunhi, arka and garlic, then dried up by heat, and finally powered like sugar. The substance is gunpowder
405-406. Six or four parts of suvarchi salt may also be used in the preparation of gunpowder. Sulphur and charcoal would remain the same.
407-408. The balls are made of iron with other substances inside or without any such substance. For lesser nalas or guns, the balls are made of lead or any other metal.
409-410. The nalastras may be made of iron or of some other metal, have to be rubbed and cleansed daily and covered by armed men.
411-15. Experts make gunpowders in various ways and of white and other colours according to the relative quantities of constituents:— charcoal, sulphur, suvarchi, stones, harital, lead, kingul, iron filings, camphor, jatu, indigo, juice of sarala tree, &c.
416-17. The balls in the instruments are flung at the aim by the touch of fire.
418-421. The instruments has to be first cleaned, then the gunpowder has to be put in, then it is to be placed lightly at the origin of the instrument by means of the rod. Then the ball has to be introduced, then the gunpowder at the ear. Fire is next to be applied to this powder, and the ball is projected towards the objective.