Experienced Points: The Language of Game Development

By Shamus Posted Tuesday May 13, 2014

Filed under: Column 117 comments

This week we’re doing another quasi-technical article, talking about what languages are used to develop games. The Escapist has recently expanded their focus to include science and tech, and I’m sort of testing the waters to see what kinds of things people want to read about. I know here we like to talk about coding, but we’ll see what people say.

Also, what quasi-technical questions would you like to see tackled in 1,500 words or less?

 


From The Archives:
 

117 thoughts on “Experienced Points: The Language of Game Development

  1. Piflik says:

    As long as you don’t recommend Java, I am happy.

    I do like C++ for its easy memory access and the evil black magic you can do with it (as long as you are careful), but I code mostly in C# nowadays (because I like Unity)…I do miss some C++ stuff, but I still can access memory if I really want to, and C# is garbage collected, so I don’t have to double-check everything for memory leaks, which is always a PITA…

    But in the end it mostly comes down to semantics…you can easily learn the basic syntax of any programming language (except maybe Brainfuck), but if you cannot build good algorithms, it doesn’t matter if you write them in perfect C++…BubbleSort is slow regardless of syntax…

    1. Svick says:

      You’ve got it wrong. You can learn all the syntax of Brainfuck in five minutes. But because of the extremely limited syntax, writing anything useful in it will take a very long time.

        1. Background_nose says:

          Glad to spot a post from you, your blog went quiet and I was starting to wonder. I enjoyed following it a lot.

          Hope your health isn’t being a problem.

    2. Zukhramm says:

      Though if you can’t build good algorithms you can just look up some since there are plenty of good algorithm already in existence. The larger structure of your program is the far harder part.

    3. TMTVL says:

      What’s important isn’t the language, but the libraries/frameworks used.

      Also, the worst games programming-wise have been made with Unity. So many fucking problems. From games that don’t react to the Quit Game button being pressed and crash every 3 minutes, to games where the view pans up unless a setting in a config file is changed.

      1. Ravens Cry says:

        And yet, there is Kerbal Space Program, which is freaking awesome.

      2. Jack Kucan says:

        I use Unity, and I can verify that that is entirely the developer’s fault, not Unity’s fault. It’s just horrible programmers can get farther with Unity than any other prebuilt engine, partially because it’s free.

        1. wererogue says:

          And partially because it’s easy. It’s a testiment to unity’s usability that terrible programmers can produce semi-functional games with it.

    4. ET says:

      Heh. I used to always joke that C# was just Java, with ten years of garbage removed from it. Both are high-level, both are garbage-collected, but C# does some things easier than Java, and has some cool sexy new paradigms built into the syntax and libraries. However, take this line of reasoning with a grain of salt; I only used them for school, and half a decade ago. :P

      1. Retsam says:

        Java was my first language, but I got to say I really loved C# when I used it for work for a few months. It’s less about “garbage removed”, but more like “Java with a bunch of nice features that java could have if the language designers weren’t such object-oriented nazis”.

      2. Volfram says:

        Both C# and Java are also interpreted, which has its respective pros and cons.

        Java was never designed for performance, it was designed for portability. To that end, the binaries tend to be very small, but not very well optimized. C# was designed to be a legitimate successor to C++, and as a result while the binaries may not be as compact, it is VERY heavily optimized.

        If you like C#, I would encourage you to look at D, which has a lot of similar features because it was designed with a lot of the same reasoning in mind, but is also compiled, meaning the system doesn’t need to have an interpreter installed like with C#(which has always been my major turnoff).

        And then there’s LLVM, which isn’t a language so much as a…thing… but it seems designed to erase the line between compiled and interpreted languages.

        1. wererogue says:

          I like D a *lot*. Sadly, for my purposes I needed .dll and .so support to work properly, and at the time I was playing with it (about a year ago), they didn’t. I have no idea what the state of play on that is now.

          1. Volfram says:

            not much different.

            You can get .dll files to work IF they’re the format your D compiler needs(there are a couple of formats for .dll files. The Digital Mars compiler only supports one of them) AND you’re able to adapt the header file into D. Which is a pain.

            If you’re looking for OpenGL and SDL support, there’s a fantastic library called Derelict available which bridges between D and some of the most popular open-source media libraries. No LibUSB support, sadly. I’m using Derelict 2 in my game project.(Not sure what all Derelict 3 supports, but I do know it will lock you into OGL3.0 or later)

        2. silver Harloe says:

          “compiled to ‘byte code’ and run on a virtual machine” is not *quite* the same thing as “interpreted”.

          1. Volfram says:

            That doesn’t change the fact that Java is classified as an “Interpreted” language.

            1. silver Harloe says:

              By whom?

              1. silver Harloe says:

                My point is the use of the passive “Java is classified…”
                implies one of two things:

                1) by everyone (clearly false, since I’m part of everyone and I already said I have a third class for compiled-into-bytecode languages) – or at least 99% of everyone (who has an opinion at all)… but barring evidence for it, I’m not really believing 99% of programmers think of byte-code languages are just the same as interpreted languages. A typical feature of an interpreted language is the ability to just run it without a compile step.

                (Nor am I believing that everyone who is familiar with Java (especially with its various compiler forms) even considers it a byte-code language anymore).

                2) by some central expert or consensus of experts – which in CSlande pretty much means the IEEE and just about no one else. Are they even in the business of classifying languages, though? They probably have a standard for what should be IN Java and its standard libraries (or maybe not. they may leave that to Sun for now), but no standard for how it should be executed (there are full compilers for java, just-in-time compilers for java, byte-code compilers for java… and there’s probably an actual java interpreter, too, somewhere).

                or 3) what am I forgetting or missing here?

            2. Groboclown says:

              As a Java snob, I’ll take issue with this. Yes, Java can be run in an interpreter, but with the Just In Time technology, most of the time Java is on-the-fly compiled into native code. Indeed, many aspects of garbage collection technologies and other technologies were pushed forward due to Java.

              Wikipedia has an interesting article on the matter of the JVM performance.

              http://en.wikipedia.org/wiki/Java_performance

              The Java side of game development is still active, mostly due to Android, though Minecraft helped give it a boost when it became popular. Most Java game developers use one of the many OpenGL packages, such as LWJGL.

    5. meyerkev says:

      I’d also add to this that if you EVER want a job programming, you need to know your algorithms and data structures.

      Because every single interview including Google/Facebook/et al is going to ask about that. Trust me. I did about 100 coding interviews Fall 2012. 90%+ of them asked this stuff.

      You can’t design well, meh, you can fake it. You can’t pop out a singly-linked list class in about 5 minutes? No hire.

      1. Volfram says:

        I would tend to agree. Being good with a particular language or with a lot of languages isn’t nearly as important as being good with data structures and algorithms. At my last job, the company’s flagship product was a high-end office application written in JAVA of all languages, but it’s considered the best in its class for what it’s used for, and what I learned while working there had less to do with the Java language and more to do with how you put things together.

      2. psivamp says:

        That’s great news for me I suppose. I just got done teaching people basic algorithms and data structures for about 3 years. Too bad that I’m supposed to be a professional engineer and doing chemical plant design and operation stuff.

    6. Retsam says:

      Java’s got problems, but I’m a bit of a heretic in that I easily prefer it over C/C++. My theory is people feel forced to use C++ due to it’s performance, and then get Stockholm Syndrome where they decide that they really love the language.

      1. wererogue says:

        I used to work for a games company that worked entirely in Java – but they threw away the majority of the standard libraries (for example, String) and rolled their own, for some incredible gains in performance and some excellent integration of features that they used a lot.

        It’s a big undertaking, but applied correctly the gains are fantastic.

        1. Retsam says:

          That’s neat. I’ve heard of people doing something similar with python where they eliminate all of the dynamically sizing data structures and the language becomes much faster; I wonder if that’s the main thing that needs to be eliminated from Java as well.

          Though it surprises me that String is so inefficient.

          1. Zukhramm says:

            I can only speak for my own Java game but data structures and strings are not taking a lot of my time, the big ones are drawing and network communication.

  2. rofltehcat says:

    What we were told by computer scientists in our very limited course for engineers (they taught us Java…) learning one language really well and limiting yourself to it is the wrong way to go. Understanding the basics and then being able to quickly pick up a new language is supposed to be better but would your boss leave you enough time to learn it (and some time from colleagues to help you with that)? Or would he instead just hire the other guy who placed his bets on the right horse?

    I think it was already discussed on one of the Diecast. But still, what about “game development” (or comparable) majors/masters programs? If I remember correctly, going the route of computer science (or arts/management) route instead (and doing some game development on the side) was seen as a better choice (because it can earn you money outside of game development,too). Now, I agree with that but I just found it strange that the topic of majors choice was brought up in the article but game development majors/colleges/whatever weren’t mentioned.

    1. I think it was broadly covered by “don’t wait for them to teach you something in school”. It’s not going to hurt, but a CS grad with a game in a store > Someone with a “game development” degree and nothing else. And someone with a successful game is > than anything else.

      So really, if you want to make games, just go do it. You first attempt is going to suck, but you will learn way more trying and failing than just being lectured at about arbitrary CS stuff.

    2. MadTinkerer says:

      “But still, what about “game development”Âť (or comparable) majors/masters programs?”

      I can heartily endorse avoiding at all costs the Game Design course at Camden County College in New Jersey. Imagine, if you will, a technical course with one introductory programming prerequisite that’s run like a business major course and falls under the purview of the graphic design department. It’s not too bad right up to the point where you have to actually make a game, and then it’s an unimaginably preposterous trainwreck run by a teacher that makes Harold Hill (The Music Man) look competent.

      And if your teacher decides that it’s okay that your programming partner doesn’t need to cooperate with you, (even though you both need to cooperate by definition) and that all the technical problems that result are your fault because you’re not cooperating hard enough, you are shit out of luck. Because trying to explain what happened to the Dean just doesn’t work.

      In my experience, pretty much any game design course thrown together by any institution that doesn’t run it like a technical course is worthless. One can understand why it was put together that way at the very beginning. One’s naivete at the time led one to believe that the people in charge knew what they were doing. But there’s no excuse for keeping the program going in that format, year after year.

      1. Volfram says:

        Wow, that is… very different from the Bachelor of Innovation degree available at the University of Colorado at Colorado Springs.

        On the other hand, I knew the guy who fought tooth and nail to get the degree added. He was one of my favorite professors, a genius at programming, and a gaming enthusiast… who makes his sons do most of the work in their games development side project. The Innovation degree ends up amounting to a minor in CS with Business and a few other Liberal Arts classes bolted onto the side.

        As a side note, if anybody who ever reads this post happens to be attending UCCS or plans to attend in the future, find one of Dr. Tim Chamillard’s low-level courses and take it, even if it’s outside your regular major. He’s a blast.

    3. Hugues Ross says:

      I think it depends on the school, really. “Game Schools” that only offer game development-related majors should probably be avoided, but some regular colleges are beginning to offer game development courses of their own.

      I’ve been in the game programming major offered by Champlain College for 2 years so far, and it feels like I’ve learned quite a bit from it. They make us take quite a few CS and Software Engineering classes on top of game-specific stuff. They also make us work with all of the other game-related majors(design, management, and art) in some classes. They also teach us practices like agile that don’t get covered as thoroughly in the CS major. On top of that, most of the teachers have experience in the games industry working in the field that they’re teaching.

      Of course, this is just one school and I don’t know how good or thorough other schools are with their degrees.

    4. kingmob says:

      I’ve never understood the concept of ‘learning’ a language anyway, because the name language is really apt. It’s just a translation of ideas. It’s the ideas that matter and it is generally not that hard to figure out how to implement them in the language.

      You can learn the intricacies and special little things of any language in a day, as long as you have a working knowledge of programming. Yes, you’ll save time if you know a language well, but that isn’t because you know how to construct a class or anything, but because you know the pitfalls, which libraries to use and what ide is the best. It’s the type of knowledge you’ll acquire in a very short time and requires minimal investment. There is virtually no difference between several months and 10 years of experience in a language.

      So many programming skills are so easily transported across languages that this focus on languages is really strange.
      A little bit above I see a mention of every company asking for lists classes. It is important to realize that this is entirely the wrong question to ask in an interview. They should be asking how you would solve a specific problem and based on your experience level, specific algorithms should be your answer. That is the knowledge a programmer needs, not an encyclopaedic knowledge of how an algorithm is implemented.

      This is all a bit hyperbolic of course. I’m sure there’s many fringe benefits involved in knowing a language well, but my point is that these are not the main skills a programmer needs. Unless you really believe Carmack does so well because of his extensive knowledge of languages.

  3. Ilseroth says:

    As someone considering spending this summer developing a small independent game for the sake of experience, this pretty much is accurate based on what I know of programming.

    Back when I was going to school for coding (decided to switch majors as for a job I don’t think coding would have worked out for me) I was originally trained in C++, then Basic, then Java. Then when I moved out of high school (keep in mind this was 6 years ago)and moved to college they taught exclusively Java.

    I wasn’t particularly fond of Java, but for the most part they focused less on the java specific methods and more on universals.

    That being said, when/if I do work on the project, likely I will be taking the route of least coding, likely using a premade engine as I don’t have the technical skills to build one myself. While I am setting the goals low for an initial prototype (I could get into what *type* of project, but that would take a while) I am hopeful I can get something done pretty quickly

    I have done some fiddling with python code, since Skyrim’s creation engine has python code attached to everything. Seems very… minimalistic compared to java; but then it is nesting everything in a set engine; didn’t get into the engine work itself.

  4. DaveMc says:

    Would you be allowed to do a series? Because some sort of condensed version of one of your past programming projects would make a great addition to The Escapist, I think. Pixel City or Projects Frontier or Octant, f’r instance.

    Now, I’d *like* to think that they would interest people because most visitors play games and thus would appreciate some grounding in how graphics or procedural generation actually works … But then again, sometimes the comments over there make me want to weep quietly, so maybe I’m being too optimistic.

  5. TMTVL says:

    Ah, Python. Siddown, kids, it’s story time.

    Several years ago, there was this guy at my job who programmed in Python in his off time. For our job we programmed in Java (still THE go-to language for Enterprise).

    He wrote a bug which I only caught after the program crashed like 8 times on the test server:


    ...
    if(condition)
    do something
    else
    do something else
    goto fail;
    ...

    The goto fail (same thing as happened with Apple a while back) was occuring every single time, because he forgot to use curly brackets; which you don’t use in Python.
    After that the company introduced a policy of always using curly brackets, which still trips up people sometimes.

    1. Dev Null says:

      I like Python – I really do! – and it has some fantastic libraries for scientiffic computing, but any language that uses specific amounts of whitespace as part of it’s syntax is just evil.

      1. Bryan says:

        Why?

        When you do use brackets for the syntax part of blocks, and the indentation of the code doesn’t match the brackets — as, note, it doesn’t do above, which is the whole problem — then humans’ brains use the indentation rather than the brackets.

        Why not drop that ambiguity entirely, and just use what humans use, to drop the possibility of getting people confused?

        Or I guess you could do like Go does and provide both an official style guide *and* a code formatter tool in the standard distribution, and get rid of the ambiguity problem that way.

        1. Zukhramm says:

          Redundancy is useful. Brackets and indentation is easier to read than just indentation.

          1. ET says:

            Redundancy allows a second (or more) place, where something can get changed. Which means there’s a chance somebody won’t change both at the same time, thus introducing a bug. As for readability, we’ve got editors to highlight the indentation/brackets/etc for us. :)

            1. Zukhramm says:

              That problem is easily solved by not allowing unbracketed statements after a newline and it’s impossible to forget to change anything.

              And I don’t think a language should require specific editor features to be readable.

              1. ET says:

                “not allowing unbracketed statements after a newline”
                That’s what Perl does. However, the flipside of the argument is “Never allow bracketed statements”, which is how Python does it. So, really, the choice is, do you want to fix C/C++’s error-prone syntax the Perl way, or the Python way? :)

                As for the editor features, you can make Python’s end-of-indentation easier to find, without using highlighting. Just stick an empty comment at the end of the thing, so it lines up visually with the if or the while or whatever. Still saves you from having to waste a line on a squiggle bracket, or make slow-reading mess* with your squiggle on the previous line. :)

                * I hate Egyptian brackets. :P

                1. Zukhramm says:

                  If you add comments to show the end of blocks you’re back to the programmer being in charge of readability, which is what Python tried avoiding in the first place. And for supposedly being error-prone I have never managed to somehow forget to write the brackets.

                  So Python is losing something useful to avoid a bug I’d never cause and to enforce something everyone’s already doing anyway. It’s a solution to something that’s not a problem, and it’s not worth it.

                2. Kian says:

                  I can understand the reasoning behind making the indentation have syntactic meaning. But I can’t get over the idea that whitespace shouldn’t matter. I prefer braces.

                  That said, I don’t like redundancy. There needs to be as little ambiguity in code as possible for the humans to understand what is written. If I could make my own language, I’d probably settle for C++ with all the syntactic sugar stripped out, and a few minor changes:

                  – No operators (which handily gets rid of operator overloading too, which is terrible). You want to add things, use a function (which is what you’re doing anyway). This handily gets rid of the issue with operator precedence too, since the order of operations becomes obvious by how your calls are nested.

                  – Get rid of struct. Just use class and set the members public. Saves you the trouble of having to explain to newbies that structs and classes work exactly the same, save for structs defaulting to public access and classes to private.

                  – No more naked pointers. This has many benefits. Requiring the use of smart pointers everywhere means that people have to actually think about the lifetime of their objects, which leads to cleaner design. Memory leaks also become impossible. And there is no performance penalty, unique pointers behave just as naked pointers, with the only difference that they remember to delete themselves when they’re done. Move semantics (new in C++11) even allow you to change ownership at basically no cost.

                  – Always require braces after if, while, for, etc.

                  – No const keyword. Everything is const by default, instead, and you have to declare things mutable.

                  1. Zukhramm says:

                    Why would redundancy cause ambiguity? If it did, we would prefer not to indent our code over doing it.

                    1. ET says:

                      I think Kian meant redundancy in the number of ways of doing things, like in the syntax of a language*. My example of a redundant thing I hate, is the infamous ? operator in C/C++/etc. Even one of the authors of the C bible (I can’t remember which of the two it was.) wishes he’d never introduced it into the language. Sure, it saves a couple of characters, and makes your code tinier, but it’s so seldom used, that most people need to take a second thought, to remember how the darn thing works. IF-ELSE-ELSIF stuff, on the other hand, is always understood, because it basically spells out in words what’s going on.

                      * Correct me if I’m wrong; I don’t want to put words in your mouth.

                    2. Kian says:

                      Pretty much like ET says. The classic example is skipping braces for one line blocks after if, while, for, etc. When you first write the code, you only need one line so you skip the braces. Someone comes by later and adds to it (maybe even you) and forgets about the braces. If you’re lucky, you realize the mistake right away. If you’re not, you ship a hard to reproduce bug.

                      And it does happen. After a long day of coding, silly mistakes slip in. Redundancy means that there is more than one way of making mistakes. Redundancy also makes for a more bloated, complex syntax, which makes for poorer development tools.

                    3. Zukhramm says:

                      Alright. I was talking about something else.

                      Though I’m not sure I agree and even if I did I would defend the ?-operator as not really doing the same thing as an if-statement at all, though one common way to do both would be preferable to splitting them.

        2. Mephane says:

          Why not drop that ambiguity entirely, and just use what humans use, to drop the possibility of getting people confused?

          There are languages who indeed do that, for example F# does not have curly brackets for blocks of code, and only looks at the intendation.

        3. Volfram says:

          “Why not drop that ambiguity entirely, and just use what humans use, to drop the possibility of getting people confused?”

          Because humans ARE ambiguous. Especially if, like me, the only languages you’ve ever used ignored whitespace, when you go and make whitespace part of the code, you screw everything up.

          Also, sometimes something’s simple enough that it’s nice to be able to just throw it all on one line, for example an exception where you don’t really want to do anything if an exception is caught. Using explicit identifiers and ignoring white space allows you to space things so they’re easier for a human to read without confusing the compiler.

        4. TMTVL says:

          Well, sometimes you get code you just can’t conveniently break up, and then it can be useful to keep stuff on the same indentation. Just to avoid having to scroll two pages to the right just to read what happens in very special circumstances when a bunch of error handling has been done.

          class
          function
          if(x)
          try
          if(y)
          try
          and so on
          catch
          catch

          1. Volfram says:

            And matters are only compounded when you try to post that code on a forum that strips whitespace.

            Like this one!

        5. Hugues Ross says:

          “When you do use brackets for the syntax part of blocks, and the indentation of the code doesn’t match the brackets”

          Pretty often, in my experience. More specifically, I disregard indentation for extremely short functions (think getters/setters, for instance) where expanding it beyond 1 line would only serve to make the code harder to read. In addition, I generally put preprocessor statements (e.g. #whatever) in without indentation to separate them from the actual code.

          Beyond that, another argument I have against whitespace-based syntax is that it forces a specific coding style. Some people might like that, but I personally find it to be very restrictive and annoying. There are plenty of ways to arrange things with braces, but almost none when working with indentation.

        6. Dev Null says:

          Because whitespace is ambiguous – the way that it displays is entirely dependent on your editor. You end up with the old “is that a tab? or just a string of spaces?” problem. And then to make things worse some editors – under some configurations – insert tabs as tabs, and some insert strings of spaces. A bracket is a bracket; you push the button, it makes the symbol on the screen, it displays the same in every editor.

      2. ET says:

        I’m going to chime in with Bryan here. In my very limited experience, all the “good-looking” code, no matter whose style we were using, has uniform indentation. Since indentation is already mandatory to make things readable, then it makes sense to also use it to do the job of curly braces. Two less characters to worry about introducing bugs. :)

        1. Bryan says:

          Well, one person out of … what, ten? … isn’t bad. I guess. :-)

          (Never tried to do opengl with go(lang), but I wonder if its rigidly enforced style and formatter shipped with the language would make a difference with people. Forces tabs for indentation, forces braces for blocks, forces the open-brace on the same line as the if or for statement, forces “} else {” lines, although standard go style is to avoid else and use defer plus early return, etc. It is the other way of avoiding the problem where brackets mismatch indentation at least.)

  6. Khizan says:

    I’ve always been of the opinion that C is a great place to start if you want to seriously program because C teaches you the most about how things actually work inside the programs.

    You don’t need to be a “three star” programmer in C, but having a foundation in C makes understanding what’s going on under the hood in Java or Python much easier, imo, because C is a lower level language that makes the programmer responsible for memory management and other such things that higher level language handle independently.

    1. Tse says:

      In my job training I did a 4-day crash course in C++. I found it to be great at introducing basic programming concepts and logic.
      In 3 days I learned enough to make a decent text-based codebreaker game. Hope ABAP is as easy and logical as C++, because that’s what I’m starting next and what I’ll be using to earn my paycheck after I finish the course.

      1. Wide And Nerdy says:

        Operating on a distant memory of an ABAP course I once took, I’d say study some other stuff on the side. ABAP is limited to database and reporting tasks from what I recall (and only runs in SAP, which by the way can also use the much more versatile Java though I couldn’t tell you what its like to code with either one in SAP as I didn’t want to get locked in like that).

        1. Tse says:

          Well, I will continue with C++, of course. Maybe pick up another language after that. ABAP is what I will get my paycheck for, though.

    2. ET says:

      I think you can go about it from either end:
      – Start in C, and learn about memory, pointers, etc early on, and then you understand some things better in high-level languages.
      – Start in Python, so you can focus on learning algorithms, then you can understand memory/time tradeoffs, and learn the nitty-gritty things to make those tradeoffs in C.
      Definitely, we need to optimize some things that the machine can’t do on its own, but Moore’s law has been in effect for a good long while. So, instead of trying to go from O(32n^2 + 15) time/memory down to O(14n^2 + 3), worry about going from O(n^2) down to O(n * log_n). Horsepower takes care of the additions and scalings to your space/time requirements. :)

      1. psivamp says:

        Any time that I’ve ever discussed time complexity and big O notation, we’ve always neglected coefficients and just paid attention to the highest order n’s. Basically, O(32n^2 + 15) and O(14n^2 + 3) are both O(n^2) because that’s how they scale with data size. Constant order parts of the algorithm are unimportant and if you had O(n^2 + n) then the n^2 dominates.
        Since the whole notation is based on assuming that each line of code is a single operation that takes the same amount of time, I think the other simplifications are fairly justified. But I could be wrong, maybe my professors have given me an overly simplified account of things.

        1. ET says:

          For “large” n’s, yes, the exponents dominate. The trickiness is is you have something like O(5400 * n^2 + 9999 * n + 12000000). Obviously a faked, exaggerated example, but sometimes the n is small enough, or the coefficients large enough, you need to worry about optimizing your code with the same algorithm. i.e. Get the coefficients smaller. Also sometimes you also have really tight memory/time constraints, like in video games and the other examples Shamus gave, so that also bumps up the importance of the coefficients. :)

          1. psivamp says:

            Fair enough. We really just used it to talk about the relative merits of different algorithms with scalability being, I guess, the key factor.

            1. Bryan says:

              This is why once in a great while, bubblesort is actually the right answer. Because the large coefficients on the n*log(n) for quicksort, even in its best case input, just don’t make sense when n is guaranteed to be small enough. In that case the lower programmer time of just whacking together a fast bubblesort is fine.

              On the other hand, you could argue that having to whack together any kind of sort algorithm means you’ve already lost, and you should be using something like std::sort instead. And yeah, maybe you’re right; not sure.

  7. MichaelG says:

    How about an explanation of game physics? You can use the bouncing cars of HL2 as an example.

    1. MichaelGC says:

      That’d be good! Plus, already got the first draft done, sorta:

      http://www.shamusyoung.com/twentysidedtale/?p=16210

  8. MadTinkerer says:

    Turns out Common Lisp is actually pretty easy to learn. The problem was that it was originally designed for specialized hardware and then later locked behind those advanced math classes for too long. Eventually someone wrote Land of Lisp and I’m hoping to write a game engine in Lisp when I finally have the money to quit my day job.

    Also Game Maker is super good despite not being Lisp-based.

    1. Kian says:

      Nice! I was wondering if anyone was going to mention Lisp. I’ve been trying to learn Lisp for a while now, but lack of time and no useful purpose to give it has kept it low on the priority list. I’m a C++ programmer (entered a mobile game company about a year ago, which I’m very happy about), and C++ is our meat and potatoes there since writing your engine in C++ means “easily” porting it to iOS, Android, Windows Phone and Windows, but I’ve found Lisp to teach a different way of approaching problems that’s worth examining.

      I started with one half-assed Pascal class in High-School, before being introduced to C++ in university. I think C++’s greatest failing, and the reason for all the hate, is it’s popularity. Too many people are introduced to it before they really learn enough about computers to be able to exploit the performance advantage without hitting every pitfall of the language (I include myself in this group). A language like Lisp would be better suited to everyone (more on that below).

      These people then enter the workforce with “C++” in their resumes, and eventually find their ways into just the right place to do the most damage. Some will actually care enough about their code to learn and improve, but too many people are happy enough to earn a paycheck and coast along, with barely functioning code bases that are impossible to maintain. As a result, C++ becomes reviled.

      It’s second greatest failing is the ridiculously overcomplicated syntax (which the new C++11 standard, and planned C++14 standard, have tried to address), since it was originally a superset of C. C may be awesome, but it’s not perfect. Given it’s original constraint, C++ couldn’t be a “better C”, it could only ever become a more complex C.

      Of course, without this behavior it couldn’t have gained the popularity it gained. C++ wasn’t the first Object Oriented programming language, and it didn’t bring any advantages that older languages didn’t already have. But C is everywhere, and being able to plug in the new compiler to your project and migrate it piecemeal while keeping all the expertise of your C programmers was a big hit.

      Going back to Lisp, the MIT press makes it’s own course book for introduction to programming available for free on the net here: http://mitpress.mit.edu/sicp/full-text/book/book.html
      I’m going through it now. Haven’t had the time to dive into the exercises yet, but it’s pretty cool how it slowly introduces everything.

    2. Adso says:

      Interestingly, big-name games have been written in Lisp””not in Common Lisp, but in a special in-house dialect called GOAL (Game-Oriented Assembly Lisp) designed by Naughty Dog for the Jak and Daxter games. They describe various advantages to doing so””for example, their toolchain was set up so that any symbol, function, or set of functions could be recompiled and sent into a running game instance on-the-fly, so they could get to a point and e.g. add a print statement or try a different function definition as needed. Another advantage was that it was designed to be well-integrated with assembly code as needed, so assembly code could be dropped anywhere and still refer to variables in GOAL, and GOAL had language features to write towards particular assembly.

      GOAL ended up being scrapped in favor of C/C++ when Naughty Dog was bought by Sony, apparently mostly so that they could share code with other studios. This thread has a few posts from a mailing list which describe GOAL, some of its features, and why it was retired. That said, Naughty Dog still has some of the old Lisp experts, so various parts of their toolchain (in particular, the scripting and data definition parts) are still Lisp-based.

      Also, John Carmack, in his 2013 QuakeCon keynote, advocated for the adoption of Scheme/Lisp as a scripting language for games. All of which is to say: Lisp for games is a great idea.

  9. swenson says:

    I really liked the article. A good basic intro to the topic, I thought, with some solid advice for newbies. I definitely think more along these lines would be good. (although obviously I’m somewhat biased, as I love programming already!)

    What about an article or two explaining some of the weird conventions in games and why they work that way? You know, things where the way programming works limits how the game can function. I guess that’s a pretty broad spectrum… everything from weird physics bugs to why 256 pops up so often. But it could be an interesting way to take people from the side of the player around to the developer’s side and understand a little bit more about why things work the way they do.

  10. Wide And Nerdy says:

    The only thing I’d add is stick with it. Even if it seems confusing at first, even if it seems like you just barely get things for a while (which can be especially true with something like web development where you have to understand how multiple languages and systems play together and you’ll often find yourself asking “how do I do X with this?” and the answer is “You don’t, you do X with this other thing”). Even if it feels like you’ll never get it. You’ll get it eventually and its so worth it when you do. Even the smartest developers I’ve known personally feel dumb sometimes when they’re doing this stuff and most reported to me that they struggled with this or that concept in the beginning.

    Also, don’t be afraid to build on what others have made freely available in the community. Its a great way, especially during your early efforts, to see results from what you’ve learned. I get a lot of mileage out of javascript libraries and plugins.

  11. Alexander The 1st says:

    I do have one particular thing I’d like elaboration on, personally – okay, somewhat two of them, but they feel like the same roadblock to me -, since I keep seeing example code on the internet or source code for a project, but can’t seem to ever get to the point where I can use it.

    Specifically, in my degree, we started with Python, which works well because when you install it, you have no development environment to set up before you can start coding. Well, at least in vanilla Python – setting up a server environment and being able to take one’s code and have it run on a server on one’s machine is difficult, and I still end up not knowing how to fix the bugs in implementation I get when I try to implement the same thing.

    Then we started with Java, where you do have to learn how to set the environment variables so that it’ll compile, but instead of working with larger projects via command-line compiling, we jumped up to using Eclipse to handle our project creation. Or Netbeans when we were doing server programming – but the latter could not have a standalone server element easily setup (For the stuff with using, say, ANT, to compile the code into a .war instead of a .jar and have a server start up and use the code as the server code – not to mention have it pickup requests outside of a dev-computer network, nobody seems to have a good source for this that doesn’t have 80 pages of boilerpoint assuming I don’t even know how to code Java in the first place – or even have example code I want to run on the server itself.)

    But I bring those up because whenever I see example C/C++ code on the internet, I don’t actually know where to start with getting a compiler to compile it so that I can test and see what’s going on with it.

    Missing this sort of ground-work for being able to turn source code I know how to write into self-contained executable code is something I wish I knew how to correct, but nobody seems to have sources for doing this – instead focusing on syntax, which at this point, I have a general feeling for how to write in many languages – but can’t seem to start in a large portion of them.

    Which I guess makes this less “What programming language should I learn?” and more “How do I set the ground work to make a computer *let* me learn in programming language?”

    1. Retsam says:

      Java (and C++ if you’re not on windows) really aren’t that bad to get set up, particularly if you’re working from the command line. People associate command line as “high competence wizardry” and IDE’s like Eclipse as something that makes your life easier… but I’ve found it to be the opposite. Getting a project going in Eclipse (or doing anything mildly complicated, like importing existing code) is always a nightmare, where as on the commandline it’s basically “javac *.java;” to compile and “java EntryPointClass” to run.

      Granted, where that breaks down, and where something like Eclipse is useful is managing larger projects, with multiple dependencies to deal with, and libraries to use, but at that point complexity is unavoidable, and you’re well past “I just want to learn how to program this language”.

      1. Alexander The 1st says:

        Well the problem there lies – I already use Eclipse for Java. Well, unless I’m using Java EE stuff – then the only configuration I know how to develop myself involves letting Netbeans load the Apache server. A quick look at what I’ve worked with at work implies Ant is needed to sync with Apache in some way, but as far as I can tell, Netbeans is being obtuse about what exactly it does to get the Apache server to load. I’m not exactly familiar with the process involved with the ANT scripts it develops either, and while I feel I *should* know where to look, I have yet to find anything that works. Though it has been a while since I’ve tried to get this to work.

        And as for C++…I am on Windows 7, specifically – so far as I can tell, Visual Studio is recommended but not required to develop in it?

        Specifically, I was interested in trying out the screensaver stuff Shamus did earlier, and this project’s source (Though it appears he made a x64 Windows binary afterwards – now I really have no excuse to not try this out), since at the time I wanted to experiment with the codebase and learn C/C++ a bit more thoroughly and get an idea of how the file structures tend to work and such. I know I should be doing something to enable the C/C++ equivalents of javac/java on the command line, but I’m not sure what or where – which doesn’t seem to be as easy to find on forums as say, pointer syntax in C/C++, at least on the forums I’ve been on.

        To be clear, I didn’t take a CS degree; the degree I did…it’s…probably better described as Software Engineering-lite at best, since a lot of the stuff focused more on UI/UX/Graphic design and New Media manipulation, and less focused on programming.

        But it’s irksome to have to figure out how to do stuff like this when, for example, Python’s literally ready to go from the installer.

        1. psivamp says:

          If you have a .edu e-mail, you can get the latest (and several past) versions of Visual Studio for free from Dreamspark. My issue with VS is that they move stuff around every version, so if you know or have instructions for VS 2010 you will have a hard time finding things you need in VS 2013.

          If you already have Eclipse, you can download the CDT (C/C++ Development Tools) for it and get the MinGW compiler and tools. C/C++ aren’t as well supported by Eclipse as Java (go figure), but all of your management stuff will be in the locations you’re used to.

          There’s even a prototype-phase GLSL editor/preview plugin Synthclipse (sp?) if you’re moving into OpenGL territory. If that’s where you see yourself going, you may also want to check out LWJGL and stick with Java while you do it.

          Your mileage my vary. All opinions expressed are my own.

        2. Volfram says:

          If you’re on Windows, I would look up MinGW, the prepackaged GCC suite for Windows. Doesn’t come with an IDE, but Eclipse should have the settings for it already available and waiting for you to point to the compilers. That’s how Code::Blocks works, anyway.

      2. Volfram says:

        As someone who worked as a Java programmer for 3 years, I have a confession to make.

        I’ve never created a Java project that I was able to get running. Eclipse may(apparently) be a part of the problem, but I was never able to get it to work from the command line either.

        If you’ve got a project that already builds, I can do pretty much whatever you want with it, but I can’t bootstrap Java or C#.

        C, C++, and D are another thing entirely.

        1. silver Harloe says:

          “If you've got a project that already builds”…

          …this is how I learned to make a project run. I started with a project that builds, and started removing chunks of it until I had the platform I wanted to start my new project from.

          It’s why I’m always so eager for Shamus to release source. I don’t know how to get a basic Windows-based thing started. But if I had the source to Project Frontier, I could rip out all the bits until I had a thing that makes a flat plane that I can fly over and start from there.

      3. evileeyore says:

        Heh… I just got your handle.

    2. Kian says:

      Hmm. I’ve tried to write this post three or four times now, but I have to keep starting over because there is no straight forward way to set up a C++ development environment. So instead, I’ll explain what the compiler is doing when you build an executable (which is different from what Java or Python do, since those are managed and are running on the Java or Python runtime, not really as independent processes). Then I’ll explain how to get that to work.

      So, say you have a source file: “HelloWorld.cpp”. This is just a text file (the extension is there just to make it clear to the humans that it contains source code).

      Our goal is to turn that text file, which is readable by humans, into an executable file which the computer can run (I’m abstracting a bunch of things here).

      To do this, C++ has two main tools: a compiler, and a linker.

      The compiler reads the source file, and creates an object file out of it. If an executable file is a jigsaw puzzle, an object file is one of the pieces of the puzzle.

      The linker takes all the pieces (object files) and tries to assemble the program out of them.

      After calling the compiler and linker, you have the executable which you can then run.

      This process is the reason why setting up an environment is such a pain. In my example we only had one source file, which was compiled into one object file, which was linked into one executable. But consider a project with hundreds of source file, each being compiled into one object file, all of which have to be fed to the linker. There’s no way for a human to keep track of everything if you had to tell the computer to compile files one at a time.

      Obviously, this is not how it’s done. The first way to get around this complexity was to create Makefiles. A makefile is a file that details every source file in the project, and the various options that have to go into compiling and linking. Output directories, optimization level, etc.

      Unfortunately, as a project grows in size, even keeping the makefile up to date becomes a burden. Imagine having to dig through a text file (which is what makefiles are) to update it every time you add a file to your project, or remove a file, or rename a file, or decide to create a new target*.

      To handle the complexity of keeping the makefile up to date, then, IDE’s where made. IDE stands for Integrated Development Environment. Up to now I’ve been talking about command line tools, the IDE instead has a graphical interface that abstracts away this whole mess and provides you with easy to use tools that do all the bookkeeping behind the scenes.

      Visual Studio is one such IDE. Eclipse, Netbeans and Code::Blocks are others. Unfortunately, while they all do the bookkeeping for you, they each do it in their own way. Visual Studio has “Solution” files, which act as containers for any number of Projects that are required to build a particular program. Eclipse and Netbeans have their own equivalent project files. Netbeans is interesting in that it actually keeps a literal Makefile with your project options.

      So, after this short primer into the intricacies of compiling a C++ project, I can get to answering your question in a way that makes sense. First, install an IDE. If you are new to C++, Visual Studio 2013 Express is probably the best place to start. As a bonus, it should be able to handle C# projects as well.

      You now have two options: either get to know the IDE by creating a few new projects (every IDE will provide templates for projects that set everything to reasonable defaults and give you a working “Hello World” project out the gate), or look for code online with a project file that matches your IDE.

      Once you’ve gotten your head around all this, and are comfortable with your IDE, you can look for projects that have “CMake” files. Remember when I said that each IDE has it’s own way of keeping track of a project, and that you have to get a project file that matches your IDE? Well, some guys got to gether and wondered, “couldn’t we make a program that makes project files for EVERY IDE?”

      Turns out they could, and they did, but they sold their soul to Cthulu to make it work. Every time someone uses it they lose a bit of their sanity.

      I hope this was helpful.

      * A target is each possible “version” of the project you care about building. For example, every project has a Debug and Release version, and you might have 32 or 64 bit versions of your project as well, which require your compiler and linker to produce different executables. The Makefile keeps track of this as well.

      1. Alexander The 1st says:

        Ah, cools – thanks.

        That actually explains quite a lot – and hopefully I’ll be able to actually make headway with this then.

        Thanks again.

        EDIT: (If anyone’s curious, what it appears I was missing was the understanding of the linker/makefile stuff, and the stuff that branched off from that into IDEs. My courses seemed to have skipped over that when dealing with Python and Java.)

        1. Kian says:

          That’s because Python and Java don’t have a linker in the C++ sense. Instead, the code runs on virtual machines which interpret it. Java might be compiled into bytecode, which is an intermediate representation for speed, but your code is never turned into machine code. You always have an abstraction layer between you and the hardware.

          That’s also why you can decompile a Java program for example, and why you need to run an “obfuscator” to hide variable names. .jar files are zipped archives with all the source available.

          Python doesn’t even need to compile the code, you could type each line of a program into a Python interpreter and have your code running there.

          When you build an executable in these languages, what you’re actually doing is bundling the Java (or Python) runtime and your code, and running the exe means loading the managed environment and running your code on top of it. Which is why you have garbage collection and rich native libraries.

          There is no such thing as a C++ interpreter or virtual machine, however. You have a C runtime to set you up when you load your program, but the object code the compiler produces is the (architecture dependent) machine code that will be run on the processor. That’s where C++ gets its performance from, and it’s also why you need to do your own memory management.

          1. Volfram says:

            “There is no such thing as a C++ interpreter or virtual machine, however.”

            LLVM says otherwise, but that doesn’t mean it’s easy to get running. I don’t think they even have a proper Windows version available.

            1. Bryan says:

              As does the null pointer part of the standard.

              In C, a constant zero in pointer context is *always* equal to a null pointer, whether the hardware that your code is running on uses a zero for that or it uses some other value.

              So the compiler has to do some magic to make the C virtual machine match the actual physical machine it’s compiling for. Not much magic, but some.

    3. Zukhramm says:

      I’d assume most times you just find code on the internet that’s code aimed at people who already know how to set it up and compile it. If you want to learn the language, why not find some site or book that focuses on that instead of trying to compile random code from the internet?

      1. Alexander The 1st says:

        In the past, I’ve not found a site that makes it clear what *bare minimum* I need to be able to compile code for a certain purpose, or at least without shortcuts like “Let Netbeans handle your Apache server for you when developing” – in that case, I already know how to write the Java code that Netbeans would put on its built-in Apache server for local use, but I want to be able to figure out how to get the code to launch on a standalone Apache server on the same machine. I have a similar problem with Python – I know how to do CGI programming in Python, but I don’t know how to setup the CGI server in the same way I used one during a course that was provided by the department during the time I took that course.

        And as for C++, until Kian mentioned the linker/compiler behavior above, I wasn’t sure what I’d be looking for as it was. I’m hoping it’ll help me find what I’m looking for during today.

        My major concern with just trying to get books on the language to learn it is that I’ve learned a lot about the syntax by viewing people use it on say the xkcd forums, and I’d like to try analyzing some of the code freely available, rather than buy a book that tries to teach me how to do a Hello World or similar type of program yet again. I’d rather not have to buy a book to skip the first chapter or few that refer to that. Maybe I’m a bit stubborn about that, but my interest in learning a new language is to figure out what ideas I want to implement that can be done best in that language’s level of control, rather than turning everything into a problem that I already have the tools to solve it with – for example, Python seems to be great when you don’t want to commit to a specific parameter being passed into a function or if you want to build a framework involving strings and evaluation of variables via text input, but it’s default way of getting raw input from the user is very strict – recently, I had taken a look into trying to off-load that part of the code to Actionscript, and then use network code to pass over the parsing stuff to Python, but if I knew a way to do this in C/C++ with both input control and parsing well, I might do that instead.

    4. TMTVL says:

      sudo pacman -S jdk7-openjdk

      It’s not that difficult, is it? And most distros have software/package managers that offer you a GUI, which makes it even easier.

  12. Dreadjaws says:

    Hey, Shamus, what do you think of Codemancer?:

    https://www.kickstarter.com/projects/bobbylox/codemancer-a-fantasy-game-that-teaches-the-magic-o

    It’s a game that’s created to teach the basics of programming to kids. Sounds interesting, I don’t know if you’ve heard of it.

  13. Ravens Cry says:

    Shamus, you could write about Mongolian real estate economics and make it interesting. For me at least, you have a real gift for taking subjects I know nothing about and making them fascinating reading.

    1. MichaelGC says:

      True that. I tried to think of some interesting quasi-technical topics, but realised that my understanding of such is not so much quasi- as pseudo-, and in general I won’t realise a topic is interesting – or even that it exists! – before it has begun to be explained by sites like Twenty Sided or … well … there aren’t really any other sites like Twenty Sided, are there?

      So, I’ll second the call for an article on Mongolian real estate (and if you’ve arrived at this page via Google because you’re relocating to Ulan Bator, then apologies for wasting your time!).

      1. Ravens Cry says:

        It got them to Twenty Sided Tale, and while that wasn’t what they were looking for, it is most certainly not a waste of time. ;D

  14. Retsam says:

    I’ll throw out a slightly controversial one and say Javascript as a good starting language. It’s got that python benefit of not having all the C++ language family baggage, but still has the C++ language family syntax and more similar constructs. And you can’t beat it’s availability and ease of use, what with pretty much every web browser having a javascript console built right in.

    Also, it’s got a big benefit, particularly with game programming, of being closely integrated with the most useable system for designing GUIs ever, HTML/CSS. Even without any tools, HTML/CSS is easily a more usable system than, say, tkinter, which I think is the closes python equivalent; and there’s a ton of tools to make designing UI’s with HTML/CSS easier (bootstrap, jquery, knockout); more work has gone into how to design user interfaces in HTML/CSS than literally any other area of computer science in the last decades.

    1. Kian says:

      If you’ll allow me a bit of snark, more work has gone into HTML/CSS interfaces because nothing else requires so much work. And your interface will still fail differently in each of the four main browsers, and fail completely on the innumerable mobile devices.

      I have to disagree about Javascript too. Net technologies are an awful place to start learning. They’re an awful place to then go to work, too, which makes it doubly awful as a starting point.

      As for why I say that Javascript is terrible for beginners:
      – The C-like syntax is not a benefit, unless you mean to use other C-like languages. Cut out the middle man and go straight for those other languages.
      – Its dynamic type system is ridiculously aggressive about casting from one type to another. “16” comparing equal to 16 is fine. “\n” (that is, a string consisting only of the new line character) comparing equal to 0 is not.
      – The type of NaN (Not a Number) is number.
      – Errors are ignored and execution continues even in the face of unhandled exceptions.

      Those are off the top of my head. The last three in particular would teach someone awful coding practices that would be serious hindrances when trying to learn other languages.

      1. Mephane says:

        – The type of NaN (Not a Number) is number.

        I agree on your other points but what other data type should NaN be? It is a special value of a floating point variable, similarly to stuff like positive and negative infinity.

        1. Volfram says:

          I think what he means is that if you ask Javascript whether NaN is a number, it’ll say “Yep, that’s a number!” and then you can load up your floating point values with NaN. You’ll need to perform an additional check on incoming values and compare them with NaN to determine whether they’re VALID numbers.

          That said, D treats NaN as a number of the appropriate type, as well, but then D is more strongly typed, so you already know whether you’re getting a number or not, and NaN is helpful for error detection(though given the way it propagates like herpes through a university, it’s NOT helpful for error LOCATION. “Hey, why are all my meshes not appearing? Oh. All the vertexes are at location [NaN, NaN, NaN]. Where did that happen!?”)

      2. Alexander The 1st says:

        ” – Errors are ignored and execution continues even in the face of unhandled exceptions.”

        Least favourite thing about Javascript, right here. Made worse by the fact that if you try to import 3rd party libraries and join them together on one page, you have to be careful because your editor won’t tell you if you’re doing incompatible things. It was an issue I had with, in particular, the Google Maps API – it took me a long time of debugging and having others looking over the code I had to realize I was mixing APIV2 code with APIV3 code – since the course was pretty bad about teaching us Javascript, that’s probably part of the problem since we all had to use online sources to understand the functionality we wanted, but for some reason the Google Map API was totally okay with linking to one library and end up using two different api sets. Until you tried to combine elements from both.

      3. Retsam says:

        HTML/CSS, at this point I think the browser compatibility thing is overstated if you’re willing to ignore IE and only focus on “modern” browsers. Or if depending on what libraries you use, (e.g. Bootstrap) they may take care of a lot of the backwards compatibility stuff for you.

        For the C syntax, I don’t see javascript as a “middleman” to other languages, but at the same time it’s handy that, if you do program other languages, you won’t be as messed up on syntax as you would be if you came from something like Python or LISP or Perl.

        People always complain about the == behavior and say it’s a critical flaw to Javascript… but any decent tutorial (and most linters/hinters for that matter) teaches you not to use it unless you have a specific reason why not to use it. It’s like “goto”; yeah it’s a questionable language feature, but just because it’s there doesn’t mean it’s going to teach you bad practices if you learn the language.

        Too many people read terrible javascript tutorials (w3schools, I’m looking at you), and then decide that the language is bad, without really understanding it.

  15. Paul Spooner says:

    Quasi-technical Medium-form questions:
    “How does procedural game-play differ from procedural content creation?”

    “What piece of present-day technology would you send back to your grade-school self? What would your grade-school self pick if it was his choice?”

    “Are there any jobs in game development that can’t/shouldn’t be augmented with procedural techniques?”

    “Shading is different from shaders? What madness lead us here?”

    On the topic of the article itself, here’s my own story of programming languages and game development.

  16. Sleeping Dragon says:

    When I saw the post title at first I thought it would be about language used to describe game development (in press releases, previews etc.).

    Anyway, not that it wasn’t a nice read but I think I prefer your technical posts when they relate to specific projects, like you often do on the blog (though I understand it’s not practical on the escapist). I’m tech clueless enough that it’s a bit like someone explaining a magic trick to me.

  17. Amstrad says:

    I’d like an article explaining just what the heck a shader is. I really don’t have any knowledge about the topic and a good basic overview of what they are, what they do and why they’re used would be great.

    1. psivamp says:

      The simple answer to “What the heck is a shader?” is that it’s a program that runs on the GPU. They’re written in a C-like language of their own (HLSL, GLSL or Cg are the ones I’ve heard of and what I’ve heard is that they’re all very similar to each other).

      Shaders take over the old fixed-function pipeline that transforms your polygons and points from model-space to world-space to view-space and takes that information and lights/textures/colors it and makes a displayable image. To that end, there are three kinds of shaders that get run in order on your scene: geometry, vertex and fragment. Geometry shaders can do things like tessellation (provided that you’re using a late enough version of the shader language and the hardware supports it) — which is really just a fancy way of saying that you make more vertices. Your vertex shader works on the vertices that come out of the geometry shader (if present — the geometry shader is optional I think) and can apply texture coordinates, bump-map coordinates, colors or lighting attributes to that vertex. The fragment shader runs for every pixel that is part of a polygon, by default, it interpolates the values from each of the vertices to get its values for all of its attributes. The output of the fragment shader is a color for that pixel.

      This is greatly simplified and probably wrong in several non-trivial ways, but it’s the general idea as I understand it and I’m sure we’ll get a nice thread fixing all of it.

  18. Tobias says:

    The current advice is indeed to start with a higher level language. But I think this singular focus is part of the reason we think that some people just can’t learn to program.

    When I was in college ( for electrical engineering) the main programming module had just become top down. That is Programming theory -> High language programming ( C++ because I am almost as old as Shamus).
    A lot of people just couldn’t wrap their heads around the idea of references loops and pointers and so on.

    But the bottom up approach to programming was still also a requirement. And I saw a lot of people fail their first attempts at the programming tests, and then acing them after completing the bottom up course.
    The bottom up module went analogue circuits -> digital circuits -> computing circuits -> assembler programming.

    My point is that while a lot of people say that learning a high concept language like Lisp or Haskel will make you a better programmer even if you never use it, the same is even more true for assembler and c.

  19. psivamp says:

    I actually like Java as a starting language. I didn’t start with it (it was my second language). It’s a “friendly” language — good compiler and run-time feedback. The syntax is C-derivative, which I feel is a good place to start. I’m also a proponent of the old-school order of teaching languages where you start with math and flow-control before you get into objects.

    I think C can be a good starting language as well provided you structure that introduction properly.

    My university offers two different introduction classes: a one-semester course in C for engineers and a two-semester course in Java for CS majors. The C course is in the order I mentioned above while the Java course is based on the premise that students are too impatient to learn in that order and so they start with helper libraries that they don’t shed until half-way through the second semester so they can start with drawing pictures with geometric primitives. In my opinion, the C class is a much better introduction. The Java students don’t learn flow-control until half-way through the first semester.

    I don’t know Python, but I’m going to be picking it up in the next week or so for a job. The lead programmer said that it should be a piece of cake since I’ve got several years of Java, C and some Visual Pascal.

  20. A couple of years ago, I decided to get back into programming. Being more comfortable on Windows, I chose C#. After a couple of months I had built a few basic apps, the most complex of which was Solitaire. Then I decided to port it to C++. And after a few months, I was still going nowhere.

    But I decided to stick with C++. Why? Because while I had more problems with things that didn’t just work off the shelf, or designs that required more thought to pull off, the truth is I learned a lot more. And not just about programming/design, but about the environment itself. One of my first challenges was building libssh2 (and its prereqs) from source on Windows. Today, I regularly build from source on both Windows and Linux (where I usually prefer to work with a local install of gcc, which means building gcc from source).

    As I’ve started reading about design in C++, it was the first time I even heard about “localization of reference” or “cache lines”. And how the humble vector could actually be a lot more valuable than I knew.

    As for the language itself, there are several features I like (especially since C++11), but if I had to choose one, I’d say “templates”. Not so much for meta-programming (although I admit it has its uses), but more for the generic programming side of it.

    I have worked in a lot of other languages (I’ll soon be starting on Ruby). But nothing has made me learn more than C++.

  21. Neko says:

    My advice? Don’t learn one language. Try several. Try IDEs, but don’t start with them – start with the humble text editor and compiler or interpreter of choice.

    If you learn one language, or one language with a particular IDE, then that’s what you’ve learned. Syntax and method names and which dialogs are accessed via which submenus.

    If you stick to the basics – editing files as text, compiling them or running them via their interpreter – then with each new language you try out, you’re learning the dao of programming. Esoteric syntax and method names are things you can look up when you need them. IDE menu options will change from version to version. Sometimes you won’t be able to use your favourite language. If you have enough languages under your belt, though, you’ll be able to adapt what you want to do to the tools at hand.

  22. Amarsir says:

    I think you could probably get a couple articles out of connecting the bigger pieces and helping people understand how writing code somehow connects to a finished game.

    For example, gamers often see (and use) the word “engine”. How many really understand what that is? What can and can’t it do? If multiple games are made on the same engine, will they be basically the same but with different graphics? If a programmer downloaded the Unreal 4 Engine, what would be the first thing they’d do to start turning that engine into a game?

    Those things might be interesting columns because people who know games but not code could still watch how the blocks connect, and those who know coding but not games could understand how writing a for loop leads to someone driving a tank.

  23. Vermander says:

    I’m one of those rare people who likes to play video games, but has no idea how they work. I know almost nothing about programming or code or whatever. I think it’s why I eventually stopped playing PC games, I feel like you need to understand how they work to get the most out of them, whereas when I buy a console game I can just throw it in my X-Box and assume it will run as intended.

    Obviously I know how to “use” a computer, I just don’t know much about how it works. I liken it to driving a car. I know how to operate a motor vehicle and I know that I need to do basic maintenance like getting the oil changed and the tires rotated, but I don’t really know how the various engine components work.

    Sometimes I find it frustrating that people expect all “geeks” to be tech savvy.

    1. Amstrad says:

      Depending on how long ago you last tried PC gaming I think you’d find modern PC gaming to be much more streamlined. These days systems like Steam handle all the installing and file management of games, and the vast majority of PC games auto-detect your system settings to give you a working configuration. Certainly there’s a lot you can still do to fine-tune those settings if you’re willing to dig around a little, but largely it’s unnecessary. About the worst time you’ll have is games that are buggy at launch as early adopters occasionally have to deal with solving the odd crashing issue. But with automatic updating that too is less of an issue.

      Heck, even modding has become easier now in games that support the Steam Workshop, just click a button and Steam handles the rest.

      1. postinternetsyndrome says:

        Fiddling with graphics settings is a learned skill that can be completely separate from actually knowing anything about computers, if you need it. Of course knowing WHY AA is so taxing and why this or that thingy doesn’t actually make a lot of visual difference in this or that particular game can help, but since it’s all sliders these days, it’s pretty trivial to realize that more Thing = less fps.

        All the actual computery stuff is mostly done by steam these days, as you say.

        1. postinternetsyndrome says:

          (Too late to edit.)

          …and I can’t imagine people liking games and not knowing how they work being “rare” by any stretch of the word. Rather the opposite.

  24. Exasperation says:

    On a somewhat related note, here’s an interesting letter about the choice of a first language to teach freshman CS majors, written by E.W. Dijkstra: letter from Dijkstra to U. Texas. Not exactly the same question, since the goals are different, but still worth reading.

    1. silver Harloe says:

      Huh, Haskell had a short life there, then. When I went to UT 88-92, Pascal was the Freshman language.

  25. postinternetsyndrome says:

    Well that’s a bummer. :P I’m finishing up my first year of computer science at university now and the program is all about C++. Their thinking is that we learn one language as fully as possible, from the ground up, which should make learning other ones pretty easy when we need them in the future.

    We shall see how that works out in practice but at least I’m having a lot of fun right now.

  26. urs says:

    With regard to @Alexander1st – because this is precisely what turns old me off from investing time in learning low/mid-level textual programming:

    Anyone here doing anything in Visual Programming? Can I make anyone envy when I describe the workflow from Nothing to a running Something like this:
    – doubleclick desktop icon (start environment)
    – doubleclick. type “Ren”. click on “Renderer”
    – done.

    Granted, this’ll produce nothing but a black window but it is a running application. I can now – in realtime – fill this blank canvas with beautifulbeautiful procedural graphics or skip the black window entirely and stream a round of Titanfall on Twitter (seeeseedddfsd1f serdsf ss1ssesdf 3 dd1) without ever having to add anything to the above list that is not the actual coding.

    Of course, I am totally aware of the shortcomings of this paradigm, but I would definitely include this in a list of advice for people who’d like to get into “making computers do stuff”

  27. RTBones says:

    In the end, the language (unless you are coding simply to code – but that is another story) is just a tool to get the job done. Just because you can code (in any programming language) doesn’t mean you’ll be a good game developer.

    The best way to start is not to pick one language, but try a few. Further – write code the “old fashioned” way – use a text editor, not an IDE. Its a lot easier to debug when you actually understand the code, and not just what the tool or suite spit back at you. Methods and coding methodology, data structures, algorithms, and understanding models are far more important than the actual language used. Don’t worry so much about the tool (in this case, the programming language) you are using and focus on the outcome (a quality game).

  28. kdansky says:

    The longer I write code (and the vast majority of it in C++), the less I think the speed-argument holds true. Sure, theoretically, C++ should be faster than Java. There are two use cases where this is true: Operating Systems and embedded software. Both are meant to interact directly with the hardware, and execute some other code on it, usually with very little user input. The disk driver doesn’t care about the human in front of the machine.

    But for every single other piece of software ever written, the critical factor for speed is not how well the code is compiled to assembly. The critical factor is how well its architecture is laid out. The reason for this is very simple, it goes something like this: Going from Java to C++ gives you a 5% improvement on every single thing you want to do. That does add up over time, sure, but in the end, it’s not more than about an order of magnitude. But if you mess up your architecture, you can easily blow 100 times more power on pointless code smell than you do actual work. No compiler optimisation will save you if you need to pass a message through fifteen layers to process a mouse click. I’m not making this up, I am currently maintaining such an application.

    And to solve that latter problem, hardware-languages like C++ are complete crap. They don’t come with module systems, they don’t have good type systems, they lack higher order abstractions, and all that other “slow” stuff that makes the software easier to write. If you have infinite development time and money, that doesn’t matter, but in reality, that limitation will always mean people cut corners, and those cut corners will hurt you a thousand times more in C++ than in C#.

    C++ is common because it is common. People learn it because the majority of studios use it, and the majority of studios use it because they can hire people because the people know it.

  29. Norman Ramsey says:

    Tech topics in 1500 words or less? Two words: procedural content!

Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun. Your email address will not be published. Required fields are marked*

You can enclose spoilers in <strike> tags like so:
<strike>Darth Vader is Luke's father!</strike>

You can make things italics like this:
Can you imagine having Darth Vader as your <i>father</i>?

You can make things bold like this:
I'm <b>very</b> glad Darth Vader isn't my father.

You can make links like this:
I'm reading about <a href="http://en.wikipedia.org/wiki/Darth_Vader">Darth Vader</a> on Wikipedia!

You can quote someone like this:
Darth Vader said <blockquote>Luke, I am your father.</blockquote>

Leave a Reply to Hugues Ross Cancel reply

Your email address will not be published.