2010Q3 Grant Proposal: Manual for Game Development with SDL Perl


Manual for Game Development with SDL Perl


Kartik Thakore


[hidden email]

Amount Requested:



This project will improve the Game Development tutorials for Perl using the SDL library. The primary goal is to introduce newcomers to Game Development in Perl. The secondary goal is to attract people to try Perl as a Game Scripting and Prototyping language.

2>The Background of SDL Perl

SDL stands for Simple DirectMedia Library, and provides cross-platform access to various multimedia devices. These include audio, keyboard, mouse, joystick, 2D video framebuffer and 3D hardware via OpenGL. The main application of SDL is to create games that are cross-platform.

SDL Perl was created by David J. Goehrig, prior 2004. Since then many people have worked on it, including chromatic. However, since 2004, the project's core team unfortunately disappeared. The reason for this had been mainly the overwhelming amount of work required for the slightest of change or bugfix, the way it was initially designed. Updating the module and making it work on different systems was becoming unfeasible, and eventually the maintainers decided to pursue other interests, leaving this amazing project in a stall.

In order to revitalize the project and eliminate such shortcomings, a complete overhaul was necessary. Standing on the shoulders of giants, I started to tackle minor bug fixes. Before long I contact David and worked with him to make the first release in 5 years[1]. Eventually I was made the new maintainer and was releasing regularly in the old API[2].

After much deliberation and discussions with chromatic, Leon Brocard (acme) and several others, it became evident that a complete overhaul was necessary to eliminate all shortcomings and fully revitalize the project. I decided to rewrite SDL Perl into a layered approach. The first layer which has been mostly completed is a 1:1 match with the C API. We have also added a better building system with the Alien::SDL pipeline. Additionally we have added more tests and cross platform support. Finally, we began work on a second layer of extensions - SDLx - that provides a much needed sugar coating over the raw API, removing any drudge and error-prone constructions and making game development a much easier and fun experience with Perl.

Most recently we have been working on make SDL more cross-platform and stable. In SDL 2.4.x we worked on getting the SDL dependencies install correctly and the MacOSX launcher working correctly. The classic game, Frozen-Bubble has also been ported to CPAN to act as a flagship game [3]. With the new cross-platform support SDL 2.5 and Frozen-Bubble will be packaged with Strawberry Pro. This will drive new interest in SDL Perl, and thus we will need a manual for new users.

[1] http://search.cpan.org/~dgoehrig/SDL_Perl-2.2.0/

[2] http://search.cpan.org/~kthakore/SDL_Perl-v2.2.6/

[3] http://search.cpan.org/~kthakore/Games-FrozenBubble-2.210/

Benefits to the Perl Community

Implications for Perl

SDL bindings to Perl allow for rapid game prototyping and game scripting. The rapid development speed of Perl and power of the CPAN becomes a large selling point for Game Developers. This renewed union between modern Perl and SDL will most definitely showcase Perl to a very enthusiastic audience and bring in more users, like the Pygame project did for the Python language. Moreover learning a language to make a game has a universal appeal that users can understand.

Need for Tutorials

The SDL Perl is at a stage of writing SDL extensions that will require a lot of review and insight into the module. For this pool to be generated we need to attract developers and users to the current low level API. From the generated feedback, new SDLx modules can be born. Perl has considerable amount of documentation, books, tutorials, and articles written for various topics. However, one area still lacking is game development. The last article writing for game development in Perl and SDL has been in 2006. Since then, lots of changes have happened in both the SDL library and in bringing game development to Perl. For one, the SDL bindings has been completely rewritten.

There is no other module providing Game Development from the Perl ecosystem as focused as SDL. With these new tutorials beginners to both Perl and Game Development will be able to get up to speed. Game Development should attract more users into the Perl ecosystem, providing an extra appeal to newcomers and making a potentially dramatic change on the stigma of Perl as a terminal-only, archaic language.


Getting started tutorials that comprise of the following:

Your first SDL Application in Perl
Drawing Primitives and Sprites
Handling Events
The Game Loop
Making the Pong Game
Making the Tetris Game using Object Oriented Perl
Handling Music and Sound
Using modules from CPAN to reuse code in Games ( JSON and Moose )
Profiling your Games with NYTProf to find trouble spots
Using XS to optimize Game effects
Interfacing raw data with other Modules ( PDL and OpenGL)

Moreover, each tutorial will be provided with working code scripts. Lastly the documentation will be released as SDL::Manual with SDL Perl on CPAN.

Project Details

The tutorials will cover

Your first SDL Application

Installing SDL, where to get help and showing a simple window on screen.

Drawing Primitives and Sprites

Creating primitives (pixels, lines, rectangles, circles, triangles). Loading images into sprites. Then writing to the screen.

Handling Events

Showing how SDL can handle events from the keyboard, mouse and other input devices.

The Game Loop

How to put together the core loop of the game. This is the beginning of most games.

Making the Pong Game

Using what we have learned so to create a simple game.

Making the Tetris Game using Object Oriented Perl

Using Pure Perl object oriented code we will create a Tetris clone.

Handling Music and Sound

We will add background game music to Pong and Tetris. Also we will show how channels can be used for Sound Effects.

Using modules from CPAN to reuse code in Games ( JSON and Moose )

Using JSON to model Game Data. And improving OOP syntax with Moose.

Profiling your Games with NYTProf to find trouble spots

Games need to be fast and the NYTProf is unique profiling tool to Perl.

Using XS to optimize Game effects

Performing operations directly on Surface pixels using Perl to prototype and XS to optimize.

Interfacing raw data with other Modules

Interfacing SDL Surfaces to PDL (Perl Data Language) and the Perl OpenGL.

Completeness Criteria

