Processing for Learning Programming

Jul 11, 2012

I recently had a friend reach out to me based on another entry from this month, the Pixel Art entry. He said it helped push him over the line from it being something he thought about, to something that he’s finally getting started doing something with. And I’m not even in sure in this case that it was the technical information in the entry so much as simply hearing it, and having someone remind you that you have access to everything that you need to do this. Someone pointing out a few basic ways to not shoot yourself in the foot, now go have fun, may be enough.

I think sometimes we forget that in 2012 the resources available to us are absolutely enormous. If it was 50 years ago, and there was something you wanted to learn about, you would have to travel out somewhere, you would have to find a book, you would have no way of finding out what other people thought of the book, whether it was worthwhile or a waste of time. But now, with a lot of these skills, a lot of this material, it is literally all over the web. Especially for technical things. If what’re trying to learn is a programming skill or a computer software skill those are the same people who are crawling the web desperately spelling out everything that they know, recording video tutorials and screencasts, offering insight, responding to questions. So I started thinking recently: maybe the limiting factor here isn’t a lack of, oh no one has written a good tutorial on that yet (though that’s probably still the case in a few blind spots for us), so much as, no one is really taking the time to articulate “Here is why this is a path worth taking. Here are the benefits that will be afforded to you if you’ll pick this programming language to start with, or if you’ll just get started down this road of learning this technology, that it’s really not as hard as it might sound, and it’s within your capabilities.”

Certainly if there are other things that you’re taking on we can compare them to it, and say, this is actually less challenging than that, you just haven’t tried it yet. You’ve got this idea that it’s something you can’t do. Really you’re probably a few evenings of tinkering from being pretty proficient at doing the basics with it, and in a matter of weeks or months from being able to do much of what anybody else can do.

There’s two subjects, I’m dividing these up between these two entries. For the Special Topics entry–which I’ve always left kind of vague whether it’s Beginner, Intermediate, or Advanced, the whole idea right is that it’s sort of a miscellaneous–I want to focus on Processing as a way to get people into programming who are totally alien to programming, who have never started it in any sort of language. Then for the Advanced entry, I’ll be discussing the basics of web development, in particular the benefits of PHP, CSS, and MySQL – what these technologies are, what they do for us, and why as videogame developers (even hobbyists) we should care. What do they let us do that we can’t do without them? How are they unlike other technologies that we know?

If you’re totally new to programming, here’s why I’m going to recommend Processing as a starting point. You’ll hear some counterarguments to this, either that Processing isn’t as low-level as some other languages, so that C might be a better place to start. And I will say that if your long-term goal is to be a commercially hired programmer, C is probably a good point to start as well, for different reasons. The benefit with Processing is that out of the whole family of programming languages out there, a lot of them are structured differently from one another, different advantages, and different quirks that you kind of have to fight your way around to make them work. Processing is designed in a way that minimizes the language-specific quirks that you have to fight around.

If I had to list a bunch of the common programming languages that are out there in use in commercial game development and in hobby development, then we’re looking at C and C++, ActionScript 3, Objectie-C for iPhones, HTML5 and JavaScript, Java, PHP… all of these languages have a lot of things in common in terms of how they’re structured, in terms of the ways that you can control the flow of code, in terms of the ways you think about problems to be successful in them. Now, each of those languages also comes with strengths in terms of its method of deployment, or in terms of its tradeoffs in speed and time it takes to develop, processor efficiency of the result, but if we’re just getting started out we can lay those things aside. With something like Processing allows you to focus on is if-conditionals, while- and for-loops, variable creation… no matter which of these other languages you might want to span out to to solve your specific platform interests and needs, you’ll be prepared in such a way that you can go from writing Processing code to writing code in any of these other languages pretty quickly through the adoption of say a graphics library, adding a little bit of code at the start to set up a timer, and learning a little bit of semantic switches, in terms of where you rearrange some words or replace one word with another to achieve the exact same things that you would then know how to do in Processing.

I’ve had classmates that learned Processing, for school, and then felt disheartened when they realized that there is no job application out there–at least that I’m familiar with–that will ever ask you for X number of years of Processing. There are no commercial applications or games you have downloaded, played, or probably watched which were developed in Processing. But the catch is to not think of Processing as the end point to learning programming, but as your starting point, as a springboard into ActionScript 3, C and C++, HTML5 with JavaScript, whichever direction you want to go with these things Processing provides a firm foundation.

Processing was designed at MIT, it’s website is processing.org, where you can download the development environment. It works fine in Mac, and in Windows, and I assume in Linux (though I can’t say I’ve tried it).

