Is it legal to refer to fictional characters in a video game with titles of real-world government officials, e.g., a Congressman, the President, etc.? I've seen lots of movies where they refer to "Mr. President" as a character in the show, but who bears no relation to the real-world incumbent president. So I think this is fine, but I'd like to know if there are any caveats involved.
It's fine, as long as it's clear that it's fiction
As far as I know, titles such as "Mr. President" aren't specifically restricted in any way. That said, there are a few relevant laws here regarding impersonating government officials or using the seals of government offices. Generally speaking, they prohibit doing things that are intended to mislead people into thinking that you are part of or otherwise affiliated with the government.
One is 18 U.S. Code § 912, which states that:
Whoever falsely assumes or pretends to be an officer or employee acting under the authority of the United States or any department, agency or officer thereof, and acts as such, or in such pretended character demands or obtains any money, paper, document, or thing of value, shall be fined under this title or imprisoned not more than three years, or both.
I'm not entirely clear whether the President or members of Congress are included in "officers" here, but it only criminalizes impersonating such officers for the purpose of fooling someone into doing something for you.
More directly relevant to the Presidency and members of Congress is 18 U.S. Code § 713, which governs the "Use of likenesses of the great seal of the United States, the seals of the President and Vice President, the seal of the United States Senate, the seal of the United States House of Representatives, and the seal of the United States Congress".
It forbids use of the seals of those offices
for the purpose of conveying, or in a manner reasonably calculated to convey, a false impression of sponsorship or approval by the Government of the United States or by any department, agency, or instrumentality thereof
For official insignia or uniforms more generally, 18 U.S. Code § 716 exempts uses that are
not used or intended to be used to mislead or deceive...[or are] used exclusively for a dramatic presentation, such as a theatrical, film, or television production.