So I started a game as LA Ulm, and am surrounded by heavy cavalry. Should I just spam the ever loving shit out of my pikemen? Normally spearmen are good against cavalry in strategy games, but I don't know if dominions works that way. Maybe the tower shield guys are better?
Yes.
In Dominions there is no real magical "bonus vs cavalry" that most games sort of cram in to make spearmen make sense.
In Dominions it boils down to weapon length when dealing with cavalry. Being on a horse gives them +1 weapon length I believe and in a melee weapon length can make a huge difference as having a longer weapon (or stat at least) can prevent others from attacking. Cavalry are so strong partly because they have lots of armor (and other good stats) but also because their "weapon length" is almost ALWAYS longer than most infantry which means when infantry are fighting against them they get to attack far less than usual.
Spearmen/pikemen/etc. have a longer reach than most infantry which allows them to negate the weapon length difference and puts them on a more even playing field.
Even against spearmen they will generally still cause lots of damage but it helps a great deal. Also remember to keep your spearmen (or all infantry usually) in close formation so they can maximize space (3 human size (2) infantry can fit in 1 "square" while only 2 normal cavalry (size 3) can exist in one "square", a square being a total size of 6) which in turn means more attacks per round against the cavalry in question.
Another way to help prevent flanking is to make the spearmen target cavalry instead of "closest" or some other enemy
Same logic applies to giants.