User:Mesilliac

From The Battle for Wesnoth Wiki

a.k.a. Yobbo

Terrain WML Cleanup Proposal

I've been working a lot recently with the Terrain WML system, and I've spotted many, many things which could be tidied up. I've also been forced to learn first-hand how complicated the system is for adding a new terrain. I think Wesnoth is missing out on good terrain simply because potential terrain artists are unable to grasp the complexities of the terrain graphics system.

Nothing that I'm proposing will break the old system. User-made campaigns will still be able to use the old terrain-graphics system and macros. However new content will be able to be added much more easily, and current mainline terrains will become significantly easier to maintain.

Terrain Macros

Current system

Important terrain macros are currently interspersed between a variety of .cfg files in data/core/terrain-graphics and the _final.cfg file that declares all the terrains.

Proposed change

Move the macros to data/core/terrain-graphics/macros, and modify data/core/_main.cfg slightly to load all macros in this directory first.

Benefits

  • Easier to maintain, as macros are separated from terrain declarations
  • Terrain declarations can be moved to separate .cfg files in stead of all being in _final.cfg

Drawbacks

none

Randomly chosen images

Randomly chosen images are currently specified using macros which take a probability value and may or may not draw the terrain depending on this probability. For example:

{TERRAIN_BASE_PROB  Uu                  cave/floor2		       20}
{TERRAIN_BASE_PROB  Uu                  cave/floor3		       25}
{TERRAIN_BASE_PROB  Uu                  cave/floor4		       33}
{TERRAIN_BASE_PROB  Uu                  cave/floor5		       50}
{TERRAIN_BASE       Uu                  cave/floor6}

This gives an equal probability of each listed variation appearing on any given hex.

The great thing about this system is that it can be set up so that it still gives equal probabilities even if one or more of the initially specified graphics are missing.

Current system

All random terrain variations must be explicitly specified and a probability given in _final.cfg.

Proposed change

In new macros, add the probability macros for equal probability automatically, using the image stem plus the numbers 1-9 for additional variations.

Benefits

  • This naming system follows the current naming system, and the old system of selecting probabilities may still be used.
  • New variations can be dropped in alongside current variations and they will automatically be used, with no editing of WML necessary

Drawbacks

Checks for the existance of many nonexistant images

Standard set of terrain graphics macros

There is not currently a standard set of macros which can be used to add new terrains. Any artists wishing to add a new terrain must fully learn the complexities of the terrain WML system. Also, adding a new terrain to mainline requires editing macros in many separate places in _final.cfg.

Current system

Macros are added as necessary.

Proposed change

The addition of a set of standard macros for common terrain types:

Base Terrain
Normal single-hex flat terrain.
Examples in current terrain
dirt, water, grass, sand
Defining features
  • Generic transitions are used if present.
  • Variations are used if present.
  • Only one base terrain can be used per tile
  • Only one base transition can be drawn for each edge of the tile
  • Image dimensions are 72x72
Macro arguments
Terrain_identifier, Dissimilar_terrains, base_image_name, layer
Basic image set
1 base image, 6 transitions

All terrain types should specify a base terrain.

Single-Hex Overlay
Terrain used as an overlay for a single hex
Examples in current terrain
forest, mushroom grove with lightbeam (double overlay)
Defining features
  • Transitions are not used
  • Variations are used if present
  • A "-small" variation should be provided for use next to terrains to avoid overlapping, for example castles, cavewall
  • Image dimensions are 180x252
Macro arguments
Overlay_identifier, base_overlay_image_name, layer
Basic image set
1 base overlay, 1 small overlay
Fence
Draws walls along edges of a terrain
Examples in current terrain
castle, keep, cavewall
Defining features
  • Variations are used if present
  • Only one fence image can be drawn for each point where 3 tiles meet
Macro arguments
terrain_identifier, base_fence_image_name
Basic image set
6 concave corners, 6 convex corners
Path
Directional terrain, that only makes sense in lines. Joins to certain terrain types.
Examples in current terrain
bridge
Defining features
  • Not required to make sense in clumps
  • Only transitions to certain terrain types are used
  • Variations are used if present
  • image dimensions are 180x252
Macro arguments
bridge_identifier, joiner_terrain_identifier bridge_overlay_image_name, layer
Basic image set
1 lone image, 6 end images, 3 across images, 6 bend images
This page was last edited on 6 April 2008, at 01:11.