SDL
Following my group intervention to get me off of WoW my additive personality has found something new to keep me up until two in the morning and alienate me from friends and family and I call it SDL. Proof of my obsession is over 2000 unread RSS feeds, countless emails from Grumpy Gamer readers and no new "What I'm surfing" links. I blame SDL.
For those of you unfamiliar: SDL (or more specifically libSDL) is a Open Source cross platform 2D graphics library that kicks butt.
While at my last company, I (along with Chris Blackwell, David Satnik and Rich Moe) created a 2D game engine called Sauce. It was designed to be the next step beyond SCUMM. SCUMM was a great system for it's day, but it suffered from the glaring problem of being too catered to making adventure games. While at Humongous Entertainment we did some amazing things with SCUMM (Backyard (Base|Foot|Basket)ball) that it was never designed to do (and probably illegal in several southern states).
Given the opportunity to start from scratch on a game system, we created a system around a language that was much more C++ like, but had very power multitasking features (without all the semaphore issues) that are a requirement for games. The system also had a slick memory manger that automatically removed and reloaded assets as they were needed. On low memory systems it proved invaluable because the game programmer never had to worry about memory, things were just there when they were needed and gone when you didn't. Sauce also contained a very powerful multi-layered animation system and a great animation editor designed and programmed by SCUMM alum Brad Taylor.
I continue to use the Sauce system to tinker with personal projects but it's graphic engine is really starting to show it's age. The biggest issue is it has no ability to use alpha-channeled images and in todays high pressure competitive world of 2D graphics, that is a must. It also has some limitations of only being able to use 8 bit images for multi-layered sprite cells.
Four days ago I learned a friend was prototyping a game in pygame, a python based game engine, and as a connoisseur of innovative game development engines I couldn't resist playing with it. What intrigued me was the graphics back-end and how they were doing it, which lead me to libSDL.
The thing that immediately appealed to me about libSDL is the simplicity of the API. In 10 lines of C code you can be blitting images across the screen. No screwy windows set up or message loops. No endless filling out of structs. After a few hours of tinkering, I decided that it would make a perfect replacement for the graphics back-end to Sauce.
The first step was to try and integrate it into the render pipeline of the existing system. After a day of struggles, I decided that I should just rewrite the whole pipeline. Out went that chunk of code. In went me new libSDL based system. The graphics came up, but the tendrils of the rest of the system started to strain the code and I found myself kludging more and more to get it to function. What I needed was to throw out the overall frame work, keeping just the important sub-systems (memory, asset loading, file io, etc). Another day of mad obsessive rewriting and things were much cleaner, but I was still linking into a very large library that I wasn't using most of and the pieces I was using were hopelessly intertwined with the parts I wasn't. What I needed was to strip everything away, so I started a empty project, linked in the Sauce language interpreter and then proceeded to rewrite everything from scratch. Another day without showers or food and I had it all up and running. There is still a week of getting all the little things taken are of, but I am very pleased with the graphical results and libSDL. I just got my old 800 MHz system up and running, so I will be doing some speed tests over the next week.
The great news of that due to the cross platform nature of libSDL, I will still have a Mac version of the Sauce system and am looking forward to spending some time figuring all that out. Fun stuff. Must shower more.
It's very addictive to be in (as Brad calls it) "the flow" of programming. You can't type fast enough and everything is just pouring out in a stream of emotion disguised as code. You are no longer looking in at the code, but you are inside it, and rather then pushing it to where you want it to go, it just flows around you. I'm sure it's exactly what a writer experiences as a novel comes gushing out, or a powerful wizard as he wreaks havoc on the village peasants.
I just can't say enough great things about libSDL. If you're in need of a good 2D back-end, this seems perfect. Of course, there is a lot more to creating a good 2D game system, especially an adventure game system than graphics routines. Sauce has a huge number of Foundation Classes specifically written for doing adventure games and those are all still useable in the new incarnation.
I do have a couple of issues with libSDL (I might be wrong about all these):
- You can't blit alpha-channel images into another alpha-channel image with the resulting alpha-channel being a combination of the two. This makes pre-compositing difficult.
- Integrating libSDL into a MFC or other Windows GUI app seems difficult. My next big tasks is to write a sprite compositor application and I want it to use a libSDL window for the graphics and standard Windows (or Mac) controls for everything else (in a separate window). I'm sure there is a way to force this, but it's not natural.
- The libSDL sound system won't play mp3 or ogg files. I have spotted some message thread fragments from people that seem to be doing it with a 3rd party lib, but they are spooling from disk. I need them to play from memory. I'll look into this more. I could be wrong. Like I was about the Zelda graphics (please stop sending me hate mail).
- The documentation is a little vague about when you can take advantage of hardware support. My timing tests for enabling hardware or software blitting is identical so obviously it's never using the hardware. There is probably a good reason why it's not, I just can't figure it out.
These issues aside, congratulation to the entire libSDL team and contributers for an amazing library.
And like a crack addict moving to heroin, I just download the Torque 3D engine...

