rjberry has asked for the wisdom of the Perl Monks concerning the following question:

Hey!

I've been programming Perl for quite a bit and have a solid knowledge of the language. Recently I've had an itching to program some simple 2d games (think SNES-kinda era) and I was wondering whether Perl's a suitable language?

Would speed be an issue for a 2d game engine? If not, is SDK the best library to use? Only it doesn't seem to have much documentation up.

If there are lots of advantages to using C++ I might finally learn it, though it seems like a somewhat daunting task on top of working out how to use a graphics library. Thanks!

Replies are listed 'Best First'.
Re: 2d graphics in Perl
by marto (Cardinal) on Dec 07, 2009 at 13:01 UTC

    I think Frozen Bubble is written in Perl with SDL, you could check this out and decide if it meets your requirements speed wise etc. I've don't know of a library named 'SDK'.

    Martin

      Ah thanks, I'll check it out! Sorry - I meant SDL.

Re: 2d graphics in Perl
by zentara (Cardinal) on Dec 07, 2009 at 16:14 UTC
    .... the advantage of SDL is it is fast writing to the screen.... but there is alot of overhead you need to do, to keep your visual objects persistent

    ... the canvas type widget, gives you persistence of objects..... and that makes programming easier, because you move your widgets around as entities, not just screen shapes

    .... the other thing to consider is rotations, zooming, and semi-tranparencies

    ..... in Tk, you need to write your own rotations and zooms....no transparencies....there are examples previously posted....google for them

    ..... the Gnome2::Canvas is stable, but being deprecated , because it is not a full member of the GLib object system for Gtk2

    .... the Gtk2 Goo::Canvas looks very promising, but is still in sort of beta development, and is missing many easy to use features

    ..... that leaves Tk::Zinc , as the best canvas alternative..... it runs on linux and windows..... and it handles groups, rotations, zooms etc very well....see zinc website

    a small tutorial is at small illustrated intro to Zinc

    ...and the best example of gaming in Zinc is at Strangely addictive Tk::Zinc based game

    .... the best way to get an idea of Zinc, is to run it's demo


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku
Re: 2d graphics in Perl
by igoryonya (Pilgrim) on Dec 09, 2009 at 15:55 UTC
    I don't know about SDL. I mean, I know about it, but I've never tried it. I installed it once a while ago, but never got to do something with it, because something didn't work for me and I gave up, then I've found an OpenGL library. I am not sure if this is what you want, but you can use OpenGL to draw 2D graphics too.

    I am using an OpenGL library from:
    http://graphcomp.com/opengl

    And the coolest thing about it is that I am using a regular OpenGL C++ book to learn it. I am just substituting C++ specifics for perl equivalent commands.
    The book, that I am using is OpenGL SuperBible :).
    I don't see any speed difference in comparison to C++, even some examples are a few frames per second quicker, then C++.