Compatibility-breaking changes between 1.12 and 1.13/1.14

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
Development Team
Battle for Wesnoth
Location: #wesnoth @

Compatibility-breaking changes between 1.12 and 1.13/1.14

Post by Development Team » November 18th, 2017, 5:34 pm

The thread for changes from 1.10 to 1.12 is here.

Deprecated or removed feature:
  • The FOREACH macro is deprecated, use [for] instead
  • The ABILITY_LEADERSHIP_LEVEL_1..5 macros are deprecated and are now aliases for the new more general ABILITY_LEADERSHIP macro.
  • The ~BRIGHTEN() (which was misdocumented as ~LIGHTEN()) and ~DARKEN() Image Path Functions have been removed.
  • The backstab= key in weapon specials is deprecated; use [filter_adjacent] instead
  • The share_view and share_maps keys in [side] are replaced with share_vision, which has possible values all, shroud, none.
  • The current_player key in [side] is effectively replaced with side_name. (The current_player key still exists in [store_side], but has little meaning for non-MP games.)
  • scenario_generation=cave, that is the built-in cave map generator is now deprecated and will be removed in 1.14 or 1.15. Scenarios that previously used it should change to the new Lua cave map generator. To do this, use map_generation=lua with create_map = << return wesnoth.require("lua/cave_map_generator.lua").generate_map(...) >>.
  • The [advance] tag in [modifications] was changed to [advancement].
  • The SOUND:SLOWand SOUND:POISON macros should no longer be used, because sounds for poisoning, slowing and petrifying no longer need to be played by attack animations; instead, they are defined globally in [game_config] [sounds] [status].
Changes to WML interface and behavior:
  • map_generation in [multiplayer] now behaves the same way as in [scenario], that is, it creates only the map instead of the whole scenairo, so generate the whole scenario scenario_generation has to be used
  • The WML preprocessor now issues warnings to stderr when redefining macros without undefining them first with #undef.
  • moveto and enter_hex, exit_hex event no longer abort the movement, [cancel_action] must be used to cancel the current move.
  • [filter_vision] fix regarding [hides] abilities.
  • [endlevel] no longer silently kills 0-hp units, so if a last breath event declares victory/defeat, a following die event matching the dying unit didn't trigger in 1.12 but will trigger in 1.13.
  • DescriptionWML for menu options.
  • The menu item syntax (e.g. &image.png=Peasant=Easy) in campaign difficulty and in [message][option] is now deprecated
  • Variable names with spaces in them are now explicitly not supported.
  • In [set_variable], value="true"will set the variable to "yes", while value="false" will set the variable to "no". This is due to the fact that said tag was ported to Lua, and depends on how Lua handles internally these values.
  • By default, tunnels now allow fog and shroud to be cleared through them. If you wish to restore the original behaviour, you can add allow_vision=no to the [tunnel] tag.
  • Wesnoth doesn't allow special characters like ,?;:'" in unit type ids anymore.
  • The allow_new_game= attribute in [scenario] now defaults to false (it still defaults to true in [multiplayer]) .
  • In GUI2 dialogs/widgets [resolution] window_width/height now specifies the minimum window size for that resolution to be chosen.
  • If ai_algorithm is used in [modify_side][ai], it now replaces the whole AI with the contents of [modify_side][ai], instead of appending these parameters.
  • the controller property of sides (for example lua side proxies) can no longer have the values network and network_ai, instead the is_local property to check whether a side is local or not.

Lua API changes:
  • The wesnoth.put_unit function now takes the unit as its first argument, followed by an optional location. Use wesnoth.erase_unit instead if you want to remove a unit from the map.
  • wesnoth.select_hex is now deprecated. wesnoth.highlight_hex is no longer deprecated, but its behaviour has changed - it highlights the hex only (as if the mouse was moved over it), without selecting any unit that's on the hex. To select a unit, use wesnoth.select_unit.
  • The AI functions that return aspects are deprecated. This includes functions such as ai.get_aggression(), ai.get_caution(), etc. Instead, you should use the ai.aspects table to look up aspects - eg ai.aspects.aggression, ai.aspects.caution, etc. Functions that do not return aspects, such as ai.get_targets() or ai.get_goals(), are not deprecated. In addition, ai.get_attacks() is not deprecated, as it returns not just the attacks aspect but a full analysis of all the attacks allowed by the attacks aspect; ai.aspects.attacks, on the other hand, simply evaluates the aspect and returns an unprocessed list of the allowed units.
  • wesnoth.get_unit([i]underlying_id[/i]) was removed.
  • The metatables used by the helper.lua module are now protected from external access. If anyone used getmetatable() to alter these metatables, their code will no longer work. (You shouldn't have been doing that in the first place, though.)
  • Reading global lua variables without writing to them first will now give an error, this help people finding spelling mistakes in their code. But iut also means code like my_global_var = my_global_var or 1 will no longer work, do so this you ahve to use rawget (my_global_var = rawget(_G, "my_global_var") or 1)
  • Core portraits are no longer split into a small version with black background and a transparent version; instead of having both portraits/race/unit.png and portraits/race/transparent/unit.png, there is now only portraits/race/unit.png.

Note: This list doesn't necessarily contain every conceivable change that could prove relevant in some cases, such as:
  • All removed or changed images or sounds.
  • Simple changes to unit stats, such as balancing changes.
  • Changes to internals of core macros, [unit_type]s or similar, which add-ons can but usually shouldn't make assumptions about.
If you know of any other compatibility breaking change, please post them below!

Posts: 935
Joined: February 10th, 2013, 2:25 pm

Re: Compatibility-breaking changes between 1.12 and 1.13/1.1

Post by gfgtdf » December 25th, 2017, 6:40 pm

Ravana wrote:Lua uses strict globals viewtopic.php?f=2&t=41481.
added to the list, what i did min my addon is create a globals variable

Code: Select all

globals = {}
setmetatable(globals, {
	["__index"] = function(t, k)
		return rawget(_G, k)
	["__newindex"] = function(t, k, v)
		_G[k] = v
that can be used to get an unchecked access to global variables. (a = my_gloval_varwoudl then become a = globals.my_gloval_var if you cannot be sure whether my_gloval_var was initilised at theat point.)
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.

User avatar
Posts: 1385
Joined: October 10th, 2016, 3:06 am

Re: Compatibility-breaking changes between 1.12 and 1.13/1.1

Post by The_Gnat » December 27th, 2017, 1:01 am

If ai_algorithm is used in [modify_side][ai], it now replaces the whole AI with the contents of [modify_side][ai], instead of appending these parameters.
So is there anyway to append the contents of the AI, or modify a certain aspect without replacing others?

Posts: 998
Joined: October 13th, 2010, 6:14 pm
Location: Wandering, mostly aimlessly

Re: Compatibility-breaking changes between 1.12 and 1.13/1.1

Post by mattsc » December 27th, 2017, 3:01 pm

The_Gnat wrote:
If ai_algorithm is used in [modify_side][ai], it now replaces the whole AI with the contents of [modify_side][ai], instead of appending these parameters.
So is there anyway to append the contents of the AI, or modify a certain aspect without replacing others?
The quoted statement only applies if you replace the ai algorithm, that is, if you completely switch the AI for a new one (then you start with a clean slate). All other changes, such as adding or changing aspects work as before.

Post Reply