Chapter 2.12 --- Extra Credit
Write a 2D Game
"Going to dance at my wake?"
"I don't dance," the lawyer answered, "but you tempt me to learn."
Hopefully you've had a lot of fun writing and playing your own Text Adventures and MUD-like online games; but in today's gaming world, you may be hard-pressed to get your friends excited about working at the command line or out of a MUD console to try your new game. So now it's time to make a paradigm shift and start thinking about graphics and user interfaces.
We already have a game engine to work with, but it needs some major overhaul before we can write our first 2D game. We also have to determine what we mean by 2D game, since there are so many varieties to choose from---room-based graphical adventures, like the old Sierra classics; side-scrollers, like the old Nintendo games; rogue-likes; the list goes on. It would be useful if we could abstract all these different styles into our engine, so that we can use it to build all these different styles of 2D games. Luckily, we're working with Lisp, and that's exactly what it was made for: endless abstraction.
To support our endless whims and fancies, we will be using the
lispbuilder-sdl library in our extended game engine, one of the better Lisp libraries available for working with graphics, audio, and all things gaming. We will also be generating our graphics and environments procedurally, so that we can use a minimum of assets and textures from open-source graphic libraries.
An Intro to LISPBUILDER-SDL
Clearing and Redrawing the Display
Display Buffering and Memory
Even More Audio
Graphics and Other Resources
Procedural Content Generation
The Game Loop
The 2D Game Engine
Abstractions of Rooms and Worlds
Tidy Game Scripts