Dave GNUkem
|
|
Version: 0.44c | Date: 1999-03-25 |
Author: David Joffe | Email: davedev@scorpioncity.com |
http://www.scorpioncity.com/djgame.html |
Dave Gnukem is a 2D scrolling platform shoot-em-up. It is very similar to (and inspired by) Duke Nukem 1. The main character has been "borrowed" from DN1, perhaps temporarily.
This started out as an exercise for me in learning C/C++, back in 1995, using DOS and EGA graphics. It has now been converted to run on Linux, using GGI for the graphics library. It is playable, but still in development.
The game is OpenSource - contributions of levels, code, and especially ideas are all more than welcome! (And probably necessary if this thing is ever going to get finished ..)
This software is Copyright (C) 1998,1999 by David Joffe. There is ABSOLUTELY NO WARRANTY for this product. This software is distributed under the terms of the GNU General Public License. Please read the file COPYING in the distribution for details, or visit www.gnu.org.
Dave Gnukem is distributed as a "tarball" (a .tar.gz archive) of the sources and precompiled executables. Sorry, no package formats (such as rpm or deb) yet.
Unpacking the tarball: If you are using Midnight Commander, you can just hit "enter" on the file. You can also unzip it with KDE's "kzip" utility, and probably with GNOME's "guitar". Real men, however, use the command line:
$ tar -xvzf djg0.43.tar.gz
Change to the subdirectory created, g/src. There you will find two executables:
To run the game from the commandline, type
$ ./djg
(For now, the game must be run from the g/src directory, because of where it looks for data files.)
If there are errors, and you have installed GGI, you may need to recompile the source code. See the relevant section of the documentation.
Other files:
HISTORY - Program changelog
TODO - Project TODO/buglist
FILEFORMATS - Documentation of game file formats
COPYING - GNU General Public License
Keys:
Arrow left/right | Move hero |
Arrow up | Action key (open doors, activate teleporters etc) |
Ctrl or P | Jump |
Alt | Shoot |
Arrow up + L | Cheat - next level |
Escape | Bring up game menu |
Important note: The format for levels and sprites does sometimes change between releases of the game. Do not worry - just send me any levels or sprites you created with any particular version, tell me what version you created it with, and I'll convert it and send you the converted files.
The level editor ed allows for editing of levels and sprites, and has two modes for these tasks, level edit mode and sprite edit mode. The two modes can be switched between with F4 and F5. The editor starts up in sprite edit mode.
Each game level consists of a 128x100 2D grid of cells. These cells are filled with sprites. The grid contains 2 layers of sprites. The first layer is the "background layer", and on this you place background stuff like walls, floors etc. The second layer (the "foreground layer") is superimposed on top of the background layer, and on it you place things with special functions: doors, keys, monsters, food, etc.
The sprites are divided into "sprite sets"; each set contains 128 sprites. From version 0.43, there can be up to 256 different sprite sets, and each sprite set used in a level must be given a unique number from 0 to 255 (see section on mission packs.) The first 16 (0 to 15) will be the game's default sprite set. Any sprite sets you create additionally should be numbered from 16 up.
NB: The Escape key acts as a "quick exit" to the editor. No saving, no questions asked. Be careful with it.
The F1 will save all sprite sets when in sprite edit mode, and will save all levels when in level edit mode. You must save your changes before you press Escape if you do not wish to lose them.
Each sprite contains various attributes describing it's purpose. There is a "type" attribute, and 12 extra numerical attributes (0 to 11), which I have called "extras". There is also a "color" attribute, which is not used in the game, but which is used in the level editor to display sprites placed on the large grid.
To switch into level edit mode, press F5.
To create an "empty" level file, change to the g/data directory and copy the file template.lev to a new file, eg spaceship.lev. You must add an entry for this level in your mission file (see section on mission packs.)
Sets of levels and sprites can now be grouped together into "missions".
Each mission is described in a .gam file in the data directory. The list of missions available to the game is in the file g/data/games. So to create a mission pack, create a .gam file (perhaps by doing a "cp g/data/default.gam g/data/spaceship.gam") and then add the line spaceship.gam to g/data/games.
Look at g/data/default.gam to get an idea for the layout of a mission file. Each mission pack has a name (one line) and a description (multiple lines.) Then there is a list of levels, then there is a list of spritesets.
Each level in the list of levels is formatted like
this:
filename.lev,Name Of Level,Author Name
Each spriteset in the list of spritesets is formatted
like this:
IDNUMBER,filename.spr,filenamespr.dat,Name of spriteset
filename.spr contains the actual sprite images. filenamespr.dat is a file containing the attributes associated with sprites (sprite type, extras, color etc.)
The IDNUMBER is a number from 0 to 255. It is important to understand how this is used. The first 16 (ID's 0 to 15) are "reserved" by the actual game. Currently, only the first 8 are actually used (0 to 7) and 8 to 15 are reserved for future use, so we'll ignore spritesets 8 to 15 for now.
NB: The first 8 spritesets, with ID's 0 to 7, must still be defined in your mission file! If you do not, the game will probably crash. Typically, you will use the supplied default 8 sprite files to define spritsets 0 to 7; that is, def0.spr,def0spr.dat etc. See default.gam and foo.gam for examples of this. Your first 8 spritesets will probably look like this then:
0,def0.spr,def0spr.dat,General
1,def1.spr,def1spr.dat,General
2,def2.spr,def2spr.dat
3,def3.spr,def3spr.dat
4,def4.spr,def4spr.dat,Hero graphics
5,def5.spr,def5spr.dat,Bullets etc
6,def6.spr,def6spr.dat,monsters
7,def7.spr,def7spr.dat,monsters
Advanced: For ID's 0 to 7, you do not strictly have to use the supplied sprite files (defN.spr etc). However, the game references sprites in these sets explicitly by ID number and offset, meaning that if you change them, the game will still try draw certain things (like exits and teleporters) from where it expects them to be in the spritesets. Thus, you will be able to change the appearance of (say) exits and monsters in your supplied spritesets, but you will never be able to change where the exit is located in the spritesets.
If all this has confused you, then don't worry. Just copy the 8 lines above, as is, into your list of spritesets and then never worry about it again.
Once you have set the "default" spritesets, and you wish to create more sprites not supplied with the game, you can start adding your own from 16, eg:
16,mine.spr,minespr.dat,My sprites
62,ocean.spr,ocean.dat,Ocean sprites
~
Note that your own spritesets are added from 16 onwards. Also note that each section ends with a "~".
It is important to note that the ID number is used in the level files. Thus, if you later on change the ID numbers, the ID numbers in the level files will point to the wrong spritesets (or none at all.) So, once you have decided that (for example) your spriteset for the spaceship graphics is ID 25, stick with 25.
All of the above should be telling you: planning is important!
Later on, I may make it possible to use pcx format for the sprites, if people want that.
There are two ways to increase the size of the window in X: double-size window mode, and full-screen mode.
Running the game "./djg -d" will give you double-size mode. I hope you have a fast computer. This is really a fall-back for people who can't get fullscreen mode to work.
Running the game "./djg -f" will give you fullscreen mode. However:
There is an alternative way to use fullscreen mode, without using "-f" or the fullscreen script. GGI can be instructed to use DGA by default, by exporting an environment variable:
$ export GGI_DISPLAY="dga"
Lastly, when DGA sets the screen mode, it seems to maintain a normal-size virtual screen, and just draw in the top left 320x200 of the screen. You may need to use the mouse to scroll to the top left of the screen.
Change to the directory g/src.
Edit the Makefile if you want/need to make changes to the setup.
Make options:
Speed optimizing: If you want/need to coax a bit of extra speed out of Dave Gnukem, you can do a couple of things. In the Makefile:
This should get you between 5 and 20 % speed improvement.