Typically four years, which is the standard length of a bachelor's degree in computer science or game development.
That is the conventional route, but it is not the only one. Plenty of working programmers came through two-year programmes, bootcamps, or no formal schooling at all, and the industry tends to care more about what you can build than which certificate you hold.
What genuinely matters is a portfolio. A handful of finished, playable projects — even small ones — demonstrates more to a hiring manager than a transcript does. So if you are choosing between another year of coursework and shipping something complete, shipping usually wins.