Saturday May 1, 2010

Processing

Another retrospective post, but I'm glad to say I actually have a home, space, a desk, computer, internet, my belongings... yay! So I'll be more current again. I considered that I'd like to have edited the last post because there was a lot of venting, but this blog is usually part of the submission of projects so I can't really change it after a hand in deadline, so it's fixed. Plus I looked back and it wasn't quite as bad as I remember it. Everything went wrong, and more time or better management of what time I did have was not the answer, it was resources. It was like being used to working in Photoshop in OSX with a 30" monitor then suddenly having to do the same work on a 13" 800x600 display on a Pentium 2 running windows 95. Or something. Anyway...

The Introduction to Creative Technologies lecture was cancelled on the submission day, so once Project 2 was submitted I went home. Well, to a friends apartment for a few hours while I waited for my ride back to out of town, but small details.

The rest of the week our 3rd paper for the semester started, and it was to be a full-time 2 weeks (not sure what happens after that). Programming for Creativity, we were introduced to an open source language called Processing, skewed heavily towards visual communication and a good introduction for visually-oriented people who have never programmed before. Each day we were introduced to elements of the language and expected to complete exercises. I think the pace was probably a little bit too fast as a few people struggled to keep up, I've mucked around with a few high-level languages in my time (and dabbled with some low-level ones too) so I wasn't one of them fortunately for me, but the pace was too fast for me to take time from what I was doing to help anyone else struggling, I was still learning the language like everyone else after all.

We started off with learning comments, which is code that does nothing. It's a way of putting your own words into a program so that you or anyone else reading the code can understand what it's actually doing at any one point. You see, computer programs, even to experienced programmers are fairly cryptic to look at, you generally can't just read it and understand what's going to happen, you have to sit down and concentrate and follow it and even then it may not be completely clear. This is because code is usually full of things like coordinates and variables which are essentially place holders for numbers or other values (such as true and false and text). Variables usually change over the course of a program due to equations and conditions (or both). A condition by the way is a test to see if something has taken place such as "if the user clicks the mouse button then do this, otherwise do this". Without boring you to much (it's not actually boring if you can see results but it does make dry reading in a blog) building blocks of pretty much any computer language are as follows: Comments - ignored by the program, it's to help the programmer or some poor soul who has to read someone else's code keep on task. Also useful to be able to "comment out" sections of real code to see what it does and how the program runs without it (if it does). Variables, the place holders for information within a program. You don't refer to the actual information because a) you may not know it yet b) it might change through out the program and c) you might want to reuse that information multiple times. Conditions, used to test if an event has occurred or if a variable has reached a certain value. It's a way of making decisions. Otherwise computer programmes would do one thing and never change. How for example could  you have Photoshop if Photoshop can't test that you have selected a tool. Loops which contain code that is to be run over and over again or perhaps a certain number of times, perhaps when a condition of a variable is met for example... Functions are sub programs that perform a specific task and can be called upon again and again. In Processing - and lots of other high level graphic languages there also are specific instructions for drawing, such as ellipse, line, rect (for rectangle) point and many others. What is quite interesting to me is how closely it seems to follow Postscript. Postscript is a graphical language and the first technology that made Adobe rich (makers of Photoshop, Illustrator, Acrobat to name a few). It's also the language that made the Apple Macintosh useful in one industry in particular, democratised publishing, gave rise to the term Desktop Publishing and and entire industry redundant in a few short years. Postscript describes pages and what they look like, and if you are familiar with Illustrator, you might not realise but you sort of draw postscript programs in Illustrator. What made Postscript popular is that it's easily generated by machines and also easily read by postscript printers such as the original Apple Laserwriter. And thereafter every piece of computer equipment associated with churning out Offset printing plates. Anyway, In Processing you can set the attributes stroke and fill of objects that you are about to draw much like Postscript. Or Illustrator. You can also rotate, scale and transform the canvas that you are about to draw on so every object drawn will follow those coordinates. Which is exactly like Postscript. Which makes sense for a number of reasons, not least of which that if it's written for visually-oriented people, and lots of visually oriented people are probably quite familiar with the concepts in illustrator, then they'll pick this up fairly quickly.

So our exercises became slowly more complicated incorporating more of what we learnt.

Day 1 (Tuesday) was mostly to make shapes on the screen, and find ways of condensing complex code to simpler code using loops, Day 2 was a bit of an oddball. To replicate real life artworks on the screen using computational methods (programming them). Obviously not attempting to recreate the Mona Lisa with pixel perfect accuracy, but to make a connection between one's program and the artwork - it had to be recognisable as an attempt at a well-known picture. I got a bit bogged down that day helping people completely lost.

Day 3 to make colour transitions and move shapes around the screen - not by plotting every single movement or colour, but using loops and variables to do the work for us. We had Friday, the weekend and Monday to complete homework which was to combine all we had learnt to make a shooting gallery type of game. Unfortunately this was also the weekend of the big move to a real home again and not only did I have to move my belongings, but also help family move theirs. Yes family. Odd thing, 2 siblings have been in the market for a new place too, one moved back to Auckland after work relocation and another had a flat breaking up. Er, anyway, this very annoyingly took all of my weekend, then what I was fearing mid-last-week happened, and I got rather sick with some odd cold/cough combo. Result is that I didn't make it in for most of the following week. But I've been reading a prescribed text and I think managed to keep up. I missed out on learning some maths functions, sine/cosine and applying that to movement, matrices, which has always intrigued me from a young age because I believe they have something to do with converting 3D space into 2D coordinates. But I doubt it was covered in that much detail so I can learn that kind of thing on my own.

The big presentation on the Friday was a game, either Pong or Tron, I was starting to feel a bit more alive on Thursday night so I made Pong and decided to go on Friday. I think it turned out okay. Pong is a 2-player game and I think we were just expected to make it controllable by 2 people. My version is a single player game and you play the computer. It has some basic AI and the computer is a decent opponent, and it does on occasion try to send the ball to the opposite side of the court from where you are. But you can beat it, and when you do it isn't just because it's decided to let you beat it - it can actually miss. Once the presentation was over I went back home, still feeling quite sick. We have 2 weeks to present all of our work from the last 2 weeks on a CD.  That should be more than enough time for me to finish reading the texts that we have been given and build the programs that I missed out on during the second week. Then again I don't know what's in store for us next week.