Following on from our interviews with both FuturLab’s James Marsden and Cold Beam Games’ Steve Hunt, we asked FuturLab’s programmer Robin Jubber for more detailed advice on getting started with the actual programming itself. He details the best development tools, most useful languages and even tells us about his patented Jubber variable naming system!
That’s enough from me, let’s hear from the man himself.
——————————————————————————————————————————————————————————-
Writing game code can be approached from a number of different directions – I’ll try and describe some of the most straightforward.
I started writing on machines like the Spectrum and BBC micro – obviously unless you have a time machine stuffed in the loft that’s not going to be the best approach these days. However you can take a similarly undaunting approach by downloading either XNA or Visual Basic from Microsoft. Visual Basic will allow you to get PC apps running pretty quickly, and the BASIC language is a good vector for understanding all languages. My preferred choice would be XNA, which is a general games making package for PC and XBOX 360. Essentially it runs using a language called C#, which removes many of the horrible decisions that went into making C++. I personally use C for coding where possible, and C# when writing quick tools or even games on the PC. C# is very well documented – installing it, along with Visual Studio Express Edition (all free software), will give you access to a lot of tutorials, including the all important first steps to getting something to appear on screen. From that point you want to start experimenting and fiddling with the sample code, slowly adding new features as your first engine starts to take shape. Don’t assume you will be able to write Halo right off the bat – aim more at getting a sprite appearing on screen for starters.
You may need to gain some new skills, such as being able to count in hex and binary. One day you will be able to convert real world colours into hex strings in your head. This can also be a sign that it’s time to get a girlfriend.
Learning C, which is a fairly low level (i.e. non-human) language is a very good idea, as it provides a backdrop to both C++ and C# (and the frankly disgusting Objective C, used on Apples and iPhones). Kernigan and Ritchie published the definitive guide to C years ago – and the book is so popular it is still in print 30 years down the road. Also worth investigating are the Dummies series, which can be very helpful – I use a C++ one from time to time for reference. C++ is a bag of crap language but it’s still popular at a lot of game development studios – I expect that to slowly start to wane. You should also consider looking at game dev systems which try to take some of the programming hardship away, such as Unity. They rely more on art assets and simpler scripting – but the basics of coding will always be useful so do try XNA.
Once you have a feel for the language operators (things like while loops, if statements, for loops etc) you have the beginning of your recipe book for creating any kind of application. To apply those techniques to games coding the next step is to build up a library of useful routines based around a central loop in your code. That might look something like this:
while( true )
{
Process_Joypad();
Move_Player();
Move_Enemies();
Do_Collision();
Update_Scores_And_Lives();
Draw_World();
Draw_Overlays_And_Text();
}
Each of those subsections can be broken down further. You will need to learn, in order of priority, how to do the following. Firstly get a sprite or 3D model to appear on screen. XNA makes this step quite simple. Then you will need to know how to load assets – again XNA has a fairly straightforward approach to this. Assets are sound effects, sprites, models and level information. You will also want to write a font plotter, especially useful so you can print out information for yourself when debugging. Then camera code if using 3D and beyond that the sky’s the limit!. Bounce algorithms, 2D collision systems, 3D collision, player cameras, lighting, shading technology, sort and search routines – the list just goes on and on, you will never stop learning new things.
As for learning resources, the internet is your best resource. Youtube hosts videos explaining how to get up and running in C#, Microsoft hosts an extensive XNA site, you can google C programming tips on any subject you can think of and last but by no means least are programming forums. Type “programming forums” into a search engine and a ton will appear – I use a lot of different resources so can’t recommend any one site in particular.
Another thing to consider as you begin to get a little more confident with games programming is that you may want to try and find an artist and perhaps another fledgeling coder and a sound engineer. For starters you can probably put together basic assets yourself – but very few coders are also artists as both skills take years to develop. In the meantime I would suggest picking up GIMP and Blender 2.50, both of which are open source, along with a basic hex editor, a development environment like Visual Studio, Codelite IDE or Eclipse, perhaps a children’s text book introduction to 3D geometry and matrix mathematics (you often only need the basics) and Codehead’s Bitmap Font Generator, which does exactly what it says on the tin.
GIMP is one of many admirable 2D texture editors worth picking up. You often need to be able to export to a lot of different formats when writing games, especially if you end up writing for lots of platforms. The PSP tools from Sony tend to favour TGA files for instance. Blender is an open source 3D editor, perhaps the most astonishing piece of free software I’ve ever seen, and a handy tool for creating 3D assets or generating 2D artwork. Until you can get your hands on an artist that is
cprogramming.com is a good place to look for further information about C and C++, but almost any specific query you type into google will give you dozens of sites.
So far I’ve looked at conventional game programming, but of course you can also investigate the worlds of Flash and HTML 5.0, both of which will let you write games in the browser interface. However whilst a C coder can pick up Flash pretty quickly, if forced at gunpoint, the reverse isn’t often true. Flash is fairly high level, or abstracted – you are a long way removed from the really powerful hardware features needed for high speed gaming. Some smashing games have been made in browsers though, just not generally fast 3D games.
Some final tips – use fixed arrays where possible as garbage collection (something you have to do a lot in C++ but not C) can be a huge stumbling block, and cause hard-to-track-down errors. Use constants in your code at all times.
For instance instead of saying
int maximum_x = 800;
write
#define MAX_X 800
at the top of your code
and
int maximum_x = MAX_X wherever it needs to be set. You may need to set it multiple times so using a #define statement will be invaluable.
Also, keep your code simple, avoid too much abstraction (a huge bugbear in C++, as well as being one of the strengths of the language) and try to make sure you use lots of comments.
// This is a comment
is useful when you come back to your code a month down the line and can’t remember what any of the damn stuff does!
I would also suggest you use the patented Jubber system for naming things in your game code.
#DEFINE SOME_CONSTANT (all capitals for constants)
int a_variable_for_player_speed (underscores and english lower case words for variables)
void A_Function_For_Something_Or_Other() (capitalised words, underscores for functions/methods)
ignore any programming guide that tells you to use reverse polish notation or any other system for naming variables. English is the most powerful tool humanity has yet created – use it where possible. Your code will be more readable if you don’t call variables ‘i’, a practice that is taking years to die out amongst older keyboard jockeys.
- Robin Jubber (coder of varying ability on PSP, PSP Go, PS3, PS2, Playstation 1, Acorn Archimedes, Acorn BBC Micro, Sinclair Spectrum, Commodore Amiga, PC, XBOX 360, Satellite set-top boxes, GBA, even a little bit of monkeying around with an N64. Horrid horrid N64 )
——————————————————————————————————————————————————————————-
So there you have it, coding advice straight from a PlayStation Minis programmer. Once again I give a massive thanks to Robin for taking the time to give us all some programming pointers, and hopefully it will get people going in the right direction with the coding for their first game!

I can code in Visual Basic, I can convert binary, and I’m sure I’ll be using XNA at Uni.
Good stuff about the loops, mainly used VB for my stock checking program in Computing but I’m pretty alright with it.
Comments are VERY useful and you’d have to be a fool not to use them.
Anyway, this, along with physics and maths will be the stuff I’m learning to Uni, starting to doubt if I need to go after reading this
Thanks Robin, I hope to speak with you down the line once I’ve settled into my course.
No problem at all – I’m glad some of the information here might be helpful. Good luck with the university course, just remember not to let all that learning get in the way of chasing women and beer!
Interesting stuff there, it seems very difficult but also quite interesting.
Oh and by the way, i won Coconut Dodge courtesy of StartGame and i’ve played a bit and must say it’s difficult but great fun and addictive
Also, i’m impressed with how you respond to comments such as on here and also on TSA. Good job guys
I’m very happy you’re enjoying the game! If you’re finding it a bit tricky, you might be happy to know we’re releasing an update in the next few days which, amongst plenty of other new game options and modes, gives you three lives. The tough mode is still there, and I’ve included a programmer level hard mode as an easter egg so you can play the game on the same settings I use