Difference between revisions of "User:Ayin/Extended terrains proposal"

From The Battle for Wesnoth Wiki
(Description)
(Description: - limits of the proposal)
Line 9: Line 9:
 
* One letter may be available, with different meanings, for both maps (not sure this is a good thing, though).
 
* One letter may be available, with different meanings, for both maps (not sure this is a good thing, though).
 
* Terrains will be a combo of several base terrains. For example, swamp + bridge, forest + village.
 
* Terrains will be a combo of several base terrains. For example, swamp + bridge, forest + village.
 +
 +
Note that, with the current proposal, the overlay and the base part will be totally independant. There will be no way to specify, on an overlay, terrain graphics which depend on the base terrain it is on. This solution is simpler (more in the ''KISS'' spirit), but less powerful than previous 2-letter terrain proposals.
  
 
==Editor UI==
 
==Editor UI==

Revision as of 13:24, 9 October 2005

This is a proposal to implement extended terrain types. The base ideas for this proposals were submitted by Ivanovic and freim.

Description

The idea is that scenarios are now to have 2 (or more?) maps. The “base terrain” map, and the “terrain overlay” map. Then, the terrains defined in [terrain] WML will have another attribute, named, for example, layer, defining the map this terrain applies to. Same for [terrain_graphics] rules: a rule may be defined for a layer, or for another.

This will have the following consequences :

  • One letter may be available, with different meanings, for both maps (not sure this is a good thing, though).
  • Terrains will be a combo of several base terrains. For example, swamp + bridge, forest + village.

Note that, with the current proposal, the overlay and the base part will be totally independant. There will be no way to specify, on an overlay, terrain graphics which depend on the base terrain it is on. This solution is simpler (more in the KISS spirit), but less powerful than previous 2-letter terrain proposals.

Editor UI

The editor UI will need to have 2 lists of terrains on its right pane: a list of “base” terrains, and a list of “overlay” terrains.

Backwards compatibility

To be determined.

Code changes

  • Add the support of multiple maps in map.cpp. In terrain.cpp, there should be 2 classes: terrain_type which describes the base terrain types, and terrain_group which describes a combo of several terrains. terrain_group should have the same methods as base terrains, but be very lightweight as those will need to be created on-the-fly. It may, for example, have char[2] as a data payload. get_terrain_info should return a terrain_group.
  • Fix unit_types.cpp so the defense_modifiers and attack_modifiers work with the new multiple maps. Those methods should not use gamemap:TERRAIN anymore to identify terrain types, but should rather use terrain_group.
  • Most places where gamemap::TERRAIN is used should use terrain_group instead (actions.cpp, unit_display.cpp, reports.cpp, etc.)
  • Modify builder.cpp so it works with the new-style maps (changes to display.cpp may not be necessary if it is done properly).
  • The map generator will need to take those changes into account.
  • The editor is certainly the part which will need the most work, as UI changes will be necessary.