I was playing Total War: Rome 2 (I know not the best of sources) and in the base game the principle and hastati units fight with swords, but in the Divide Et Impera mod, which is a much more realistic mod, they both fight with spears and so I was wondering which weapon they actually used. Thanks!
Short Answer: Both.
Hastati and Principes under the Camillan style of the Legions fought in the Greek style, in tightly packed formations of spearmen called a Phalanx. The poorest soldiers (who could still afford to arm themselves well) were Hastati. the middlingly wealthy, the Principes, and the richest with the best quality arms and armour who fought in the infantry line were the Triarii. Poorer soldiers unable to afford much equipment would fight as lighter skirmishing infantry. The Samnite Wars however, and possibly the war against Brennus, showed the Romans several tactical problems with the Phalanx, notably the inflexibility of it and the reliance on favorably flat ground to allow steady footing, and the of the Phalanx largely only for large engagements. It was an impractical formation for small battles against raiders, tactics were hard to implement beyond "charge and let our forces grind against each other until one side wins," and the hilly terrain of Central Italy wasn't well suited to Phalanx warfare.
The evolution of the Legions to minimize these disadvantages created what is known as the Manipular system. Soldiers were classified by age and experience into the Hastati, Principes, and Triarii instead of simply by wealth (though property and wealth requirements remained to serve in the military), and armaments changed for the Hastati and Principes to the short thrusting sword called a Gladius, and two javelins for throwing on the charge. This new Legion fought in a checkerboard of Maniples (One Maniple being two Centuries, or 160 men) called a quincunx, arrayed in three lines called the Triplex Acies.
The first line was of the Hastati, younger men throwing their javelins and charging into the enemy at close range in an attempt to break them. Hastati fought until it became clear they were unable to break the enemy, in which case they fell back between the gaps left in the second line.
The second line was the Principes, older veterans of the Hastati line well suited to facing the enemy. They fought the same as the Hastati, and could fall back again if necessary behind the Triarii.
The third line, the Triarii, were a holdover from the Phalanx style of combat. Older veterans in the prime of their life armed with spears prepared to fight to the last if necessary.
This Manipular system was also useful in the organizational sense. While a Phalanx line was moveable only as a line without weakening the formation or risking gaps, Roman forces could deploy in forces as small as necessary to respond to changing battlefield circumstances. A Roman general could order a Maniple to reinforce a line, or flank, or divide itself into two Centuries for the same reasons, right down to squads of 8 men. This tactical flexibility was extremely innovative in infantry combat (though the quincunx is believed to have been copied from the Samnites) in the Mediterranean world, giving the Romans the tools to execute complex strategies.
*Note: As a fellow played of Rome 2 Total War and a player of DEI, you'll notice that the Hastati and Principes with spears are listed as "Camillan" troops.
Notes: The military term "century" changed over time, originally at 100 men and shrinking to 60-80 men over time. For most of the Empire, the standard century was 80 men.
Edit: I failed to mention that both the Samnite Wars, and the Roman defeat at Allia have both been credited with showing the tactical inflexibility of the Legions as a phalanx line.
Source(s):
Goldsworthy, Adrian. The Complete Roman Army. Thames & Hudson, 2011. (pages 20-30)
Carey, Brian Todd, et al. Warfare on the Ancient World. Pen & Sword Books Ltd, 2013. (Chapter 4, Republican Rome at War: The Rise and Evolution of the Legion, pages 90-122)
Schmitz, Leonhard. “Comitia.” Penelope.uchicago.edu, University of Chicago, http://penelope.uchicago.edu/Thayer/E/Roman/Texts/secondary/SMIGRA*/Comitia.html#ref:Plutarch_Gracchus_citation. (note: there is some cross referencing the classes of citizen and their military role with other works, such as the above Complete Roman Army).