Chapter 3 Preliminary information This chapter explains some of the background behind creating add-ons for Duke Nukem 3D. 3.1 Intended audience for this chapter I guess all of you have heard of the game DOOM by id Software :) Well, many of you have created add-on maps for DOOM. You know how a door works, what a sector is, what to look out for while creating a level. While Duke3Ds BUILD engine is much more powerful than id's (see below for a list of differences), it is similar enough for all the experts to skip this chapter. What? You've never created a DOOM map? Never heard of DEU? Don't know that a DOOM-style door works by raising it's ceiling off the floor? Ok, this chapter here's for you. First off, let me explain that I've created quite a few DOOM maps. Thus if I take some things for granted you don't know about, please write me and ask! That way I'll be able to work it into this chapter, making it easier to understand. 3.2 The basics Let's start by taking a look at the basics behind map building. Do yourself a favour and don't skip this section! I know many of you have met computers through Windoze or some other GUI toy and don't know much about the underlying intricacies of your system, but please - the more you know about how Duke3D works, the better your maps will be. Besides, it's fun to learn things :) 3.2.1 *Differences between the Build and DOOM engines* Those of you who don't know DOOM (gasp!), feel free to skip this section. The Build engine is the system used to create Duke Nukem 3D. Here's a list of the improvements over DOOM: * Looking up and down Finally, you can accurately shoot an RPG through an upper-story window without needing a target in the window. * Rooms above rooms (even if you can't display them) Build real spiral staircases and crossing corridors. * Mirrors See your enemies around corners. * Multi-colored lights Great ambience effects. * Moving/rotating sectors This is in my opinion (no, it's not humble) the best improvement. It allows you to build subways, real doors, moving stairways, squeeze through rotating gears, survive (?) earthquakes, drive around in vehicles...the possibilities are simply endless. * Transparent sprites Build ghosts and proper windows. * Flying via jetpack Fly about, attack your opponents from above. Very useful as a long drop can now kill you. * Underwater diving The obvious extension to the flying capability. Explore an underwater world, fight sharks :) * Sloping floors and ceilings This adds no end of realism! Finally, we can have sloping corridors, pyramid-shaped buildings, real domes... * Rotated sprites Doesn't seem like much, but a rotated sprite marked as 'blocking movement' can be used as a floor - and thus we can fake bridges! * Blastable walls A very nice touch - it allows you to blow (predefined) holes in walls. * Interactive Environment Bullet holes appear in walls, bottles burst into splinters, bloody footsteps lead away from corpses, window panel burst apart...fun. * SVGA support If your system can take it. Looks good, but in my eyes not so important. * Highly customizable Very nice, this. You can write your own opponent-AI, very easily add new sounds and graphics, and change the weapons simply by editing an ASCII file. 3.2.2 Useful cheats for testing levels Read the Duke Nukem FAQ for a list of all cheats. Here are just the codes I find myself using while testing a level: DNRATE Display the fps meter in the top left. DNCOORDS Shows your cordinates. DNSHOWMAP Show the full map. DNDEBUG Shows some interesting info in the top left. ## Anybody know what it means? Could be real useful. DNCLIP Toggle clipping. This will kill you if you walk into empty space, so use it only to quickly walk through doors and the like. DNKROZ Toggle God mode. DNUNLOCK Unlock all doors on the level. DNWEAPONS Give all weapons but no items or keys. DNITEMS Give all items and keys. DNSTUFF Gives everything. 3.2.3 What a map consists of Maps are made up of sectors (rooms), walls and sprites. 3.2.3.1 Sectors The map itself is basically just a collection of sectors. A sector is a room consisting of a floor, a ceiling and walls. Imaging a square column, looking like this: __________ |\ \ | \ \ | \__________\ \ | | Top block: Roof . \ | | . \|__________| . . . . . . . . ___________ . Player area |\ . \ . | \ . \ . | \__________\ \ | | \ | | Bottom block: Floor \|__________| The lower block is the floor, the upper block is the roof, and the player moves about in the missing bit in the middle. The edges are walls, although it's possible to make a wall intangible to the player, allowing him to cross it into another sector. Sectors can share borders with other sectors, and can include other sectors as well. Thus a room with a crate standing in the middle would consist of two sectors: The room itself, with a square sector (the crate) inside it. The crate sector would have the same ceiling height as the room, but with a slightly raised floor (forming the crate): the player can hop onto the crate, but he can't walk below it. The walls of the sector making up the crate would be intangible (invisible and not blocking player movement), otherwise it would look like a column instead. This also explains why we can't have real bridges: if we raise the floor of the bridge sector high enough, the bottom block will elongate upwards until we have a wall instead. Of course, seen from above sectors can have any shape: square, rectangular, round or kidney-shaped. 3.2.3.2 *Walls* Walls come in two flavours: one-sided and two-sided. Imagine carving a dungeon out of a mountain. So far you have dug two rooms, connected by a tunnel. This would translate into three sectors; two big ones connected by a smaller one: _________________________ / | ________________ / .______. | Key: | * <- The player . . | | 1-sided wall \ .------. | . 2-sided wall \ | |_______________| \________________________| (seen from above) Obviously, the outer walls have only one side, since they consist of solid rock. But the borders between the two big sectors and the small one are two-sided walls - you can walk on both sides of them. 3.2.3.3 Textures Textures are what a wall, a floor or the ceiling actually looks like. They make the difference between a wall looking like a brick wall or a steel slab. You can also texture a floor or the ceiling. Duke has quite a lot of textures for us, ranging from plush red wall-to-wall carpeting to green alien slime. Some textures are even animated, meaning they look as if they were moving - water is a nice example of this. Textures always make me feel a bit like a magician - with a wave of my wand (ok: mouse) I can change a wall from flimsy straw to solid steel and back. 3.2.3.4 Sprites Sprites are all the objects in Duke3D: the flower pot in the corner, the switch on the wall, the alien lurking behind you - even the player is a sprite. A sprite is always flat and two-dimensional, like a piece of paper. Even a 3D-looking alien is just a sprite: Duke3D simply shows you different sprites according to from where you're looking at the alien. Sprites exist in three forms: Standing up This sprite always faces you, looking nice and solid. A flower pot or a bottle is a typical example. Flat This sprite actually behaves like a painted piece of paper. They look weird standing in the middle of a room, so they are usually pasted on the walls (like switches or posters). Lying down These sprites are also flat, but they're lying on the ground (or hanging on the roof) instead. An example are the magazines scattered on the ground in the Red Light District (E1L2). Sprites can block movement and can be placed at any height. Thus it is possible (using sprites lying down) to create real 3D functions like bridges out of sprites.