Since early 2002, Shee Labs has been a group of individuals working to produce free game and media downloads. With ever-fluctuate staffing, Shee Labs continues working behind the scenes on various exciting projects for a bewildering array of areas. Shee Labs ceased to exist in September 2009.

Report article RSS Feed Be the Man: Beginning Games Programming #1 - First Steps

The first in a series of programming tutorials aimed at aspiring games programmers, who have never seen code before. This tutorial introduces the programmer, the most basic programming concepts, and handles the simplest application (Hello World) in C#, C++ and J2SE (Java) as an introduction to code and development environments.

Posted by ambershee on Oct 7th, 2009 Page 2 of 8    
Basic Client Side Coding.


When we write code, we're essentially writing a series of instructions. In all the code we will write, the computer will follow these instructions sequentially; it follows them in the order in which they are presented. Consider that you may give someone directions to the library from the train station you are currently at; you may tell them to continue down the road until they reach the second left turning, then follow that until they find the library on the right. This is a set of instructions not entirely unlike something you could write as code. It could look something like this;

text code:
>CONTINUE DOWN THE ROAD
>IF WE HAVE REACHED THE SECOND ROAD ON THE LEFT
>>TURN LEFT
>IF THE LIBRARY IS ON THE RIGHT
>>WE HAVE ARRIVED

Our instructions aren't infallible - but this is just another part of the software development process. Every programmer will make mistakes, and chances are, the code will not work as intended the first, second or even third or more times around. Sometimes we make small mistakes that are easily corrected, sometimes we make bigger mistakes, through misunderstanding or simply design flaw. Sometimes the software will behave in ways that we didn't originally intend. This is all perfectly normal and not something to necessarily worry about. Programming is an iterative process; we write code, check that it works, and if not, we fix any mistakes we may have made. If it does work as we intended, then fantastic, we can move on to the next task (and there is always a next task).

Unfortunately, actual code doesn't look like this - what we have written is a form of 'pseudocode'; a set of instructions in an easily human readable form that could later be interpreted into functional code. The code we write instead has a number of strict conventions applied to it. We adopt these conventions in the form of a 'programming language', not entirely unlike learning and using a foreign language, but this time around aimed at communicating with your computer.

Unsurprisingly, when you write code in a programming language, you'll be writing an awful lot of algebra. Computers, and subsequently programming languages were invented for this purpose - and you'll find that you'll be making awfully good use of it when programming games too - they are no exception and there's an painful quantity of complex maths involved. Fortunately, we won't be (and don't need to be) worrying about anything like that just yet.

Since the easiest way to learn to program is by doing - let's quickly dispense with all this theory and chit-chat, and get ourselves started right away...

Post comment Comments
eXeC64
eXeC64 Oct 7 2009, 4:47pm says:

Prehaps on page 5 use cin.get(); instead of that long line. It has a very similar effect (waits for enter key to be pressed) before letting the program continue.

It's far less intimidating on newbies =]

0 votes     reply to comment
ambershee
ambershee Oct 7 2009, 5:47pm replied:

Yeah, I could probably do that. Out of habit, I usually do use the more complex 'any keypress'. It's just what I learnt when I first started programming.

+2 votes     reply to comment
cheesemoo0
cheesemoo0 Oct 7 2009, 5:15pm says:

I love articles like this! Keep it up.

+2 votes     reply to comment
Ark_
Ark_ Oct 7 2009, 5:18pm says:

This looks like it will shape up into a nice series for tutorials.
At the moment I'm a mapper and modeller but I would like to learn how to program for games.
So thanks for the tuts and good luck.

+1 vote     reply to comment
NullSoldier
NullSoldier Oct 7 2009, 8:19pm says:

From the land of managed game programming, you should start out by teaching C#. It's easy to pick up, and XNA is extremely easy to use in comparison with SDL and Allegro for new game programmers. I'll make managed game programming popular even if it kills me!

+1 vote     reply to comment
ambershee
ambershee Oct 7 2009, 8:41pm replied:

The aim here, is instead of introducing only one way of doing things, is to go for a broader perspective from the start. Whilst I'm running the risk of confusing people with multiple languages, I'm hoping that an approach that covers the different perspectives from the beginning shouldn't work out that way; all three languages are fundamentally very similar (and in the case of the next tutorial (variables, operators, arithmetic), practically identical...), they're almost identical. Where they'll diverge, comes a little bit later - but it's not a bad selection - where C# is managed, unmanaged C++ is the main industry standard - and then Java and Eclipse is a whole different perspective all together, and still widely used.

thanks for the feedback :)

+2 votes     reply to comment
NullSoldier
NullSoldier Oct 8 2009, 12:23am replied:

Yeah, great tutorials! I just had to add my two cents in because I believe managed code game programming has it's place in the market. (Xbox live arcade for one)

0 votes     reply to comment
Feared
Feared Dec 9 2009, 12:08am replied:

Managed? Blech!
Native please.

+2 votes     reply to comment
BadgerDeluxe
BadgerDeluxe Oct 7 2009, 9:30pm says:

OMG WIN! Thank you so much for this article, this is exactly what I need right now!

+1 vote     reply to comment
dill1233
dill1233 Oct 7 2009, 11:27pm says:

