cDuke3D

The Experimental Windows Duke3D port by Colourless

Experimental?

cDuke3D is classed as Experimental because I use cDuke3D to experiment with. I make no promises with regards to the stability of the features of cDuke3D. While cDuke3D does contain a number of special features that may or may not be in other ports, it may be missing a variety of features of other ports or they just might be unstable. Networking for example, while cDuke3D does have some networking abilities, I can't say it's tested very well.

Special Features

cBUILD Features

Download

cDuke3D V1.5.1 and cBUILD Windows Binaries and Source: cduke3d151.zip 1305 KB

Modified E3L1 (Raw Meat) for Transparent Water: e3l1_t.zip 39KB

Example Sector over Sector Map: fof.zip 4 KB

Screenshots

Sector Over Sector

Voxels

User Maps Menu

Using Voxels in cDuke3D

Using Voxels in cDuke3D is very simple. Included with cDuke3D is VOXEL.CON. This CON is used to map KVX files to sprites. It's format is very simple to use. The file already has 1 voxel definition that will use the SWITCH2 kvx files from Shadow Warrior and replace one of the switches in Duke3D (860-861) with it. This is only an example, but adding your own voxels is as simple as modifying the CON file and putting the KVX file in your Duke3D directory.

Using cDuke3D Sector over Sector

If you've used Sector over Sector in Shadow Warrior then using Sector over Sector in cDuke3D should be very easy as things are reasonably similar.

The first thing to do is to make your upper and lower levels, sort of as if they are under and over water sections. The sectors that you can see through must be exactly the same size, and if there are more than one sector you can see through in each level, they must be in exactly the same position relative local to each other. The floors of the sectors in the upper level and the ceiling in the lower level should also be at the same relative heights.

Much like in Shadow Warrior, and Sector that is able to see into the other level must be over/under a sector in the other levels. You can NOT view into the other level when in a sector that is under/over NULL space. In order for wall texturing to work as you'd expect, when creating sectors where there would be NULL space, place the ceiling and floor at the same height. If in the upper level, make these at the height of the floor with the FOF or Transparent tiles. Alternatively for the lower level, make the NULL space sectors have their ceilings and floors at the height of the ceilings with FOF or Transparent tiles.

When creating Sector over Sector areas you need to be able to actually see through the floor and ceiling. Normal tiles will of course block your view so you either need a tile that wont be drawn, or make the tile masked or transparent. A tile that will never be drawn is the FOF (Floor over Floor) tile. The FOF tile can be thought of as the same thing as the FLOORMIRROR tile in Shadow Warrior. The number for the FOF tile in cDuke3D is 562. This is 2 after the MIRROR tile.

However unlike in Shadow Warrior, creating Transparent and Masked floors/ceilings is done differently. To do it in cDuk3D you will need to use cBUILD to make your levels. cBUILD is just a version of BUILD with a few modifications for Sector over Sector construction. To create a Masked/Transparent floor/ceiling you just have to select the tile you want your floor/ceiling to have. Once you selected the tile, in 3D view have your mouse cursor over the floor/ceiling and press 'T' to toggle between Masked, 33% Transparent, 66% Transparent and Normal. Other versions of BUILD will not let you set the Transparency of floors and ceilings. It should be noted that you should NOT use 'T' on floors and ceiling that you don't want to see through. You will get Hall of Mirrors otherwise. You should also note that you can not make sloped floors and ceiling transparent or masked. If you want to do a sloped Sector over Sector you must used the FOF tile.

Also, unlike Shadow Warrior, at this time moving between the Upper and Lower levels can only be done using the TRANSPORTER (Lotag 7) Sector Effector or elevators. It is not automatic. This does have a number of problems, but obviously it works fine for transparent water. In a future version of cDuke3D this may be improved.

Included with cDuke3D is cBUILD. As already mentioned above you can now use 'T' to set the transparency options of Floors and Ceilings. However, there is also one very useful addition for when using Sector over Sector. Pressing number '3' on the keyboard (not the numpad) will toggle 'Sector over Sector Preview Mode'. This mode works exactly the same as in game, so if things work in preview, it should be fine in game. You probably shouldn't modify things in 'Sector over Sector Preview Mode' however, as chances are you will change the wrong thing. So, just remember turn it off before making any changes.

You can create more sophisticated Sector over Sector effects with cDuke3D than you could in Shadow Warrior. This is because the FOF_VIEW_THRU_FLOOR (Lotag 42) and FOF_VIEW_THRU_CEILING (Lotag 43) Sector Effectors will draw each sector twice, once with the floor lowered/ceiling raised and a second time with them restored to the correct height. This means that you are able to see the floors of the upper sectors in the lower sectors and the ceilings of the lower sectors from the upper sectors. However, I have noticed that this doesn't always work as you'd expect, so you are likely going to have to play around with the various Sector Effectors to get things to work exactly as you'd like. You should be able to see from the modified E3L1 (Raw Meat) that Sector over Sector can work very will if you know what you are doing.

