Why Every Programmer Should Try Game Development

It always astonishes me when I meet programmers who have been in the software industry for a while and have never even seen game code. In today’s software world I would assume that at some point a seasoned programmer would come across something flagged as “game code”. But that isn’t really the case. From the fellow programmers that I have met, I have found that game programming is “out there” or “something completely different”. It is as if people who are in game development are in one camp and everyone else is in some “I do programming” camp. Yet our camps are not so different from each other. Many of the people I know who do game development have worked or work at some point in disciplines such as web applications development or mobile development. So why not the other way around? Because it’s scary.

The most common application is one that mixes linear code with events. It is data processing code hooked up to an interface (not a class interface mind you) which is able to react to input coming from the interface. If you look at how mobile apps are done, most apps are done in this exact pattern. As a result a lot of programs are very straight forward; you get data from a source, you allow the user to manipulate it using the interface and then you put it back. There is no constant manipulation of data in the background. I don’t open my weather app on my phone to have it crunch numbers in the background somewhere to keep something going on the screen. It went to a web service, got the data, did something based on that data and now its waiting for my input. So why is game development scary? Because you have to run that code 60 times a second. The code is no longer about fore filling a role and stopping; it’s now about reacting appropriately to different situations at any moment during the execution of the program. You are now dealing with data driven programming which is morphing your data at an incredible rate.

Now that I have scared the shit out of my non game developer readers, I have some insight for you: its not all that difficult. Not only that, but you will have fun and your normal applications will get better. What? How? Get better… No! Says the programmer reading this article!

So how will it make my (insert type of application here) code better?

Remember back when you were in college you had to learn all the C/C++ gibberish that you have long forgotten? Well there was a reason why they taught you all that and it’s not a good thing that you a have forgotten it. Take for instance if you were a mobile developer.  You are working in a very tight space; you have maybe 200MB of heap space to play around with and the processor you are working on is slow… and working on other stuff at once. The language of choice is Java and for that reason you have long forgotten what a heap is and why it is important. Every time you ask for a new weather update from weather.com you just create a new object to hold the data, throwing out the old. Instead of saving a reference to the thing you just found in case the user re-requests it, you search the 2000 item list every time. The last few scenarios are some that I have seen multiple times looking through code examples and other people’s projects and they make my eyes bleed. But when you have a phone that runs through everything fairly quickly, who cares right? WRONG!

Game development is probably the best example of programmer training. Because your code is spinning 30-60 times a second that list search or extra allocation will go a long way to make your game unplayable. As a software engineer you cannot forget that one of your jobs is to make you code run well, regardless of the hardware. One of the biggest issues of developers today is that hardware is fast enough that heap abuse doesn’t smack them in the face every time they do something in their fancy weather app. They allocate an object, make a brand new one on next request, dispose of the old one and don’t notice the performance issue. But their user will notice. They will notice because he or she is running 20 fancy such apps and now their phone is coming to an unusable state. It’s not because it’s Android and it’s not because they installed 20 apps onto their phone; it is because the developers that we trust to provide good, solid apps have betrayed the phone architecture and forgot what a heap is.

Game developers are a bit different, at least most of us are. We cannot afford to allocate a brand new Vector3 every time we do a velocity calculation, especially in languages that down allow us to manage object deletion on our own (C#, Java). We can get away with some performance issues from time to time, but it starts biting us in the ass really quickly. I can get away with allocating a lot of ram and using up CPU cycles in bursts in a normal ASP.NET app. Most probably I wouldn’t notice any kind of issue. Someone who picks up videogame programming for the first time however, will quickly realize that it’s not possible to abuse memory allocation. Every little squeeze of RAM and CPU becomes a big deal as it allows you to do more. The faster your code, the more you can do with it. As the programmer becomes more and more comfortable with optimizing code, they should become more and more consistent. When they go back to what they normally work on, these skills will undoubtedly transfer over.

Video Game Development is All About Being Creative

It doesn’t matter if you are a programmer or an artist, the moment you step into video game development you have to be creative… very creative. Software development in general is a creative field but it’s much harder to be the “I’m going to be doing things no one is going to see” type of programmer. Unless you are working on some kind of genius memory management system or save game system, everything that you do will be in some way projected onto the screen. Gameplay programming, graphics programming, physics programming; they will all reflect on the composure of the game. And that’s awesome! Because it keeps you from forgetting that at the end of the day, you can’t and shouldn’t hide from what your application displays. Little details in the interfaces of apps make a big difference; whether something small makes it easier to use or simply makes the app look better. Videogames are the merger of the two disciplines; immersible game play (usability) and visuals. The flow of the game is determined by the two together put into one product and many applications developers can base their interface and usability designs off how videogames approach these areas.

A video game inside an everyday app?

For those of the readers in mobile app development, video games could be an amazing tool for boosting your future and existing products. There is a certain misconception that graphics and sprite driven interaction is a video game only thing; its not! I am not sure if you have noticed, but on platforms such as Android there are now backgrounds you can interact with. Many of them resemble a very basic but interesting video game. Personally I want to see this more in normal applications; a way to interact with an app using a game like approach. What if making a note is about pushing it through a small maze, possibly helping me remember what I wrote down, simply because it is now interactive? Or to get rid of calendar events, one of the ways to delete an event is to throw it into a small basket in the corner using a thumb flick? App developers always want and need to be ahead of the game (see what I did there?) and making them apps more video game like may just give some developers the edge.

Closing Notes

I would love to continue on about the benefits of making video games for all programmers, but it is also up to you, the reader to discover them too. The best way to improve your skills is to go outside the box and experiment; do something you have not done before. Whether video game development has a truly profound effect or makes not difference to you, it is for you to decide. However, try it out, it won’t hurt! To close off and point you in a few directions to begin with, check out the following game engines:

XNA (MonoGame)

Unity

Construct2

and begin poking around!