The Lift Project
Lift is a computer game I'm working on in my spare time. It's a long way from
being finished, but little bits of it are starting to be presentable, so
this page is where the most finished bits will appear as I get around to
posting them.
Some of the original inspiration for this game came from the story
"A Princess of Helium" by R. Garcia y Robertson, which appeared in the
September 1998 issue of
Fantasy & Science Fiction Magazine.
This story basically implanted in my mind the thought, "Hey! dirigibles
are cool!" And led me on the path towards an adventure game set in the
high troposphere where brave Zeppelin pilots seek out adventure and ...
Well, plot and story lines are a bit rough yet, but the graphics code is
shaping up nicely. There's actually more to the graphics routines than
appear here, in that what you see in this example is a flying scene, but
there are also going to be indoor scenes. The renderer is the same in both
cases, but there are some tricks to setting up indoor scenes which aren't
really obvious from just looking at render.c and the one example app.
Anyway, here's the graphics code, version 0.8, and a little test app that
times the rendering speed and writes a BMP file to disk. Expect the next
things to appear here will be the realtime I/O code (so you can actually
see stuff move on the screen instead of looking at BMP files), a plan
of what the project as a whole looks like, and the editor which I'm using
to create the 3D models. All of the code listed here should be quite
portable C, with the exception that it is likely to accidentally assume that
ints are 32 bits, and that the I/O layer (when I get around to posting it)
is operating system specific code. Build it, play with it, send me bug
reports...
- render.h --
This file describes the main interfaces to the rendering routines. It's
also serves as most of the documnetation of these routines. Run it through
DocStrip and then LaTeX, and you'll have
most of a user's manual.
- game.h --
This is the interface to the I/O routines. Because the current test
program only writes files, most of this isn't yet relevant. Really, all
that's needed from this right now is the definition of PIX_RGB32. For
the colors to come out right, be sure to check the top of this file
to see that LITTLEEND and BLUEFIRST are getting defined correctly for
your machine.
- liftio.h --
File read and write interfaces which handle the disk format of 3D models and
such.
- render.c, clip.c,
fix.c, and geom.c --
The core code for the rendering routines. Render.c has some additional
documentation about the 3D algorithms in it which can be extracted using
DocStrip and LaTeX.
- bgnd.c --
Routines to set up the sky background colors based on time of day and
clouds. This is likely to get tweaked on extensively as I decide that
I don't like the color of the sunset or whatever.
- pgio.c --
File read and write routines for 3D Models. For those of you who are
thinking "hey! that's a cool blimp in the pictures, but it's stored in
a @%&$% proprietary binary format so I can't use it for my own nefarious
purposes," this file is the closest thing in existence to documentation
on the file format. Read it and be enlightened.
- testbmp.c --
A simple test program to prove all this stuff really works. Compile
all of the above, link it, and type "testbmp aship2.prt out.bmp".
the machine should spin silently for 30 seconds or so (one second
for each millisecond of rendering time for the picture), print out
a rendering time statistic, and leave you with a nice picture in
out.bmp. The first few lines of the program are tweakable parameters to
let you set things like the time of day.
- graph3d.tex --
A LaTeX file which generates the copyright page and stuff for the user's
manual you stripped from render.h and render.c. This is also the official
place where it says you can legally make copies of this stuff for your
friends.
- aship2.prt --
The 3D model for the dirigible that was used to make the screen shots.
This is a binary file, so download it carefully.
- tetra.prt --
Another binary 3D model. This one's of a white pyramid (which despite the
name actually has 5 sides...) Not really exciting, but it makes a good
test pattern if you're playing with the code and want something simple
to render. Also useful for estimating how much of the rendering time is
because of complicated scene geometry calculations and how much is just
the cost of writing pixels to memory. If you try to use testbmp with this
model, be aware that it's about 100 times smaller than aship2, so you'll
want adjust the DIST value to something closer so you can actually see it.
And here's some screen shots, direct from testbmp with various settings.