Tag Archives: perl

Ideas and Responsibilities

It’s been a while. Here’s an update.

BIMONSCIFICON

I just got back from a week long trip to Portland, OR, at the O’Reilly Open Source Convention (OSCON). It was quite a lot of fun; I met some interesting people and some very interesting people. I did my presentation, then went on to sign up and flake out of a poker game, and had dinner with some famous people.

First off, my presentation went over really well. Everybody laughed at both of my jokes, and I got exactly enough questions to fill up the extra ten minutes at the end. I had someone come up afterward and say it was “the most entertaining session at this conference that wasn’t done by Damian Conway.” Knowing Damian, this is indeed quite a compliment.

After that, I had signed up for a poker game that Thursday. I was waiting for some fresh meat, and I also wanted to find out if I’m actually good, or if I’ve just mastered my local group and will die in foreign circumstances. But I didn’t end up playing, because that same night I got an offer to go out to dinner with the Perl 6 crew: Larry Wall, Damian Conway, etc. Sorry, I like Poker, but not enough to turn down dinner with them. It was fun explaining why I couldn’t play to the poker folks, too :-).

During the weekend, I attended the Perl 6 design meetings which were by far the best part of the trip. All the people on the design team are wicked smart, and it was a great honor conversing with them and determining the fate of the next Perl. Patrick, the Perl 6 pumpking, and I are to design the regular expression engine for Perl 6. This is an interesting turn of fates, as I’ve been pummelling perl6-internals with ignored design revisions ever since the introduction of rx.ops. Now I get to call the shots :-).

Finally, on Monday I went with Larry and Gloria Wall to the Japanese garden and the Rose garden. That was fun, and Larry had plenty of interesting Japanese cultural and language tidbits (he’s studying Japanese).

IPC

IPC had the first meeting in likely two months tonight. I’ve basically lost interest in the project, but I’m sticking around on account of being the chief architect of the project. It would be rude (and socially stupid) to abandon the project after setting up such a complex game engine, leaving them with only half an idea what they’re doing. I’m adopting the strategy of letting them do the programming, and being there for design advice and explanations of the patterns I used. I want this project to go somewhere, because my team does, but I’m not terribly interested in where it’s going anymore.

Glop and the Fighting Game

As those of you who followed the development of Glop may know, it was all inspired by an idea for a fighting game. I haven’t written about this connection before, but this is how it happened. I wanted to write a fighting game that required mastery: that required thinking, planning, and observing to play well. I sat down to write it, noticed what a damn pain it was to set up a game engine, and then started Glop to make it easier (the fact that it’s been much harder to write Glop than that simple engine was expected; I balanced the trade-offs and figured I’d praise myself the next time I got a cool idea).

Tonight I had a revelation about that game (which I haven’t started yet). We were playing Soul Calibur II, perhaps the best fighting game ever created. It had all these elements, but it wasn’t what I was looking for. You could whack somebody in the head with your sword, and they’d lose 5% of their life. I want to whack someone in the head with a sword and have them die—immediately. Like Bushido Blade. But a game like Bushido Blade or Soul Calibur would end up with twenty rounds lasting five minutes with that kind of scale—also not what I want.

So I thought: what if the game was in slow motion? That’s precisely what I want. It allows enough time to see what the opponent is doing and come up with a brilliant counter attack. The game won’t be a button-masher like so many fighting games are. The game will be as if in a turn based game (but you’d have to think much more quickly). Two experienced players may battle it out for thirty hits, and the winner will be the one who finds a way to block the opponent’s attack, incapacitate his weapon and his defences, and get the blow in. The knockout move. One mistake against a master and you’re dead instantly. That’s what I want. I don’t know whether it’s a selling idea, because of the learning curve, but it’s the game I want. And that’s the game that I’m going to make.

Class::Closure

I’ve released the first segment of Glop to the CPAN, and it’s called Class::Closure. It’s not directly related to games, but it is in a yak-shaving sort of way. Perl’s class syntax sucks, most Perl programmers agree on that. Both creating a basic class and referring to its members is a pain. So I wrote Class::Closure, which fixes that without using a source filter (if you want it with an ugly source filter, see my Perl6::Classes).

But another thing that games require more than anything else is speed. So I did some benchmarks on Class::Closure, and found that its dispatch was about 4 times slower than the generic object model. Acceptable, but not optimal. I did a few caching tests, and one of them proved promising. If I cached the methods in the class’s symbol table, it turned out to be faster than the traditional object model. So I switched over the whole module to create a new symbol table for each object instead of storing it in a hash, and it’s about twice as fast as the traditional model. As an added bonus, it cleaned up the inheritance scheme somewhat.

Auf Wiedersehen, C(?:\+\+)?

I just got SDL_perl working. And you know what that means… C++: so long and good riddance. I shall now be doing my graphical programming in Perl.

I will, of course, still need to tolerate that vile language until the completion of Glop. After that, it will be used as a kind of “assembly”, which I’ll use to streamline the computationally intensive portions of my games when they start suffering, and for that purpose I don’t mind it one bit.

SDL_perl was a pain in the ass to get working on both Mac and Windows. For Mac, I ended up getting the full blown SDL+Perl framework distribution, which still didn’t compile. I had to fish through the source and change all occurances of #include <sdl.h> to #include <SDL/sdl.h>, and likewise with OpenGL. A semi-pain.

On Windows, I learned how to use ppm which comes with the ActiveState distro (my, how that works better than perl -MCPAN -eshell), and then hunted for a working SDL_Perl and OpenGL ppm. Worse yet, SDL::OpenGL doesn’t seem to work; I have to use the older and dirtier OpenGL.pm. And even worse, it doesn’t even break, it just decides not to export (or contain for that matter) any functions. What a pain.

One of Glop’s goals is to make it dead simple to install. I now see how ambitious a goal that is.

Oh, yes, and I’d love to have provided links to all these things, since they were kind of hard to find, but Comcrap’s DNS seems to be broken for the moment. I’ll scan through and fill them in when it comes back.

OSCON Presentations

I just submitted my OSCON presentation proposals. For the ignorant, OSCON is the O’Reilly Open Source Conference, where the big Perl conference is held. It costs upwards of $1000 to get in, and I have thus never been before. But! if you do a talk, they waive your entrance fee. I’ll be submitting these talks to YAPC (Yet Another Perl Conference) once the submission form comes up, though the $80 entrance fee isn’t much to be waived (go YAPC!).

The first one is entitled “A Language For Games,” and in it I will be presenting GLIC (which is coming along nicely, by the way). I’ll write some simple “game scripts,” probably Sokoban or Pac-Man, to introduce people to the language. Then I’ll discuss the more advanced concepts. That’ll be cool, though I’m not sure if it will be accepted.

The other I’m quite sure will be accepted. It’s called “Compiler Writing with Perl,” and in it I discuss all the modules, machinery, etc. necessary to write a compiler with Perl. And I’ll be talking about Parrot as a target language, so I get to present something related to Perl 6, which the community should enjoy.

In related news, Synopsis 3 is almost done, and should be going on perl.com soon. My first published Perl 6 document!