Enabling Feature Flags (High Resolution Textures, Cloudy Skies, etc)

Wolf4SDL comes with several extra features implemented into the 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.

While these features are coded into the game, they aren't activated by default, so initial compiling of the source code will work without edited files. However, they are simple to activate and use.

This assumes you've started a new Wolf4SDL project 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.c)
//#define USE_DIR3DSPR        // Enables directional 3d sprites
//#define USE_FLOORCEILINGTEX // Enables texture-mapped floors and ceilings (see wl_plane.c)
//#define USE_MULTIFLATS      // Enables floor and ceiling textures stored in the third mapplane
//#define USE_PARALLAX 16     // Enables parallax sky with 16 textures per sky (see wl_parallax.c)
//#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.c)
//#define USE_STARSKY         // Enables star sky support (see wl_atmos.c)
//#define USE_RAIN            // Enables rain support (see wl_atmos.c)
//#define USE_SNOW            // Enables snow support (see wl_atmos.c)
//#define FIXRAINSNOWLEAKS    // Enables leaking ceilings fix
//#define VIEWMAP             // Enables the overhead map
//#define REVEALMAP           // Enables showing only the areas of the overhead map that have been seen

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

Note: If you are using an old version of Wolf4SDL in Code::Blocks (It uses .CPP files instead) then this section of code will look slightly different. These older versions may also require you to manually add additional files to the project for each feature. These are mentioned in the commented section of any feature that requires this step.

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 uncommented the lines for features you want to implement (and added files to the project if required), you should be able to compile your source code.

Some of the features in the list will require additional changes to the game files to be able to run. For example, Parallaxing Skies will need graphics to use for the visuals of the sky itself.

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

feature flags

When the level loads, the game checks what value each of these tiles are, and uses that information to implement the appropriate feature flag.

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 flexible and will be dependant on personal finetuning of the Shading, Cloudy Sky or Parallaxing Sky features within your project.

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

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).

Feature Flags

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!