coding:wolf4sdl:builtinfeatures

How do I enable the built-in features like High Resolution Textures or Cloudy Skies?

Wolf4SDL comes with several features already added to the Wolf3D engine. These features, called Feature Flags, include:

  • Feature Flags
    Enables using tiles on the map to activate other features listed here. Details are included at the bottom of the WL_DEF.H file.
  • Shading effects
    Rooms are darker the further away you are.
  • Directional Sprites
    The ability to define objects that do not rotate with the Player's view.
  • Floor and Ceiling Textures
    Enables the use of texture sprites on the floor and roof of levels, allowing for more detailed visuals.
  • High Resolution Graphics
    Enable the use of 128×128 sprites and textures (Instead of 64×64).
  • Parallaxing Skies
    Skies like in Doom, simulates a skybox.
  • Cloudy Skies
    Generated clouds in levels.
  • Starry Skies
    Generated night sky.
  • Rain and Snow
    Randomly generated particle effects.

These elements aren't enabled in the default build of Wolf4SDL though, and need to be activated first.

This assumes you've started a new project in Code::Blocks that successfully builds. If you haven't yet, then click here to start.

Navigate to VERSION.H in your project, and look for the following lines.

//#define USE_FEATUREFLAGS    // Enables the level feature flags (see bottom of wl_def.h)
//#define USE_SHADING         // Enables shading support (see wl_shade.cpp)
//#define USE_DIR3DSPR        // Enables directional 3d sprites (see wl_dir3dspr.cpp)
//#define USE_FLOORCEILINGTEX // Enables floor and ceiling textures stored in the third mapplane (see wl_floorceiling.cpp)
//#define USE_HIRES           // Enables high resolution textures/sprites (128x128)
//#define USE_PARALLAX 16     // Enables parallax sky with 16 textures per sky (see wl_parallax.cpp)
//#define USE_SKYWALLPARALLAX 16 // Enables parallax sky on walls with 16 repeats of sky texture
//#define USE_CLOUDSKY        // Enables cloud sky support (see wl_cloudsky.cpp)
//#define USE_STARSKY         // Enables star sky support (see wl_atmos.cpp)
//#define USE_RAIN            // Enables rain support (see wl_atmos.cpp)
//#define USE_SNOW            // Enables snow support (see wl_atmos.cpp)
//#define FIXRAINSNOWLEAKS    // Enables leaking ceilings fix (by Adam Biser, only needed if maps with rain/snow and ceilings exist)

Assuming you want to use all the core feature flags (except for parallaxing skies), you would uncomment the lines (remove the //) for USE_FEATUREFLAGS, USE_SHADING, USE_CLOUDSKY, USE_STARSKY, USE_RAIN and USE_SNOW.

Some of the above features require extra files, which are included in the download for Wolf4SDL, but not yet made a part of the project to compile.

Feature Files required
USE_SHADING WL_SHADE.CPP
WL_SHADE.H
USE_DIR3DSPR WL_DIR3DSPR.CPP
USE_FLOORCEILINGTEX WL_FLOORCEILING.CPP
USE_PARALLAX WL_PARALLAX.CPP
USE_CLOUDSKY WL_CLOUDSKY.CPP
WL_CLOUDSKY.H
USE_STARSKY WL_ATMOS.CPP
WL_ATMOS.H
USE_RAIN WL_ATMOS.CPP
WL_ATMOS.H
USE_SNOW WL_ATMOS.CPP
WL_ATMOS.H

To add the required files to your project, go to ProjectAdd Files, and select them. Make sure to save your project so it remembers those files were added!

Once you've set everything up, compile your exe file by going to BuildBuild. If all the steps were followed, it should be successful!

You will still need to make other changes to your game files to take advantage of these features.

By default, Feature Flags check the value of the Walls map plane in the tiles on each corner of the map.

When the level loads, it checks the value of these tiles to learn what effects it needs to load, and then changes the tile to match adjacent walls.

Tile Effect
Top Right (63,0) Feature Flags: This is the main tile, deciding what sky effect will be used.
Top Left (0,0) Shade Definition: The lower 8-bit plane will decide the type of shading effect used, if any.
Bottom Left (0,63) Cloudy Sky ID/ParallaxStartTexture: If either Cloudy Sky or Parallaxing Skies are triggered by the Feature Flags tile, this tile will either specify the type of cloudy sky or the first texture for the Parallaxing Sky to use
Bottom Right (63,63) This tile is unused. Ignore it.

The Top Left and Bottom Left values are largely dynamic and will be dependant on personal finetuning of the Shading, Cloudy Sky or Parallaxing Sky features.

The Top Right tile needs specific values to function, however, as it triggers specific items.

Tile Value Feature
0 Nothing No Feature Flag will be active on this map
1 Starry Sky
2 Parallaxing Sky
4 Cloudy Sky
16 Rain
32 Snow

So if you wanted to have Starry Sky, you would put a Grey Brick 1 wall in the Top Right tile. Cloudy Sky would require a Grey brick / Hitler wall tile.

You can also combine effects by simply adding the numbers together. If you want Starry Sky and Rain, you would add their values together (1 + 16) and place the appropriate tile (In this case, 17 is Red Brick).

Build your source code, and compile your map changes. Assuming the Feature Flags are successfully turned on in your game executible, you should now have sky and environmental effects in your maps!

  • coding/wolf4sdl/builtinfeatures.txt
  • Last modified: 2020/03/26 00:22
  • by zombie