A very simple trick, albiet a bit brute force, is to give each civ a unit next to another civs unit, with enough attack to kill it in one shot, and vice versa, so you can detect after 3 seconds which units are still around and therefore, who is allies.
Drawbacks would be the annoying "you are attacked by..." messages. And you would have to have it off in the corner of the map somewhere.
Best I could think of off the top of my head.
"And Matt is a prolific lurker, watching over the forum from afar in silence, like Batman. He's the president TC needs, and possibly also the one it deserves." - trebuchet king