There are 2 example maps for Sector over Sector. The first one is FOF.MAP. This is a fairly simple map. It contains a basic transparent water section, and another more sophisticated Sector Over Section section that attempts to show construction of a multi-level area with a ramp connecting both levels and moving between them using TRANSPORTER (Lotag 7) Sector Effectors. This area doesn't work quite as well as I would have liked.

The second example map is the modified E3L1 (Raw Meat) map. This map shows how Sector over Sector can be used to create transparent water on a very large scale.

FOF Sector Effector Reference

Lotag 40 FOF_UPPER_LEVEL
   
Hitag Match Tag
Angle < 1024 then the match height is the floor of the sector this Sector Effector is in
>= 1024 then the match hight is the height of this Sector Effector
The FOF_UPPER_LEVEL Sector Effector is used to define the match point for the upper lower. Only 1 FOF_UPPER_LEVEL must be used per FOF set.  The FOF_UPPER_LEVEL and FOF_LOWER_LEVEL must be placed in the same relative place in the upper and lower levels. If the FOF_UPPER_LEVEL and FOF_LOWER_LEVEL Sector Effectors both have Angles less than 1024 then the floor of the upper level will be placed at the same height as the ceiling of the lower levels.

SEE ALSO:  FOF_LOWER_LEVEL (Lotag 41)
FOF_VIEW_THRU_FLOOR (Lotag 42)
FOF_VIEW_THRU_CEILING (Lotag 43)
FOF_VIEW_THRU_FLOOR_NO_DROP (Lotag 44)
FOF_VIEW_THRU_CEILING_NO_RAISE (Lotag 45)

 

Lotag 41 FOF_LOWER_LEVEL
   
Hitag Match Tag
Angle < 1024 then the match height is the ceiling of the sector this Sector Effector is in
>= 1024 then the match hight is the height of this Sector Effector
The FOF_LOWER_LEVEL Sector Effector is used to define the match point for the lower level. Only 1 FOF_LOWER_LEVEL must be used per FOF set. The FOF_LOWER_LEVEL and FOF_LOWER_LEVEL must be placed in the same relative place in the upper and lower levels. If the FOF_UPPER_LEVEL and FOF_LOWER_LEVEL Sector Effectors both have Angles less than 1024 then the floor of the upper level will be placed at the same height as the ceiling of the lower levels.

SEE ALSO: FOF_UPPER_LEVEL (Lotag 40)
FOF_VIEW_THRU_FLOOR (Lotag 42)
FOF_VIEW_THRU_CEILING (Lotag 43)
FOF_VIEW_THRU_FLOOR_NO_DROP (Lotag 44)
FOF_VIEW_THRU_CEILING_NO_RAISE (Lotag 45)

 

Lotag 42 FOF_VIEW_THRU_FLOOR
   
Hitag Match Tag
Angle Must be 512 (directly south) to be active.
Any other angle will cause this to be inactive
Place FOF_VIEW_THRU_FLOOR Sector Effectors in every sector the upper level that is able to see into the lower level through the floor and are over sectors in the lower level that are able to see the upper level. When in the lower level viewing into the upper level, the FOF_VIEW_THRU_FLOOR Sector Effector will cause the sector to be drawn twice. Once with the floor dropped really low, and the second time with the floor at the normal location. This is for visibility reasons. If the floor is not dropped, a hall of mirrors effect will be seen when in sectors in the lower level that would be blocked by sectors in the upper level.

SEE ALSO: FOF_UPPER_LEVEL (Lotag 40)
FOF_LOWER_LEVEL (Lotag 41)
FOF_VIEW_THRU_CEILING (Lotag 43)
FOF_VIEW_THRU_FLOOR_NO_DROP (Lotag 44)
FOF_VIEW_THRU_CEILING_NO_RAISE (Lotag 45)

 

Lotag 43 FOF_VIEW_THRU_CEILING
   
Hitag Match Tag
Angle Must be 512 (directly south) to be active.
Any other angle will cause this to be inactive
Place FOF_VIEW_THRU_CEILING Sector Effectors in every sector in the lower level that is able to see into the upper level through the ceiling and are under sectors in the upper level that are able to see the lower level. When in the upper level viewing into the lower level, the FOF_VIEW_THRU_CEILING Sector Effector will cause the sector to be drawn twice. Once with the ceiling raised really high, and the second time with the ceiling at the normal location. This is for visibility reasons. If the ceiling is not raised, a hall of mirrors effect will be seen in sectors in the upper level that would be blocked by sectors in the lower level.