One of the common barriers for programmers is the problem of imports and includes. What that is, is that a programming language actually has very few core functions built into it in terms of what it can do and how it does it. There’s a few keywords, maybe a couple of dozen words which are special to the programming language, and otherwise for doing nearly anything like drawing graphics to the screen, loading sound files, even displaying text (especially with fonts) you would need to figure out which of the available libraries, that in some cases come with the code, you need to specifically import in order to say have access to drawing on the screen, or to loading certain image formats, or to performing network operations.

Processing assumes many of the most common ones for you. This way you don’t have to wonder when your code doesn’t work whether it’s because you forgot to import the right library or include the right functionality, or if it’s the code you wrote. It can narrow it down the code you wrote. Meanwhile you still need your semicolons in the right places, you still need to manage your scope, you’ll still be fighting with compiler errors.

Something I want to point out that I think Processing is good for getting people to think about is that compilation errors are a part of programming. They’re not a sign that you’re doing something wrong, they’re not a sign that you’re bad at it. Very experienced programmers, myself and my peers, still get compiler errors from the work that we’re doing. When I was working on some php this morning for some professors, there’s no compiler in the php process, but still maybe one in three times when I would refresh to check changes I was making I would be staring at a blank website, which was my sign that I made an error.

Processing also abstracts away the compilation process. Typically when you write code, you type out the characters on your keyboard to spell out the way you want the logic to proceed, the way you want memory to be used, and so on. In Processing instead of having to separately add a step to go from that typed code to a separate program and then running that program externally, there is just a play button which in one fell swoop translates the text you’ve written into code that’s ready to run and runs it.

I hope I’ve made a decent and somewhat concise case for getting started on programming with Processing if you’re totally new to programming. I will be providing some clearer examples to start from in the weeks ahead specifically in Processing. They’ll actually be based on the old Volume 5 entry, in which I discuss ideas like white space, for loops, imports, if conditionals, while loops, and so on, these very common structures like arrays, objects/classes. I’ll be presenting those in a context of Processing in a way that resembles core videogame-like functionality simply as a way to ground what we’re doing.

Download Processing, install it, muck around with it, you might surprise yourself with how far you’re able to get just fooling around with some example code and browsing the resources at processing.org.



Learn and practice team game development with Gamkedo Club.
Membership worldwide. Professional support. Proven process.




Subscribe by e-mail to receive weekly updates with Gamkedo.Community interviews and YouTube training videos for game developers!



4 Comments

  1. Hi Chris!

    I’ve been enjoying “Podcast Style,” especially with your transcriptions because sometimes I prefer to read your posts on my mobile device, and sometimes I like to listen to your voice while at work. I LOVE this site, because so much of your writing goes beyond game design and development and hits on important aspects of all team-based collaborative artistry.

    I learned about Processing a few years ago, downloaded it, forgot about it, updated it, worked through O’Rielly’s Intro to Processing, got excited, then my self-education came to a screeching halt. I really enjoy Processing, even though I had no idea about half the things you mention that it does for me.

    What ground everything to a stop was that I couldn’t find the next step. I read through a whole book and understood about 50% of it, but enough that I could look at much of the code and have an idea of what it was saying. But then I couldn’t find any tutorials or guides that helped me practice with my knowledge or took me to the next step.

    Needless to say, I am looking forward to your posts on Processing, though I would also be interested to hear what you think the next step- Processing or not- would be? Or if you have any other recommendations to bridge beginner’s knowledge with advanced applications. Those are the easiest things to find on Processing, less so the practice, intermediate stuff.

    Thanks!

    • Chris DeLeon says:

      Thank you for the kind remarks!

      Since you’re already familiar with the Processing basics, two HGD entries from 2010 with game(-ish) Processing source you may want to browse through, modify, or build upon are Platformer Game Source in Processing or The Making of A-10 Thunderbolt 2. In the upcoming Processing posts I’ll try to put together some more granular tutorials to help build a bridge toward those types of projects, though after at least briefly covering some of the basics that it sounds like you’re already familiar with.

      If you would be interested in experimenting with the jump to ActionScript 3 to make web games, especially if you find that browsing the above Processing examples makes sense and you feel prepared to move on toward a language that’s easier to distribute the output from, the collected entries on ActionScript 3 (compiles to Flash swf) might be handy.

      Good luck! If you come up with specific questions, do let me know, as odds are good that others are running into them too.

      • Oh cool! Thanks for the quick response, Chris.

        That’s exactly the kind of stuff I was looking for (facepalm), sorry for not digging deeper.

        These articles look very helpful, and I’m adding the pages to my little notepad of programming education links. I look forward to digging into this stuff this weekend!

  2. […] Processing for Learning Programming – Why Processing is a good place to start when beginning to explore […]

Leave a comment

Comments Form
  • Your email will not be used for any purpose other than to update you in replies to your comments. Your website address will be shown as a link from your name with your comment. Your profile photo is auto-magically provided by Gravatar.

All contents Copyright ©2017 Chris DeLeon.

Site production by Ryan Burrell.