It’s actually fairly legal (in the US[a]). With salaried employees, what constitutes “on the job” work and what doesn’t isn’t as clear. With an hourly employee, once they clock out, their thoughts are their own. Salaried employees are paid just for working there; especially if you’re “on call.” And when you’re talking about a game studio, a game made on your own time would be pretty easy for your employer claim from you.
NOTE: I do not agree with these clauses, and I wish they didn’t exist. But they are a thing and they are legal.
[a]: IANAL, and some states probably specifically prohibit these clauses