Computer games sharpen programming skills

Boy playing video game Can playing computer games be beneficial? It is, if you think about them. I mean, really think. While playing them, have you wondered how that special effect was rendered? Or how they modelled a simulation? Or how they implemented that enemy artificial intelligence?

Have you ever thought about the inner workings of a game?

1. Romance of the 3 Kingdoms

Back in the 1990’s, there was this role playing game called Romance of the 3 Kingdoms. There were mighty generals and fearsome warriors and intelligent advisors to recruit. The strongest warrior was Lu Bu. His strength statistic was set at 255. The cleverest of advisors was Zhu Ge Liang, with an intelligence statistic of 255. There were other stats, but they range from low 2 digits to 255.

I was young then, and I’ve often wondered why 255 was the highest. I mean 100 seemed the most natural choice for a maximum. It wasn’t until I studied computers and bytes that I realised that 255 was the most natural choice for computers. An unsigned byte stores a range of 0 to 255.

Still, the very act of thinking about why 255 was used got me wondering about other aspects of games…

2. Kingdom Hearts

In this 3D role playing game, there’s this place called Halloween Town. Since everything’s rendered in 3D, I’ve marvelled at the efforts to efficiently fool our eyes into forming those textured polygons into a believable scene. Well, there were these pumpkin lanterns lying around giving suffused light, and they looked quite beautifully rendered. I moved Sora (the main protagonist) so that the camera angle could let me see those lanterns better.

Light polygons
After staring at them for a few minutes, I finally figured out how it’s rendered. First, an example of the rendering. Ok, I suck at 3D modelling. Anyway, 3 square planes were used, crisscrossed at the centre at 60 degrees apart. Then each square plane was textured with a light map. Set up the diffusion, ambience and other colour and lighting parameters, and it looks like a convincing lantern (together with the pumpkin model of course).

With 2 triangles in one square plane, that’s a total of 6 triangles. An efficient use of polygons, I’d say.

3. Final Fantasy

Actually, it’s role playing games in general, but my all-time favourite is Final Fantasy, so I’ll use it as an example. Basically, it’s about data storage and presentation. There’s conversational text, menus, lists of items/weapons, tons of enemies (and their stats), maps and so on. How were they stored?

More importantly, how do you display all the items and allow the player to efficiently scroll through them?

I think about how certain consumables items (meaning they’re removed once used) were represented in code. Or if weapons and armour were stored differently? All items must’ve been tagged differently, because there’s a sorting function. Potions, remedies and other healing items together. Swords, staves and other weapons together.

Computer games rarely have the luxury of a database. Perhaps a multiplayer online game with a server that utilises databases. So, given that you can work with a database, how can you plan and code for data storage?

Oh yeah, if you’re a Final Fantasy fan, you’ll find this “College Saga” hilarious.

4. The Sims

I prefer to play console games rather than games on a computer. I’m using the term computer games to refer to games powered with hardware, whether console or hand-held or actually on a real computer.

The Sims, however, require the mouse to efficiently point and select options. At least that’s how I feel.

Anyway, as a people simulation game, I’ve wondered about the variables affecting each Sim (an avatar in the game). There’s probably a lot of psychological research done. Because, how do you simulate a human being? Feelings, wants, needs. Family, friends, relationships.

5. Action games

There’s too broad a genre for this. Fighting games (King of Fighters). Driving simulation (Gran Turismo). First person shooters (Doom). Any game that requires some form of reflex ability. These games improve mind, hand and eye coordination.

Rapid interpretation of game events (curved road approaching, fast punches) and speedy actions are part and parcel of action games.

So why are they useful? They train the mind to think and act quickly. You should be thinking and reacting so fast that your fingers have trouble typing out the code quickly enough. If you need to retrieve some data from a database, you should visualise the query statement rapidly and you’re just waiting for your fingers to finish typing out the query statement.

Conclusion

Given the right context, playing computer games can sharpen your programming skills. You just have to think of them in a different perspective. Ultimately, it’s about figuring things out. And that’s what programmers do best.