Above is the results of several weeks of work. It has one fatal flaw, however. Allow me to explain.
I am a gamer. I play video games, board games, role-playing games, and some sports. My taste in games is very eclectic, but also somewhat mercurial. I will love a game–obsess even–for a week or two, and then move on to something else. I have always had a problem with attention span when it comes to games. I do not believe this is a character defect. There are simply some absolutely brilliant games that have managed to suck me in for more than 40-60 hours (the flexible benchmark in my mind for a brilliant game), and some that don’t.
The upshot of this is that I have played many, many games. My Steam library is only about three years old, and yet it’s about 130 games long (some of which I’ve never played, of course). Through it all, there has always been this little thing in the back of my mind. This notion that if I had been working on this game, I might have considered doing something differently. I do not have the slightest notion how difficult it is to make a game. I can only understand intellectually, by watching the credits roll by at the end of a game, how many people and how much time is involved. I understand that a big budget game takes many people many, many, many person-hours over several years to complete. But I don’t actually understand this any more than I understand that the sun is 98 million miles away.
And so, it is with a sort of naive enthusiasm and confidence that I embark on a new personal project. I have been calling it my “self-education project” with my wife and friends. For the past month, I have been reading, in true obsessive fashion, everything I can find on Java programming (more on my choice of Java in a moment). I have been reading articles on game design, AI, terrain generation, pathfinding, data structures, isometric perspectives, sprites, and more. I’ve written stupid little programs in Java and OpenGL. A blackjack game, a little-ship-that-shoots-at-aliens game, and a few others.
Let me back up. I quit my job last spring. I was teaching at a community college in rural North Dakota. Both my wife and I did. The reason for this is convoluted. The job was fun and rewarding. But the pay was pretty abysmal and we had few friends there and no family. Not to mention, there is nothing to do out there. In the end, the reason we took the chance and quit was simply the fact that the thought of staying for another year (after two years already) was a deeply depressing thought. So we quit.
And we didn’t manage to find brilliant replacement jobs before our summertime paychecks ran out.
This means that I’m back to substitute teaching and my wife (who is far more aggressive than I at job searching) is back to bartending. This is fine for now. However, I need something to work on. And one day, two months ago maybe, I was reading a book in a hammock (this was my indolent summer after quitting a teaching job which pro-rated paychecks throughout the summer–yay!), I got an idea. It was nebulous then, and it continues to be nebulous, but it is an idea.
I haven’t been able to write fiction all summer. There has just been a part of me that refused to do it. This is purely my own lack of self-control, but it is also the fact that I simply do not have a good idea to run with (excuses, excuses). I now have an idea that I want to run with. However, I do not know much about computer programming (or at least I didn’t). I took a few computer science classes in college and learned some basic C++ and even a little Lisp, but that’s it. I knew some syntax, but I did not know “how to program.”
And so I got it in my head that I wanted to do a feasibility study. I wanted to discover just how difficult it would be for an expert-level user (someone who understands at an intuitive level the current conventions about how to use a computer, and currently operates his own, self-constructed Windows box) with almost no real knowledge of actual computer programming to make a video game of real quality. How long would such a project take? What language should I learn? What books/articles should I read? Will I, as I often do, get bored and give up?
So that’s the experiment, and so far so good. It has been two months, give or take, and from here on out, I will make an attempt to regularly post about it here on the Spin.
And so I’ll share a few of my thoughts here. First: Java.
I chose Java because it’s portable. There is some concern that it’s not as fast a language as it could be. This is true. The JRE, from what I understand, makes it a very high level language. Not as high as, say, a scripting language, but certainly not as close to the machine as C++. But machines are faster and stronger these days. Some very sophisticated software is programmed in Java, especially in gaming. Minecraft, for instance, is programmed in Java using the Lightweight Java Games Library (LWJGL), an OpenGL interface for graphics acceleration. I’m not looking to make Minecraft or even come close to its success (Marcus Persson was a professional programmer before he made Minecraft), but I’m interested in using some of the same technology. Knowing how robust and tight Minecraft is, gives me hope that a simple 2D isolinear game will also run well using the same language.
So I started reading a text on Java. This one, to be exact. And it’s…just truly marvelous. And I had some great success with it. I did get impatient before finishing the text (c’est la vie), but I got through the essential stuff. I have a good idea of how to navigate the Java API, I understand variables and pointers, I have a working understanding of how Java handles exceptions, I think I know enough about data structures, recursion, searching, sorting, and all that other good stuff, that I just started looking up some stuff that would be useful for my project.
I’m starting with something really hard. Perlin noise. I want to make a heightmap so I can generate the terrain of an alien world so that everyone who plays the game will play on a different world. This has been a nightmare. I’ve read many articles about Perlin noise and I’ve read lots of forum posts by people who are doing or have done exactly what I am trying to do. People who are all like, “I be learning how 2 program for 2 weeks now, and I ned a good tut on perlin noise.” And that was me, too. I wanted a good tut. I needed it. In my brain. But there isn’t one. At least, not one for someone with my incomplete knowledge base.
Oh sure, there’s a lot of truly great literature. This is something I have struggled with all my career when it comes to mathematics. I was able to construct a pretty solid intuitive understanding of how the math works, but there was a barrier between that intuitive understanding of what it was and how to actually…just…do maths. Same here. I get how Perlin noise works, I just don’t understand how to implement it in java and just make it fucking happen on my monitor.
What I ended up doing was reading every article I could and realizing that, as a math enthusiast, but not a math expert, I was never going to completely understand the algorithms involved in generating any kind of coherent noise. But I persevered. I looked for algorithms Read some pseudocode, found it very difficult to translate to Java, gave up, looked for something else, finally found complete source code in C# for a Perlin noise algorithm with lots of options. This was last night. I stayed up way too late. I am so tired today at work. But I am satisfied that I have finally found it. I generated my first, very rough heightmap last night. And boy…did it feel good. I even managed to write some of the code myself.
And so, the image at the top of the post is the first output that my algorithm pumped out. But what in the hell is up with that slash through it? I have no idea what in the code caused it and I can see the next few weeks will be spent trying to figure out how to get rid of it. Wish me luck.