Developing Games with Perl and SDL
segphault writes "Andy Bakun has written an excellent 20 page guide to game development with SDL_Perl for Ars Technica. The tutorial, which includes extensive code examples and plenty of screenshots, walks readers through the process of building a clone of the original Atari Kaboom! game." From the article: "One of the biggest benefits of using SDL is that it allows portable media applications to be written without having to be concerned with specific implementations of media libraries for each target platform. Bringing Perl into the picture takes the portability one step further, allowing media-rich applications to be written in a high-level language that can be targeted to a number of platforms. While programming using SDL requires knowledge of C and access to a C compiler, using SDL_perl does not. This greatly decreases the amount of time it takes to get something up on the screen and working."
... I can't see perl being fast enough for games that require
really complex physics or enviroment calculations , or sophisticated AI.
I do think this is a nice way of getting people started in games
programming though.
But what if I'm too lazy to copy and paste, and just want to download the game?
It sounds good as a learning tool. It would be great if budding game coders, especially younger coders, could be given a simpler enviornment in which to begin toying with graphics and sound coding.
However, it's in Perl. And I really have to ask myself; Do I want to play games coded by people who started programming games in perl?
But seriously, whenever you code a game, you always end up using a scripting language of some kind. Perhaps this just cuts out that virtual middleman that is c/c++?
May the Maths Be with you!
Python with SDL (pygame) has been used to write Dungeon Siege (I think that was the game, correct me if I'm wrong) and I liked the result a lot.
Send email from the afterlife! Write your e-will at Dead Man's Switch.
Ideal. I always wanted my 4ghz pc to simulate the clock speed of a 286!
I thought perl was already a game.
Take the cheese to sickbay, the doctor should see it as soon as possible - B'Elanna Torres, "Learning Curve"
Yet, it does need knowledge of Perl, another programming language, and access to a Perl interpreter. So, indeed, in the end it needs the exact same thing that is needed to write a game in C or C++. A person needs knowledge of a programming language, knowledge of an API and access to software which will make the program happen. So, having this in mind, wtf is that intended to mean? Sheesh....
Slashdot, fix your code or at least hire someone who is competent at it to do it for you.
http://www.frozen-bubble.org/ example of a nifty game written with sdl_perl
While this may give a backbone for new programmers to get out their first game, the complexity of game making cannot be "simplified" more than it already is. Perl itself is slow, and not directly suited for making games. One would have to think carefully about what they wish to achieve before committing to making a game using SDL_Perl.
Korean women?
Do I win a prize?
Monstar L
It's in Korea, isn't that obvious?
Flash achieves this easily, especially with the dancing frog.
Liberty freedom are no1, not dicks in suits.
Think C64 games, but with true 24bit graphics at 640.
SDL+PERL can be thought of a 'flash killer' hack.... with enough specific libraries for sdl in perl, they
could do extra tricky bits animated mpeg1 in a sprite with one command.
Liberty freedom are no1, not dicks in suits.
Yeah, maybe games are easily portably then, but actually, I don't want to see my games running on Windows...
-DBS
Sigs suck!
There's been SDL bindings around for a lot of languages for a while.
Personally, I think lua would be a much more interesting choice than perl for this.
"While programming using SDL requires knowledge of C and access to a C compiler, using SDL_perl does not"
.. which needs access to a perl interpreter and perl knowledge ...
yeah, seems logical when writing in perl
i.e. something that compiles with gcc (though isnt particularly bothered about the version so long as it's newish) and even throw in project files for Visual Studio and Visual MingW and include a simple SDL powered "hello world", perhaps playing a sound and showing a couple of sprites and a 3d (opengl?) based ball bouncing about.
then all you'd have to do to write a portable SDL app is delete those things (all very clearly declared and laid out) and begin writing, safe in the knowledge that any porting problems are because you-the-code made assumptions about the size of int.
and if you can just "cd sdl_appbase" and "make" without having to run configure and install bash,python,gawk,cygwin and god knows what else then that'd be nice too.
If you don't risk failure you don't risk success.
What's up next?
Enhancing gui user experience with Oracle Forms
HowTo: Brute Force numbercrunching in Visual Basic
or
Windows 98 Security 101
So, sit down on your bums and write a Perl API for DirectX with good WINE support, folks. ;-)
"I love my job, but I hate talking to people like you" (Freddie Mercury)
Pygame is a really nice wrapper around SDL (http://www.pygame.org./ There are plenty of guides and tutorials on the website.
:-P
Why use Perl when you can use Python?
-Håkan
generally, the sort of person who's going to be successful at developing a game wouldn't need some absurd visual boondoggle like that. the reason you don't see a hand-holding-sdl-base-for-the-brain-damaged is because the sort of people this would "help" would never be able to get an sdl game off the ground anyway. people who are capable of writing game software are more than capable of installing their own development environment.
The obfuscation and unreadability of perl makes it a great way to keep competition from building upon your source.
SDL is "a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer" (quote taken from the SDL web site). What about:
1) drawing functions
2) fonts
3) openGL
4) file formats
5) game GUI
6) sound formats
7) networking
8) configuration
etc?
there are various SDL-derived libraries that implement, more or less, the above, but they are C/C++ libraries, and the quality varies. Does Perl make it easy to use those libraries?
We had great game development libraries for stuff like that 10 years ago, e.g. Allegro. While I appreciate the Perl support here, I don't think anyone would put more than a couple of hours' worth of effort into a game that doesn't support pretty 3D stuff on modern graphics cards. If you want to do such things, SDL_Perl isn't a viable option (look at the effort involved).
;-)
So, sit down on your bums and write a Perl API for DirectX with good WINE support, folks.
At last we can have Tetris with regular expressions.
Read my blog.
It's basically a wrapper for SDL that makes it extremely easy to make games with Python. You could easily make a working 2D game with sound and decent physics in an evening if you are already familiar with the language. I'm a relative newb, and even I was able to make a basic pong/breakout type game in a few nights. :)
Or use PyOpenGL and you can make some 3D games.
-- null
[puts on flame suit] This is going to be controversial I know but has anyone tried developing a real game in Java? (by real I mean something that you don't play on a mobile phone) I realize that the GCing could be problematic but it is possible to minimize or even eliminate that problem. Other than that I think the language is probably fast enough now and I would have thought that the lower development time would encourage games houses. Perhaps it's simply that the tools aren't there for Java yet (maybe they never will be). Any thoughts?
I used to have a better sig but it broke.
...of 2D games can be done fairly easily and quickly in Flash. I'm really quite surprised there hasn't been more of an effort made for an Open Source alternative to Flash, maybe the reputation it has for being slow, evil and crap has too much of a foothold, but it's actually quite a nice environment to work in for testing some stuff.
:)
As for this, I suppose it's nice enough. I don't see what it brings to the table that hasn't been done many times before, in many different languages, but making games is fun enough that I do it for a living, so the more people who can have fun doing the same thing the better
Game dev and music blog
Somebody just has to clone this Minter classic!
_ Camels
http://en.wikipedia.org/wiki/Attack_of_the_Mutant
http://www.the-underdogs.org/game.php?id=2807
in the long run, we're all dead anyway.
Mildly interesting but in terms of modern games it won't cut the mustard so then you are looking at smaller games and a platform to learn on. IMO there is only one top platform to learn game programming for and that is the Java mobile phone platform J2ME that even comes with a standard (and pretty simple) 3D API. Its also the fastest growing gaming market out there at the moment, and its still an area where mere mortals can break in and create the killer game and make money. Aiming at the PC market means you are against the multi-million dollar budget folks and that just isn't sensible.
If you want to learn game programming... get a decent phone.
An Eye for an Eye will make the whole world blind - Gandhi
Actually, I think Python and SDL is a far better combination, see pygame. As example of such a project is , developed using Python and SDL.
Some "development" topic comes up and out come the Python Zealots...
All that highly optimized C is part of a prewritten library (as is the case here).
For the remaining non-performance-critical stuff, Perl is often MUCH easier to develop with.
And in many cases, keep in mind the 80/20 rule of thumb. 80% of the time is spent in 20% of the code. This does vary, but in many cases the amount of highly optimized code needed for good performance is very little.
Many years ago, I was writing a program in Perl. I knew that there was a good chance I'd have to rewrite some of it in C eventually for decent performance, and this turned out to be true. In the end, I obtained 20-40 times the performance (and most likely 95%+ of the performance I would have obtained using C only) by rewriting approximately five lines out of 100-200 lines of Perl in C. The time it took me to figure out how to interface C and Perl (doing so was not documented very well then, it took me 2 weeks to find SWIG) was still far less than the time it would've taken me to write the entire program in scratch using straight C.
retrorocket.o not found, launch anyway?
Yeah Frozen Bubble is Da Perl-written Game!
I wrote a tetris variant in Tk that runs pretty well.
Ok, it barely refreshes fast enough to be playable.
But still, it's awesome. Try it and you'll find out why.
Play Spew.
OddManIn: A Game of guns and game theory.
what really gets me is when you wan't to make some changes to open source software (particularlly windows stuff) and sure you can download the source but you have to spend hours messing arround trying to get the build environment right.
how the hell are users supposed to fix bugs that annoy them if they can't get the build environment right for the existing code?!
note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
"Rubygame has SDL as a backend, and is styled after the very nice pygame." It's in active developement but is very usable.
http://rubygame.seul.org/
Bravo to author Andy Bakun for writing this article about F/OSS (UNIX/Linux) technologies without implying that the article is targeted for any particular open-source OS. In other words, it's equally relevant on all of the open-source OS's -- the BSDs, the OpenSolaris based distros and the Linuxes.
Eric Boutilier -- OpenSolaris
http://www.panda3d.org/
And a little "Hello World" to show you the pwoer of it is at:
http://www.panda3d.org/wiki/index.php/A_Panda_%22H ello_World%22
Peace,
-Nick
Are there any good development tools out there for developing hex-based games?
Don't care about the platform or the language.
http://cl-sdl.sourceforge.net/ for CL-SDL. :-P
I remember reading quite a long time ago on planetquake.com about John Carmack doing an internal port of Quake3 to perl so he could lern the language. Not sure how far he got or if it even ran...
The author does a good job of introducing SDL and the mechanics of a simple game. Nicely done!
You can try this right now:
http://www.jpct.net/paradroidz/
It can run standalone or in a browser.
What platforms can the resulting games be run on?
SO YOU'RE GOING TO DIE: The Comic for Dealing with Death
What if all I want is a bidirectional SDL proxy for Icecast? The proxy receives a URL requesting an SDL file, converts that to a URL requesting an M3U file from the Icecast server, passes it to the Icecast server, which sends down the M3U. The proxy converts that to SDL, then either sends the SDL to me, so I request the objects specified in the SDL from the proxy, which converts that to MP3/OGG URL requests to Icecast, which streams the objects to the proxy, which converts them to the format (probably MP4) specified in the SDL, then streams them (sending chunks as they're received) to me. Or maybe the proxy receives the M3U from Icecast, and itself immediately requests the MP3/OGG objects from Icecast, streaming them to me.
It looks like I could use SDL_Perl to write that proxy. But hasn't someone written one already?
--
make install -not war
Oh yeah, "Practical Extraction and Report Language." Sounds like a real game friendly language choice. Come on, I know this is Slashdot, and most of us spend our free time installing Linux in our pillows and spoons, but this is just a bad idea.
Kaboom! ran on the Atari 2600. Kaboom! was written by Larry Kaplan and David Crane for Activision.
Democrat delenda est
I saw the Python... but I didn't see anyone mention Ruby yet. Yes, there are also SDL bindings for Ruby http://www.kmc.gr.jp/~ohai/rubysdl.en.html or http://rudl.sourceforge.net/. And even a Rubygame library (styled after pygame) which is starting to incorporate OpenGL too.
> While programming using SDL requires knowledge of C and access to a C compiler, using
> SDL_perl does not.
Instead, using SDL_perl requires knowledge of Perl and access to a Perl interpreter.
Possibly to learn, but given the thousands of ways to do things, it may turn into a nightmare to maintain. Gives me chills just thinking about it....
While programming using SDL requires knowledge of C and access to a C compiler, using SDL_perl does not. This greatly decreases the amount of time it takes to get something up on the screen and working."
I would venture to guess that the number of people who know PERL, do not know C, and program games, is about...7.
Plus the only game I know of that made very heavy use of scripting languages is Civ4. And that game is the most poorly programmed hunk of crap that I've ever played. The unbelievable slowdown takes quite a bit away from a great game.
Perl is totally cross-platform.
Why is it that when you believe something it's an opinion, but when I believe something it's a manifesto?
In fact, over at NeHe Productions there are a ton of OpenGL demo tutorials (and a CD available), mostly written in C/C++. Some of these (the "beginner" ones, mainly) have been converted over to Python (and, IIRC, PyOpenGL - that, or some other wrapper), and are very easy to read, well commented, well documented, etc.
Once I had Python and PyOpenGL set up properly on my Linux box, I was able to get the demos working well, and modifying them was easy. Eventually, I took the "simple room walkthrough" demo, and had modded it to allow me to walk around while being able to look whereever I wanted (that is, I could look independently of movement). I eventually modded the code to use the mouse for "lookaround", and the arrow keys were for walking. Now, this isn't too special - what was interesting, though, was getting X to recognize and be able to use two different mice on my system (one was serial, the other PS/2) - I did this 1) to see if I could and if it was possible, and 2) because my "second" mouse was an "off-table" ring-mouse trackball device I had bought specifically for virtual environment navigation, and I didn't want to be constantly swapping the devices out. It was cool while I had it working - a great experiment, and it really showed the power of Python and OpenGL.
I am pretty certain a full 3D engine could be built using Python and PyOpenGL (of course, OpenGL is doing all the "heavy" lifting - though who knows if Python would be up to task of doing everything else a real 3D engine needs - perhaps at that point you move to CrystalSpace or something)...
Reason is the Path to God - Anon
Given the obscene bloat associated with Java, I wouldn't be entirely amazed to find that the Perl games run faster than Java ones do, and use LESS MEMORY. The only time I have ever hit an out of memory error in Windows is when I'm running Eclipse, Tomcat, and MyEclipse at the same time. 512Mb should be enough memory to develop software.
So you finally made it to level 99 and as you approach the last boss the perl program crashes with a message about a missing module! Surely you say, this is not possible perl detects the missing module during compilation.
Quickly I retort, try chrooting a perl script some time, especially one that has a function in a module that has a use statement in it and watch your scripting language fall apart.
Seriously folks, this is part of the perl dementia. perl is great as a general system glue/sh scripting replacement, its good for cgi's, but stop trying to do everything in scripting languages, in every single real world implementation ive seen its either failed misrebly or performed misrebly. Please grow up and use a real language when you have real tasks to accomplish.
The game is actually Severance - Blade of Darkness. Totally missed that one :P
Send email from the afterlife! Write your e-will at Dead Man's Switch.