Playing games is one of the most engrossing and entertaining activities out there and because of its huge social factor you can share your passion with other people too. Other than being a great hobby that you can sometimes find yourself devoting hours too (which may be good or bad depending on the way you look at it). It is also one of the best forms of education and stimulation. When you are doing something that you really enjoy you are more inclined to do it more because of the way it makes you feel. This is the exact same feeling that I like many other developers get from programming which is more apparent on those good days when we are not stuck trying to debug some code for a few hours 😅 .
The similarities between the two are unparalleled and the fact that games are created using programming languages just reinforces that truth. When you are playing games you are usually forced to solve problems which is very similar to when you are programming. You are forced to do a lot of thinking to overcome solutions which is one of the many good traits that a programmer should have. For example if you are playing a first person shooter like Call of Duty Warzone for example. In one situation there could be a sniper on a building somewhere laying down some fire and you are unable to pinpoint where he is. One solution could be to work with your team and go inside of a building to get out of the firing range. There are infinite decisions that you could make in that instance. It is just like when you are building an app you have to think about the technical stack and how you are going to write the code.
Another example can be found if you are playing a real time strategy game like Starcraft II. You need to think where you are going to build your base and what type of troops you are going to train. Because you have no idea what the enemy teams strategy is going to be you need to plan ahead and try to figure out a way to counter whatever strategy they are going to use. Like having a strong defence and building up your army. Or going for a rush attack to weaken their economy so that it takes them longer to gain resources allowing you to build your army faster.
Programming makes you think a lot which is good for memory. It has even been said that diseases that cause mental deterioration such as Dementia and Alzheimer's can potentially be slowed down. So like the term "killing two birds with one stone" if you do programming and have some form of gaming in life then you are putting yourself in a good position. It is not only rewarding but it also makes you a better problem solver and makes you more creative at finding ways to overcome obstacles.
And the best part is that it does not even have to be a hardcore game like those played on consoles and computers. There are plenty of casual and mobile games that can offer the same experiences. From something as simple as Sudoku to a game as complex as a Battle Royale there is something for everyone.