Compatibility-breaking changes between 1.12 and 1.13/1.14

The place to post your WML questions and answers.

Moderator: Forum Moderators

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.
User avatar
Development Team
Battle for Wesnoth
Location: Wesnoth.org
Contact:

Compatibility-breaking changes between 1.12 and 1.13/1.14

Post by Development Team »

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:SLOW and 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].
  • ai.synced_command was removed (use the new wesnoth.invoke_synced_command function instead)
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 scenario, 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. In any other place, it no longer works.
  • 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.
  • The behviour of [terrain_mask] regarding the border has changed.
  • Multiplayer scenario [side] tag must include faction="Custom" to use custom recruit list.

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 it also means code like my_global_var = my_global_var or 1 will no longer work, so to do this you have to use rawget (my_global_var = rawget(_G, "my_global_var") or 1)
Miscellaneous:
  • 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!
Last edited by Ravana on May 29th, 2018, 5:39 pm, edited 2 times in total.
gfgtdf
Developer
Posts: 1431
Joined: February 10th, 2013, 2:25 pm

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

Post by gfgtdf »

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)
	end,
	["__newindex"] = function(t, k, v)
		_G[k] = v
	end,
})
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
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

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

Post by The_Gnat »

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?
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

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

Post by mattsc »

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.
User avatar
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

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

Post by The_Gnat »

Okay thank you for explaining :)
User avatar
Ravana
Forum Moderator
Posts: 2934
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

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

Post by Ravana »

[store_side] colors now return color name not index. viewtopic.php?f=21&t=48082
enclave
Posts: 936
Joined: December 15th, 2007, 8:52 am

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

Post by enclave »

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.)
In my experience side.current_player was side.name
but side.side_name was usually containing this "" (nothing) while side.name doesn't exist at all I believe.
enclave
Posts: 936
Joined: December 15th, 2007, 8:52 am

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

Post by enclave »

khalifate is renamed as dunefolk and all khalifate names renamed too, unit types have double names like "Dune Rider", "Dune Piercer" etc..
That will also cause incompatibility when porting projects from 1.12 into 1.14
User avatar
James_The_Invisible
Posts: 533
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces
Contact:

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

Post by James_The_Invisible »

enclave wrote: May 5th, 2018, 10:06 am khalifate is renamed as dunefolk and all khalifate names renamed too, unit types have double names like "Dune Rider", "Dune Piercer" etc..
That will also cause incompatibility when porting projects from 1.12 into 1.14
That is not completely correct. The old unit types (and race) are still present in 1.14, they are just marked as deprecated. They are only removed for 1.15.
enclave
Posts: 936
Joined: December 15th, 2007, 8:52 am

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

Post by enclave »

Yeah indeed.. possible that they work, I never tried, but the images definitely don't work anymore. So I'm not sure if there was a point to leave them deprecated, if the images are broken (I mean images are broken for custom content, not default... default no idea)
User avatar
James_The_Invisible
Posts: 533
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces
Contact:

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

Post by James_The_Invisible »

The old unit types should use new paths for images as they are based on the new types: https://github.com/wesnoth/wesnoth/blob ... ecated.cfg. You will run into troubles only if your own code refers the old paths.
User avatar
Pentarctagon
Project Manager
Posts: 5496
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

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

Post by Pentarctagon »

enclave wrote: May 5th, 2018, 10:47 am Yeah indeed.. possible that they work, I never tried, but the images definitely don't work anymore. So I'm not sure if there was a point to leave them deprecated, if the images are broken (I mean images are broken for custom content, not default... default no idea)
The new image paths were added to wmllint.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
octalot
General Code Maintainer
Posts: 777
Joined: July 17th, 2010, 7:40 pm
Location: Austria

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

Post by octalot »

For multiplayer scenarios that should have an AI enemy with a fixed recruit list (so survival scenarios), the [side] tag must include faction="Custom". If that key isn't included then a random faction will be chosen, and the side's recruit list will be overwritten with the faction's default recruit list.
User avatar
Ravana
Forum Moderator
Posts: 2934
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

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

Post by Ravana »

MP factions are now alphabetically sorted by name, further discussion is in viewtopic.php?f=21&t=48275.
Post Reply