I love where your going with this, but as a intermediate C# programmer, I don't think I quite fit this article. Yet, I'm sure by the middle of this series I'll be thanking you so much for providing me with such great information. By the way, I think it's funny how the differences in length of the different languages vary so much. I think C# is just perfect where it stands on length and complexity.

+1 vote     reply to comment
Necromunger
Necromunger Oct 7 2009, 11:39pm says:

umm can you go any further with this in c++ because the basics is easy enough i want to go to the next step after classes and functions

+1 vote     reply to comment
ambershee
ambershee Oct 8 2009, 4:44am replied:

The series will go further, but it will take a lot of time. A simple tutorial like this takes around four to five hours to prepare and to write, and there's a lot of ground to cover in the mean time.

+1 vote     reply to comment
Arxae
Arxae Oct 9 2009, 7:40am says:

for the csharp code, you only need "using System;" :3 the rest is not used and can be left out :)

+1 vote     reply to comment
ambershee
ambershee Oct 9 2009, 9:55am replied:

You can do that, but I just left in what was automatically generated by Visual Studio.

+1 vote     reply to comment
Arxae
Arxae Oct 9 2009, 11:52am replied:

ah like that :3 well you could do that to, i prefer to only have the usings in there when i actualy use them xP

general comment tho: i saw you liked the complex solutions more (out of habbit) but this is a beginners tutorial :p so i would advise not to use those solutions and keep it simple xP (but i think your well aware of that)

+1 vote     reply to comment
Artinier
Artinier Oct 11 2009, 10:34pm says:

Hey, Awesome Work :D.
I know that you said making these tuts is a time consuming process but is there any laid out timeline for there release. Eg Once a month or so forth.

Thanks for the awesome tut

+1 vote     reply to comment
ambershee
ambershee Oct 13 2009, 2:42am replied:

It's literally a case of when I can do it. I'm aiming for one a week or so, but whether I stick to that schedule is another matter - the next tutorial for example is quite a long one, since it covers a fairly broad spectra (variables, operators, input and arithmetic.)

+1 vote     reply to comment
Artinier
Artinier Oct 14 2009, 6:43am replied:

Sweet cant wait.

Thanks for the reply.

+1 vote     reply to comment
pitchblack00
pitchblack00 Oct 14 2009, 11:36pm says:

I don't see a point of another hello world tutorial, there are thousands of them on internet. I advise you to talk more about structure of modern game code, rather than general programming introduction. Like how do you get camera working, models showing up, animations playing, some intro into shaders and don't try to cover each and every topic completely but point to learning resources instead.

+1 vote     reply to comment
ambershee
ambershee Oct 15 2009, 4:49am replied:

The point is that this is a series of tutorials; not and individual tutorial. It's aimed to start at the absolute beginning and specifically is not aimed at any specific API - and couldn't really be given that it covers three different languages. The purpose is to do something that other tutorials do not do - and that's cover an object orientated approach, and multiple languages from the absolute beginning. The series will then later branch into more specific topics; one of which is being written simultaneously and considers game scripting in Unreal Tournament 3. Other branches will later cover mathematics and rendering, and another both OpenGL and DirectX simultaneously.

+2 votes     reply to comment
PiNwOrM45
PiNwOrM45 Nov 22 2009, 12:27am says:

edit: ignore me, missed a step :P thanks for this

+1 vote     reply to comment
PiNwOrM45
PiNwOrM45 Nov 22 2009, 1:09am replied:

Now that I've done it and got it working, are you still planning on released more parts? I know it takes work, but you said you planned for a week and it's a month later. I'm having a helluva time learning how to really get started.. All I can find are articles like this that overview the basic codes and give a basic idea, but nothing more advanced. That and people offering to tell you how for cash. So yeah, are you planning on releasing more? or does anyone have a good site I can check out that's on this tutorials level of knowledge, to learn the next steps? Thanks

+1 vote     reply to comment
ambershee
ambershee Dec 2 2009, 12:08pm says:

I do plan on releasing more - although I have actually been extremely busy over the past few weeks or so (and have also had to replace one machine due to a raid 0 failure). I've revised a large part of the original unreal programming tutorial series that I also have (which aims to be incorporated as an extension of this series in future), but I haven't been able to get back up to speed with this series yet.

The next tutorial is an incredibly long one and has taken an awful lot of time to get it as complete as it presently is. I may have to split it into multiple tutorials, although I really did want to get the content into a single tutorial as it is all related. It's presently effectively a heavy book chapter.

+1 vote     reply to comment
Sir_Nicholaz
Sir_Nicholaz Sep 22 2011, 3:16pm says:

I guess this died out or something?

+1 vote     reply to comment
catharsis20
catharsis20 Dec 17 2012, 5:38am says:

Thanks! What's next?

+1 vote     reply to comment
christopherlayton5
christopherlayton5 Sep 6 2013, 10:17am says:

I enjoyed the freak out of this. Though I noticed you didn't have any more of the series posted in your tutotials section. Probably busy, but I'll pretend to rage anyway.

+1 vote     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Established
Nov 9, 2007
Privacy
Public
Subscription
Must apply to join
Contact
Send Message
Email
Members Only
Membership
Join this group
Group Watch
Track this company
Tutorial
Browse
Tutorials
Report Abuse
Report article
Related Groups
Shee Labs Game Development
Shee Labs Game Development Developer & Publisher with 14 members