Game Programming is Too Hard! Puck Fighter is a little game where you move balls around, they crash into each other, and you swing ropes around. And it’s like 1,200 lines of code!
What does Perl say again? “The Easy things should be Easy, and the Hard things should be Possible.” This thing is Easy as all hell, and it’s as Hard as Possible! Perhaps my Programming Purpose in life is to make game programming easy. This entry shall serve as an initial brainstorm for how to do just that.
What’s hard about game programming?
First off, there’s too much setup involved. I wanted to try a little physics experiment tonight, but then I just stopped because it’s too much of a pain to write the code getting the OpenGL window up and the timing set up.
Namaste and I were talking about getting the sticky thing on the end of the rope to move freely around a body (get your mind out of the gutter! :-), rather than sticking to one place. This turned out to be much harder than you’d think. An idea came up to attach a thin layer around the puck that would rotate freely. The rope would then attach to this. Implementing this caused endless complications.
What’s easy about text processing?
Perl has text processing down to a sci– down to an art. It’s not just easy to parse stuff with Perl, it’s even fun to write. Not like the grudging detail-work of game programming at all.
So what makes it fun? I’m pretty sure it’s not just Perl; I can envisage writing a game in Perl (I might one of these days), and it would sure be nicer than writing in C++, but it wouldn’t be like writing a parser. Well, here’s one thing that makes it fun: CPAN! I use Parse::RecDescent to do my parsing. That’s working at the domain level: working with the context-free grammar directly. And making a simple change is as simple as the change itself.
Perl has built-in support for regular expressions. Want to match a pattern? Just type /some.*pattern/ or whatever. That’s also what makes it fun for text processing.
So How can we make Game Programming Fun like Perl?
Flash does a pretty good job. If only ActionScript didn’t suck so bad, and if Flash weren’t so buggy, and if Flash weren’t so slow…. In Flash you work closer to domain-level concepts, like buttons, movie clips, images. All self contained and designed with the language, unlike C++ which was designed for everything, which means it wasn’t designed for anything.
So is it possible to make a C++ game toolkit to make this fun? I don’t think so. I just don’t think C++ has that kind of flexibility. I think we need a new language. Whether that manifests itself as a new programming language or as a sophistocated Perl module, it’s a new way of thinking about game programming. And I don’t think it can easily be a Perl module, because I want an integrated graphical designer, or something. Something to help you visualize all the visual interactions your game is modeling.
More research, more thought, and more experience is in order here. I am very open to any input anyone has on the subject. I’m getting excited about it though, which is a good thing.