Re: Not magnetic field, more star field?
The British Army in the Line Infantry and Cavalry battalions still allowed the purchase of commissions into the 1870s, and although they did promote on merit during wartime this almost never happened during peace or when not on campaign because there was a steady supply of new Young Gentlemen (usually the superfluous sons of the nobility, I.E. Son Not The First, although there was a trend for the first son to inherit, the second son (if any) to go into the military and the third son to go into the clergy) readily available with sufficient funds from their parents to be able to purchase a commission somewhere.
There were rules around it of course, firstly by the time of Napoleon most commissions except the lowest required some level of military experience (I.E. you couldn't just buy a position as a Colonel at 18), you couldn't sell your commission back to the Army or to someone else without permission (if you just left it would be deserting and you forfeited the purchase money), and you couldn't break military rules or you'd be thrown out and the money would be forfeit.
Officers also had to pay their own way, being given little or no money for their own uniforms (which were expensive to have made), their own food/drink, any servants they wanted to bring with them, their accommodation etc, so they needed a source of wealth to pay for these necessities as well.
But in peacetime you could, if poor, sit as an Ensign (modern equivalent in HM forces is 2nd Lieutenant) for years whilst those around you with money purchased commissions as Captains or Majors or Colonels and so ended up in command of you. In a war however you'd get promoted much quicker as disease and battle claimed the lives of the officers around you.
Officers in some units such as the Engineers, Artillery etc had to pass some examinations for promotion but they were seen as second-class officers anyway, as they were technical experts in a craft like siege engineering or trained mathematicians for artillery work, so they'd never end up in senior posts or command infantry units. These commissions were usually outside the purchase system as they did't attract recruits as much as the more glamorous branches like the infantry and especially the Cavalry (which attracted the sons of the highest echelons of society generally).
The Royal Navy, by contrast (by the time of Napoleon again), required the passing of examinations to advance from Midshipman to Lieutenant - you had to know how to sail a ship, how to read the weather, how to react to various events (since Lieutenants of sufficient experience could be placed in charge of a brig or sloop as Captain and so would be solely responsible for that ship), how to calculate your position (so you had to be able to take sextant readings, and know the mathematics to translate that plus your speed over time, the actual time, wind direction and speed and a host of other factors, to a position on the chart), and be generally competent at leading men before you could pass a board of examination. You also needed sufficient sea-time to demonstrate the required experience in things like keeping watch under another officer, how to deal with being in combat (and whether or not you could take it), etc.
Promotion from Lieutenant to Commander and then Post-Captain was by recommendation by a more senior officer, but once you were a Captain you could only make it onto the list of Admirals through seniority - as old Admirals died or gave up their commissions to retire all the Admirals below them would advance one place up the list, and the most senior Captain would be considered for promotion to Admiral - if he made the grade, he was in, otherwise it may go to the next senior and so on down the line. Seniority in this case was by service time, although you could be advanced up the list by meritorious service or dropped down it as punishment for misbehaviour which didn't rise to the level of dismissal or the death penalty.