Other people's comments:
Posted by s_nodice on Apr 11, 2005 ten to three pm
By the way, have you seen a purple monkey with a chef's hat? supposedly he makes excellent drinks and I need him for a little shingding I'm throwing for president Lincon. I'll invite you, but with the whole Zelda (I'm sending some hate mail as we speak/read/type) thing I figured it's for the best that you won't come. I still like you, though.
Posted by Blue on Apr 11, 2005 three pm
Posted by Ron Gilbert on Apr 11, 2005 twenty past three pm
Posted by Tom Barnard on Apr 12, 2005 five past two pm
Posted by Chris Blackwell on Apr 11, 2005 five pm
Posted by Edmundo on Apr 11, 2005 seven pm
Also, what is the deal with liquidy names? First SCUMM, then Sauce... Why don't you call it something like... um...
poop wood laydybug roast beef boogersomething solid!Posted by Rich on Apr 12, 2005 ten to ten am
Advanced
Utility for
Creating
Entertainment
Posted by Edmundo on Apr 11, 2005 half past seven pm
Posted by Ron Gilbert on Apr 11, 2005 twenty five to eight pm
Posted by UncleJeet on Apr 11, 2005 ten to eight pm
Posted by Ender on Apr 13, 2005 twenty five to two am
Posted by yaz0r on Apr 25, 2005 two am
Posted by Someone on Apr 13, 2005 half past one pm
Sam works at Blizzard on WoW so you can't seem to get away from his projects ;).
m.
Posted by Oded Sharon on Apr 12, 2005 twenty past one am
I've been wondering about its usability as a tool for making a 2d-3d hybrid adventure game. something like Syberia of Grim Fandango though the latter is fully 3d, it's still nicely done - interface wise.
Good luck !
waiting to see the next Ron Gilbert game soon !
ooh.. and don't worry about those 100$ you paid to get the Toruqe engine. You'll get at least 78$ back from car4ron donations... ;-)
---Get Ron Gilbert a Torque engine license !
Buy a car for Ron Gilbert.
http://car4ron.com
Posted by SiN on Apr 12, 2005 ten to two am
For sound , I use SDL_mixer. AFAIK, it streams music, but it loads soundFX onto the RAM. And I think you can force it to load both to the RAM. Loads all sorts of formats (I've only tried wave & ogg so far) and it's just as easy to use as SDL is.
Also remember that SDL comes with OpenGL built-in if you'd like to experiment with some basic 3D things. OpenGL is pretty simple to learn ... it has the same C-styled structure that SDL has. The only problem is that it doesn't come with all the wrapper functions that DirectX does ... so no 3D file loader, texture loader, etc. It's still a solid 3D engine worth exploring though.
Btw, if you figure out how to use SDL in a Windows GUI styled program, please let me know ... I need to make a map editor of sorts, and that would be VERY handy to have! Thanx.
SiN
Posted by Ron Gilbert on Apr 12, 2005 seven am
Here is one thing that works: You can create a full MFC program as a DLL, then you create your normal SDL program that loads and calls the DLL. This will give you a SDL Window + all the windows that the MFC DLL creates. Your editor will be serveral windows, but it works.
Posted by Someone on Apr 13, 2005 twenty five to two pm
SDL's goal has always been simple and MFC-y apps isn't really part of that. There are some "in-SDL" widget libraries out there, though. Bit dodgy of course.
m.
Posted by Bacon on Apr 12, 2005 five to eight am
http://nehe.gamedev.net/
Posted by Tom Spilman on Apr 12, 2005 ten to three am
You might want to take a look at Popcap's Game Framework as it supports 3d hardware for 2d rendering with fallbacks to software rendering when needed.
Posted by me on Apr 12, 2005 five past seven am
http://alleg.sourceforge.net/
Posted by Patrick Sullivan on Apr 12, 2005 half past eight am
Although I thought it wasn't so much that hardware didn't support it as none of the APIs supported it and as SDL simply is a wrapper for OGL and DX it didn't either.
Posted by Patrick Sullivan on Apr 12, 2005 twenty five to nine am
Posted by eloj on Apr 12, 2005 five to nine am
Most people use SDL_mixer. For the I/O, you need to read up on SDL_RWops if you want to play from memory.
Posted by Torbjörn Andersson on Apr 12, 2005 ten past eleven am
Actually, I don't know how actively SDL_sound is being developed these days. I was involved in it for some time, but not recently.
Posted by eobet on Apr 12, 2005 quarter to eleven am
Why not do as Julian Gollop (another creative genious the corporations don't understand) and publish your own game online?
SDL will outlive Windows, and I believe that 2D still has greater mass appeal than 3D (one less D in the interface to worry about), and is generally better than 3D in almost any way... but that's just me, I guess.
Posted by Jake on Apr 12, 2005 twenty to noon
Posted by Kingzjester on Apr 12, 2005 half past four pm
Posted by eobet on Apr 12, 2005 twenty to eleven pm
We knew we could never find a good enough scene for what we wanted to do this early autumn, nor light it properly so that it looked proffessional. So what did we do? We shot it in black and white! You never noticed that the grass wasn't really green, nor that the sun wasn't that bright then. The ad came out really great looking, without hours of photo manipulation.
2D is great when you don't have the time or budget to develop in 3D. Also, 2D art doesn't age as fast as 3D art, imo (perhaps this is because most 3D art tries to look realistic, and always utterly fails... perhaps WoW will change that trend).
The book comment is just silly...
Posted by Kingzjester on Apr 16, 2005 five to six am
Posted by eobet on Apr 16, 2005 quarter past ten am
If you need to write a note to someone quickly, do you type it in a word processor and print it, or do you write with a pen on a post-it?
I used to be the same with sketching designs, doing everything in Photoshop, until we had one workshop where in the end we only had 2 minutes to create a presentation sketch. I wouldn't even had time to boot my computer and launch Photoshop during that time, but I did some excellent sketches with my markers (they're on my website, even).
For people with a small budget, a heavy time constraint or just people looking for something simple, using 2D/black-white/hand written stuff is great. You also don't NEED 3D just because you can do it.
Posted by Kingzjester on Apr 18, 2005 quarter past six am
However, there is no intrinsic and automatic benefit of pen and paper over word processor, of black and white over colour, of 2D over 3D, as you make it seem — you didn't even talk about relative benefit in your first post, you were generalizing about some straightforward and self-evident quality and virtue that the alleged opposite lacks.
Shooting a black and white photograph is in no way easier than shooting a colour one and lighting a black and white scene correctly is an art in and of itself — you make it seem like magic! That you somehow managed to make a good black and white photograph may say something about your team's proficiency with traditional equipment and methods, but it says nothing about the inferiority of digital or colour. You cannot replace oil on canvas with Photoshop — you shouldn't even try.
Every fucking technique out there has benefits and drawbacks. When you're picking a technique to flesh out a concept, you have to judge on a case-by-case basis. You cannot create a religious mantra of sorts that discriminates between good and evil techniques as a matter of modus operandi — exalting the former and damning the latter arbitrarily. Doing that is fruitless — but that is what you are doing.
Posted by eobet on Apr 20, 2005 two am
(PS. Markers are not oil. It's a type of pen.)
Posted by Richard on Apr 12, 2005 twenty past five pm
I wouldn't be able to enter the 48-hour game programming comp without PyGame :)
http://www.mechanicalcat.net/tech/ld48/
Posted by Jeff Tunnell on Apr 12, 2005 quarter past seven pm
We met a long time ago when I was still at Dynamix. I've been working hard on GarageGames for the last six years. I heard from a GG community member that you are considering using Torque. I think it would be awesome. If GG or I can help you in any way, send me a mail or give me a call at 541-345-3040.
-Jeff Tunnell, GarageGames
Posted by Zac on Apr 13, 2005 twenty five past nine am
Thanks for The Incredible Machine. It's still a fun series.
Posted by Jeroen Jacobs on Apr 13, 2005 half past five am
If you're looking for a 2D/3D adventure toolkit, check out the Wintermute Engine.
http://www.dead-code.org/
Greetings,
Jeroen
Posted by Oded Sharon - Buy A Car For Ron Gilbert on Apr 13, 2005 twenty five to noon
First - thanks.
I know WME, and have it installed, and i even made my own little 2 room adventure game with it (programmer art - don't ask...)
I was even considering to use it if i'd ever go commercial and want to make an adventure game.
Among it's disadvantages vs. engines like torque is that you don' t get the engine's source, and thus can improve upon it. Stuff like playing ogg or mp3's or using hardware effects - say you want to include renrered 3d-cutscenes in to your game.
IMHO Using it is extremely useful for underground adventure game making. Not proffessional ones.
Now, about torque, i simply don't know.
I will give SDL a shot once i get some free time.
thanks again !
Oded.
-----Did you buy a car for Ron Gilbert ??
http://car4ron.com
Posted by odnorf on Apr 13, 2005 ten past one pm
If you want to create a 2D proffessional adventure what features did you miss in WME? You can even use real time 3D characters with this engine.
And the engine's author is very open to suggestions.
Posted by Oded Sharon on Apr 14, 2005 quarter past five am
But, I'll give you some examples. For instance, let's say you want to incorporate some particle effect system, like smoke, or fireworks, and you want it renreded in 3d. or you want to program some fog system or any of those 3d related features. You'll need the engine source for that, something you don't get with WME.
same goes for, let say, network capabilities. And i'm not talking about MMOAG (massivly multiplayer online adventure game), but something more simpler like incorporating web pages into your game, or high scores or something.
again, need engine source code, or some API to run these external peices of code....
moreover, being a control freak, i'd like full control of my product, and no source code, means less control. which is in conflict with my megalomania.
Toreuqe however, has source code, and also many open-source projects are out there. But to date, i havn't seen a really worthwhile open-source game engine right for a 2d-3d adventure game hybrid.
A lot have been said about AGS, as being one of the best platforms for 2d adventure games, but i find it's lack of ability to work at high resolutions (like 1024x768) really amateur, and only good for underground adventure games.
this is my opinion, feel free to disagree.
you wouldn't be the first.
----
Did you Buy a game engine for Ron Gilbert ?
No ?
Then Buy A Car For Ron Gilbert !
http://car4ron.com
Posted by odnorf on Apr 14, 2005 ten past six am
And afaik there is no opensource adventure-specific engine with the features & flexibility of wme.
Oh, and wme has plugin support so you can run external pieces of code.
Posted by metamorphium on Apr 14, 2005 half past six am
and not only it takes time to learn it, but also it's really hard to make non full3d game. It's on the other hand very powerful engine. (I came close to that but then discovered WME which I use now). WME is growing everyday and right now it support even dynamical reverb for sound. It is just the matter of time and people doing games with WME that it will get features everyone need.
I don't agree it's not suitable for commercial titles since we are producing title which is aimed to be fully commercial.
Cheers!
Posted by Oded Sharon - Buy A Car For Ron Gilbert on Apr 14, 2005 twenty five past two pm
good luck with making an adventure game !
i hope it's good. I've been waiting to play some GOOD avdenture game in a while.
You guys convinced me to give WME a second chance.
now, anyone knows a good 2d and a good 3d artists in Israel who's gonna work for nearly free (at the beginning) ?
I can't make an adventure game with programmer art....
Oded
---did you buy a car for Ron Gilbert ?
http://car4ron.com
Posted by Someone on Apr 13, 2005 ten to nine am
http://wiki.wxpython.org/index.cgi/IntegratingPyGame
The basic trick is to set the SDL_WINDOWID environment variable before initializing. Check out the "SDL_envvars" section in the SDL docs for details.
Posted by Tramb on Apr 13, 2005 five to nine am
Posted by Ron Gilbert on Apr 13, 2005 ten past nine am
Posted by Shawn South on Apr 13, 2005 ten to noon
http://www.ogre3d.org/
Haven't had a chance to actually play with it yet, but it looks promising.
Posted by Someone Else on Apr 15, 2005 twenty past eleven am
Posted by Nathan on Apr 30, 2005 quarter to ten pm
It's cross platform (windows, mac & linux), has resource management, and a really well thought out design (OO the way it's meant to be).
If you found SDL easy to use, you should find the same with ogre.
Posted by omloflump on Apr 13, 2005 half past ten pm
Posted by Richard on Apr 19, 2005 five pm
Posted by omloflump on Apr 13, 2005 twenty five to eleven pm
Posted by Chris Y. on Apr 13, 2005 five past eleven pm
Posted by SiN on Apr 14, 2005 twenty five past six am
as opposed to pester Mr. Gilbert via an annoying off-topic blog entry comment?
uhh, anyway, ron doesnt work at double fine, so i doubt he'd know why, and if he did, he prolly wouldn't be allowed to tell you.
but port jobs are the decision of the publisher, not the developer. the publisher dictates what platforms they are gonna release a game on, so clearly, majesco didn't think the cube would be commercially viable. pity, because if i were to buy a console, it'd be a gamecube
SiN
Posted by Chris Y. on Apr 14, 2005 twenty to three pm
Posted by William Kendrick on Apr 14, 2005 five to six pm
Now, I've never streamed audio from disk or network, so I can't really speak to that concern about MP3/Ogg. In fact, I normally use MODs (for music) and WAVs (for SFX). (See my junk, almost all SDL-based: http://www.newbreedsoftware.com/ ) I just load the sound using the Mix_Load*() functions and play them when I need to using Mix_Play*()...
Enjoy! SDL rules. I'm finally getting to use it for (at least a prototype of) a real commercial product! :^)
Posted by Sean Robinson on Apr 15, 2005 twenty five to five am
Well then what you want is the excellent cross-platform FLOSS application named wxWidgets. It's been matured over twelve years, and it is a great way to use native widgets on different systems and GUIs.
http://www.wxwidgets.org/
A "Hello World" sample can be seen here:
http://www.wxwidgets.org/hello.htm
Posted by B-Dawg on Apr 15, 2005 twenty to five pm
Unfortunately if you make a commercial product you have to pay. WoW uses it....
Posted by Someone on Apr 17, 2005 ten past ten am
Posted by Ryan C. Gordon on Apr 15, 2005 quarter past nine pm
For what it's worth, SDL_sound (http://icculus.org/SDL_sound/) can decode whole audio files from memory buffers, or stream them in chunks from disk...the mechanism is the same from an API standpoint, and it gets you all the Ogg/MP3/Wav/Midi/etc goodness transparently. I'm very pleased how the SDL_sound 1.0 API turned out, and makes a nice addition to SDL if you just need to get the data in for your own mixing and manipulation.
And since we're subverting you to handy open source libraries, now that you are generally satisfied with SDL for your video routines, you might want to take a gander at PhysicsFS (http://icculus.org/physfs/) for replacing your file i/o. :)
--ryan.
Posted by Anders Kjeldsen on Apr 16, 2005 twenty five past one pm
Posted by Beef on Apr 21, 2005 twenty to seven am
Another nice opensource 3D game/rendering engine:
http://nebuladevice.cubik.org/
Posted by Roger Levy on Apr 19, 2005 twenty to nine pm
SDL to me isn't as good as the Allegro library. you can do alot more right out of the box with it. also i don't like having to write event handlers for input, which Allegro does not require.
the only downside is that support for hardware-acceleration is weak at best. and you can't combine openGL with software graphics as easily ( i think). but one upside is you don't have to worry your head over locking and unlocking bitmaps if you go the software route. you can also easily gain direct memory access to bitmaps that you can draw to. may not be as fast but it is damn flexible.
Also i am skeptical about SDL's simplicity. apparently because it is based on DirectX, it is not predictable and therefore requires you to perform many checks on the actual screen format it gives you for instance. so isn't that more complicated, not less?
Posted by eloj on Apr 23, 2005 quarter to eleven pm
Posted by Alex Whitington on Apr 29, 2005 quarter to three pm
What is a back-end exactly?...It sounds kind of dirty.
Posted by Ogtrax on Jun 29, 2005 twenty past six pm
Posted by Greg on Sep 23, 2005 quarter past six pm
Did you ever find a solution for your SDL with MFC problem? I have been working on this very same problem but have found no reasonable solution. If you can provide any information that would be very helpful.
Also, a couple years back I created a "replica" of the SCUMM engine from scratch entirely in QBasic and Assembly. I released a SDK (so people can make their own games) and Demo (with 3 rooms) for my engine. The engine is titled the TWIGZ Engine and it can be seen and downloaded from my website http://www.shatteredrealmproductions.com
Posted by Ron Gilbert on Sep 24, 2005 five past eleven am
Posted by Madster on Nov 3, 2005 ten to one pm
Just use the now-open-source WxWidgets. Also there are some form designers out for it now.
Cheers and salutes to all the great game creators in here :)
Posted by Petruza on Nov 8, 2005 twenty past seven am
let us know!
I also like very much SDL, and I'm starting a game with it.
Oh and of course, thanks for the wonderful adventure games you created.
Greetings from Argentina!
Posted by timofonic on Mar 20, 2006 twenty five to one am
Any news about this very interesting project? It could be nice to see a new awesome graphic adventure from you. What about releasing it as multiplatform, including some exotic platforms (with the help from other programmers)?
Do you will release SAUCE as open-source (GPL or other license)?
Best regards,
timofonic
Posted by fluxgold on May 8, 2006 nine am
then check out www.massivetracks.net
i found it a couple days ago
cya
fluxx