The completeness of the project can be gauged with my regular blog posts and emails to [hidden email] . Also all code will be available on github.com for auditing. The project is complete when SDL::Manual is release with SDL perl on CPAN.

Project Schedule

The project should take 1 - 2 months. I will begin work on this project as soon as possible, regardless of the grant status. Without the grant it will take a lot longer to complete (or I may not even complete) this project as I will have to look for alternative sources of income.


Most of the work for this grant will consist of creating new documentations. In some cases prior existing documentation will be cleaned up. The overall activities can be broken down into 4 tasks.

Writing simple and clean examples for the tutorials

This should take 1-2 weeks.

Writing the tutorials and keeping them available on github.com

This will be overlapping with the last week and 3rd week.

Posting information on regular Blog Posts and the mailing to get the content reviewed

I will start releasing alpha versions on the end of the 3rd week and ask for reviews until the end of the 4th week

Improving and cleaning up the documents based on the reviews

The last 2-3 weeks will be spent on updating any Code and Documentations.

I will be spending apporximately 20 hours a week on the project. The total will be around 100 hours.


I am a Toronto based developer. I am the current maintainer of SDL Perl and have made several releases to [1] CPAN. Currently I have also helped with port Frozen-Bubble to the new SDL API and made it cross platform. I will be going into my 4th year of Software Engineering at University of Western Ontario. Besides SDL I have contributed in minor roles to Padre and Parrot. All my code is available from [2]Github.

[1] http://search.cpan.org/~KTHAKORE

[2] http://github.com/kthakore


Being able to use Perl to write SDL programs -- and especially, I think, games -- would be a great thing. SDL Perl seems to be making a significant comeback in terms of working and being actively maintained. One of the best ways it can stay working and maintained is for a user base to grow around it. Better documentation will help that happen.

I think this documentation could be a very useful project.

kthakore has been demonstrating his ability to write fantastic articles on SDL Perl via his Yet Another Perl Game Hacker blog (http://yapgh.blogspot.com).

This grant sounds awesome.

I am neither a gamer nor a game developer. But the proposal's thrust is clear to me and I know that the author has been working persistently in this area for at least the last twelve months. So this merits consideration for funding.

I think both this grant an in more general the SDL development should be funded as having a string game development framework in Perl can help introduce the language to a lot of people.

Kartik Thakore has been working on this for quite some time and showing nice progress. (and taking away some of the best developers from Padre).

Helping to improve the game development scene on Perl would help Perl appeal to a larger audience. This grant is a great idea.

Kartik's already done an amazing effort in fully revitalizing the SDL Perl project for the past year. That alone is worth way more than what he's asking for. Nevertheless, this grant looks like a natural next step to SDL Perl and I truly believe it is an awesome thing to have for the entire Perl community.

Having a "lighter" side of Perl shows that the language does cross many of the preconceived notions of perl as an administrators language.

Casual gaming is proving itself to be a huge area of interest given the iPhone, playstation network and xbox live downloads - why not a CPAN equivalent??.

The SDL tutorial - as with many cookbooks/tutorials will go a long way in getting people started in areas where they have no experience and struggle to know where to get started.

I think all the submissions have merit, but I like this one most, given I just installed the SDL modules and have no idea where to start. I also believe it will reach out to a new audience, always a good thing.

The appeal of games to the younger audience that hasn't been fed the typical myths about perl is definitely beneficial for the language and the community as a whole. A project like this one needs to be sustained by a healthy body of contributors, and the first step towards that is to provide well-crafted introductory documentation.
Kartik has been very active and dedicated to this project and I believe both him and the project to be well-deserving of the grant.

I think this is a great idea. I know of High School classes that teach other languages through game programming. This would be an opportunity to get Perl on that list.

I would also suggest tailoring and submitting a tutorial or two to a couple of magazines.

Being a contributor in the SDL perl project I should say that this grant is absolutely necessary. I presented a talk at a game conference last week and people were motly impressed by how easy it is to build games in Perl, more documentation is trully needed.

Nice. I think the future of "perl marketing" will come less from "the perl community" and more from other communities that happen to use perl to accomplish something useful. Writing a manual that enables game developers to ramp up in perl can only help spread perl to more places.

Even though I'm not a game developer, I'd be happy to see this proposal funded. (Who knows ... maybe because of it being funded I might *become* a game developer :-)

Peter Lavender If you are itching to get started have a look at examples/* and talk to us on the [email protected] or #sdl irc.perl.org.

I have previously advised Kartik on his SDL rebooting project (specifically CPANification and the like).

While I would have prefered to see this grant being more ambitious and pushing more towards a full "PerlGame" project, I support this grant as a necesary step.

I'm not a game developer, but I know that the documentation would be done, and done well.

thumbs up for this grant. kartik worked hard on perl SDL revival, and i hope this grant will help raise awareness around this.

I've been interested in game development and perl independently for a while, but the friends I work with have told me that it's too difficult for them to get started with the documentation already available. I think that creating accessible tutorials and documentation is a much-needed step here.


I have previous experience with perl and with sdl, but not together. The SDL that I did was with C++ and there's a lots of workin tutorials for that, however with sdl-perl it is simply impossible to get started.

I would really like to develop a game with sdl-perl.

even the simple stuff (for total newbies) would be nice.
-this is how to load image
-this is how to load multiple images
-this is how to move the image(s)
-do's and don't's

About TPF

The Perl Foundation - supporting the Perl community since 2000. Find out more at www.perlfoundation.org.

About this Entry

This page contains a single entry by Alberto Simões published on August 1, 2010 3:02 PM.

2010Q3 Grant Proposal: SF.pm Funding was the previous entry in this blog.

2010Q3 Grant Proposal: Perlbal documentation is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.


OpenID accepted here Learn more about OpenID
Powered by Movable Type 6.2.2