SEE ALSO: FOF_UPPER_LEVEL (Lotag 40)
FOF_LOWER_LEVEL (Lotag 41)
FOF_VIEW_THRU_FLOOR (Lotag 42)
FOF_VIEW_THRU_FLOOR_NO_DROP (Lotag 44)
FOF_VIEW_THRU_CEILING_NO_RAISE (Lotag 45)

 

Lotag 44 FOF_VIEW_THRU_FLOOR_NO_DROP
   
Hitag Match Tag
Angle Must be 512 (directly south) to be active.
Any other angle will cause this to be inactive
The FOF_VIEW_THRU_FLOOR_NO_DROP Sector Effectors is very similar to FOF_VIEW_THRU_FLOOR except for one difference. Unlike FOF_VIEW_THRU_FLOOR, the FOF_VIEW_THRU_FLOOR_NO_DROP Sector Effector will not drop the floor when drawing. Use this Sector Effector with care. It should only be used in Sectors that would normally be over NULL space in the lower level.

SEE ALSO: FOF_UPPER_LEVEL (Lotag 40)
FOF_LOWER_LEVEL (Lotag 41)
FOF_VIEW_THRU_FLOOR (Lotag 42)
FOF_VIEW_THRU_CEILING (Lotag 43)
FOF_VIEW_THRU_CEILING_NO_RAISE (Lotag 45)

 

Lotag 45 FOF_VIEW_THRU_CEILING_NO_RAISE
   
Hitag Match Tag
Angle Must be 512 (directly south) to be active.
Any other angle will cause this to be inactive
The FOF_VIEW_THRU_CEILING_NO_RAISE Sector Effectors is very similar to FOF_VIEW_THRU_CEILING except for one difference. Unlike FOF_VIEW_THRU_CEILING , the FOF_VIEW_THRU_CEILING_NO_RAISE Sector Effector will not raise the ceiling when drawing. Use this Sector Effector with care. It should only be used in Sectors that would normally be under NULL space in the upper level.

SEE ALSO: FOF_UPPER_LEVEL (Lotag 40)
FOF_LOWER_LEVEL (Lotag 41)
FOF_VIEW_THRU_FLOOR (Lotag 42)
FOF_VIEW_THRU_CEILING (Lotag 43)
FOF_VIEW_THRU_FLOOR_NO_DROP (Lotag 44)

Adding Voxel support in other Duke3D ports

Adding Voxel Support is fairly simple. Firstly you need load the Voxel Files (KVX) and map them files to the tiles. I did this by modifying the CON file handling. I added an extra keyword and modified things so VOXEL.CON would be loaded. It needs to be noted that Voxels MUST be loaded after loadpics() has been called. Normal CON file handling is done will before loadpics() has been called. As you would note in my sources, I call the function loadvox() after loadpics() in the Startup() function in game.c. The code to handle the definevoxel CON keyword in gamedef.c (just search for BEGIN VOXEL STUFF) will load the KVX files and will fill the picnumtovox[] array which is used to map the tiles to voxel indices.

Additionally after you have created an array like picnumtovox[], you then need to actually get the buildengine to use the Voxel for the sprites. You do with in the animatesprites() functions in game.c. Just search for BEGIN VOXEL STUFF to see exactly what you need to do. It's not much, just change the picnum of the sprite and change the cstat flags for the sprite. In case you are worried, doing this in animatesprites() will NOT permanently change the sprites picnum so you will not have problems there. You should realize though, there could be some unpredictable behaviour in my code though since the picnum get changed and the animatesprites() code may still attempt to incorrectly animate the sprite.

Adding Sector Over Sector support in other Duke3D ports

Adding Sector Over Sector support is not extremely difficult as most of the code is already there. However, a few changes need to be made to make things compatible with my code, and also to fix a bug the causes things to not work properly.

Firstly, in the spawn() function in game.c (warning this function is HUGE) there is code for loading Sector Effectors (case SECTOREFFECTOR:). Right near the end of this case just before the SEENINE and OOZFILTER cases, there is a switch for the sprite[i].lotag. This should have a set of cases for numbers 40,41,43,44 and 45. You will need to add a case for 42 in there as well.

Now, with that done, Sector Over Sector will now mostly work, but it wont be entirely compatible with my code, nor will you be able to use transparent floors and ceilings. Now what needs to modified is the SE40_Draw() function code. Rather than explain exactly the changes required to the function, I will just say copy my code over yours and then you'll be ok to go. You'll have functional Sector over Sector code... or at least as functional as mine is.

Contact Colourless

3D Realms Duke3D Source Forum: Colourless
Email/MSN: colourles@users.sourceforge.net
ICQ: 9421058 (Colourless)