Reset achievements for UMC campaign?

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
Spannerbag
Posts: 538
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Reset achievements for UMC campaign?

Post by Spannerbag »

gnombat wrote: March 19th, 2024, 1:04 pm ...There are some other campaigns which have something like "achievements" but which aren't actually achievements in the Wesnoth sense. You might want to take a look at how they handle things....
  • A New Order
  • A Sanguine Tale
Will take a look, thanks.
I have a few ideas of my own but I'm always happy to steal borrow from other folk. :)

gfgtdf wrote: March 19th, 2024, 11:42 pm
Spannerbag wrote: March 19th, 2024, 10:21 am Ah, hadn't realised that Wesnoth's achievements had to be behaviourally compatible with other platforms...
I mean it doesn't have to be equivalent for technical reasons, but imo most players would simply expect them to behave the same way as they are used to from other platforms.
Yeah, that's what I meant; make them behave as similarly named entities in other platforms behave.

FWIW I'm not a developer so wasn't involved in achievements but I'd've liked to have seen a another facility also to ease, for campaign designers, the addition of in-game "rewards".
These could operate similarly to achievements but are contained within the campaign (like regular WML variables or units).
In each playthrough these "rewards" are always available, regardless of other playthroughs (whether concurrent with this playthrough or not).
No idea if the implementation of these could maybe repurpose some of the achievements code.

That said, I understand that "rewards" can be implemented in others ways (but the same is true of achievements I guess if the designer used persistent variables?).

Anyway, will take a look into the above campaigns and will mull over how best to present the campaign's "rewards" (I've coded the things so may as well leave them in).

Thanks for the clarification.

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Celtic_Minstrel
Developer
Posts: 2236
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Reset achievements for UMC campaign?

Post by Celtic_Minstrel »

Broadly speaking, I believe you're misunderstanding what achievements are. They're something that tracks global state outside of a particular playthrough of a campaign, like "I once defeated the spider in the Dank Tunnels" or "I once managed to have an army with a Sharpshooter, an Avenger, a Marshal, a Champion, an Outrider, a Shyde, a Sylph, an Archmage, a Wisp, a Priest, a High Lord, and a Prowler" or "I once managed to unearth the secret shortcut into the enemy's base".

Once you get the achievement, you have it. The only real reason to reset them would be for the add-on developer to debug them to make sure they work. But of course there are often per-playthrough benefits of the achievement too (though "I once stepped into a fire" doesn't exactly have a benefit), and those are independent of the achievement itself.

I wouldn't mind seeing some kind of interface to reset achievements in Advanced Preferences, as a player may occasionally decide they want to try obtaining them again. But it's definitely not something that should be exposed in the Lua/WML API – from the API's standpoint, an achievement is irrevocable. Once you have it, you can't unhave it. And removing achievements is not something an add-on has any business doing.
Spannerbag wrote: March 19th, 2024, 10:21 am Yep, I've already put a note in the campaign description in _main.cfg:

Completing achievements in this campaign garners in-game bonuses.
At present there is no official way to reset achievements.
However, regardless of whether achievements are already completed or not, when playing this campaign the in-game bonuses will always be obtained when the corresponding achievement condition is satisfied.



So, as 1.18 is feature frozen I'll remove the struck-through text above.
Alternatively, would it be preferable to not portray these in-game bonuses as "achievements" because they can be obtained every time the campaign is played (and so aren't really achievements in the Wesnoth sense)?
For me, the important thing is the bonus repeatability, not completing the achievement.
Would appreciate some opinions here - I don't want to clash with player expectations.
If you ask me, the achievement is a way of remembering "oh, I satisfied this condition once before". Whether or not you have the achievement shouldn't affect what happens if you satisfy the condition again on another playthrough.

Also, by the way…
Spannerbag wrote: March 18th, 2024, 11:14 am [*]As above but for the whole campaign and set within [campaign] tag rather than [achievement].
Could be restricted to type=sp and not mp or hybrid.
Campaigns don't have achievements, so this doesn't make sense. The only thing that can have achievements is an add-on.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Pentarctagon
Project Manager
Posts: 5566
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Reset achievements for UMC campaign?

Post by Pentarctagon »

Celtic_Minstrel wrote: March 23rd, 2024, 4:30 am Also, by the way…
Spannerbag wrote: March 18th, 2024, 11:14 am [*]As above but for the whole campaign and set within [campaign] tag rather than [achievement].
Could be restricted to type=sp and not mp or hybrid.
Campaigns don't have achievements, so this doesn't make sense. The only thing that can have achievements is an add-on.
To expand on this a bit, it's also a technical limitation - you need to know what all the achievements and their current statuses are from even the main menu, before most content has been loaded. So all the achievements.cfg files are loaded entirely separately and earlier than any of the content they're meant to be associated to. So you can't have achievements set within a [campaign] tag (or any other top-level tag) because then Wesnoth wouldn't know about the achievements for that campaign unless you were actively playing that campaign.
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
Spannerbag
Posts: 538
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Reset achievements for UMC campaign?

Post by Spannerbag »

Celtic_Minstrel wrote: March 23rd, 2024, 4:30 am Broadly speaking, I believe you're misunderstanding what achievements are. They're something that tracks global state outside of a particular playthrough of a campaign...

...it's definitely not something that should be exposed in the Lua/WML API – from the API's standpoint, an achievement is irrevocable. Once you have it, you can't unhave it. And removing achievements is not something an add-on has any business doing....

...If you ask me, the achievement is a way of remembering "oh, I satisfied this condition once before". Whether or not you have the achievement shouldn't affect what happens if you satisfy the condition again on another playthrough.

Thanks for the clarification, it's appreciated.

Hey ho... really not sure now which version of my add-on would work best for players (with or without achievements). :?
Main reason for adding achievements was to advertise the bonuses, something that is available every playthrough.

At least I have code for both versions so once I decide, that bit of work at least should be quick.

Anyway, thanks again for taking the time to explain.

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Spannerbag
Posts: 538
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Reset achievements for UMC campaign?

Post by Spannerbag »

Pentarctagon wrote: March 23rd, 2024, 5:52 am
Celtic_Minstrel wrote: March 23rd, 2024, 4:30 am Also, by the way…
Spannerbag wrote: March 18th, 2024, 11:14 am [*]As above but for the whole campaign and set within [campaign] tag rather than [achievement].
Could be restricted to type=sp and not mp or hybrid.
Campaigns don't have achievements, so this doesn't make sense. The only thing that can have achievements is an add-on.
To expand on this a bit, it's also a technical limitation - you need to know what all the achievements and their current statuses are from even the main menu, before most content has been loaded. So all the achievements.cfg files are loaded entirely separately and earlier than any of the content they're meant to be associated to. So you can't have achievements set within a [campaign] tag (or any other top-level tag) because then Wesnoth wouldn't know about the achievements for that campaign unless you were actively playing that campaign.
I understand that achievements are global and that they are visible independent of what gameplay (if any) the player is currently engaged in.
I also understand that the design is that once an achievement is set, that's it, and the player has bragging rights forevermore.
That said I would push back gently on this being a purely technical limitation, if an achievement is set during a playthrough of a particular add-on, I see no fundamental technical barrier preventing that same add-on being allowed to unset an achievement it previously set?
To me, that restriction originates in design philosophy: achievements are permanent.
I'm sure coders could repurpose the "set achievement" logic to unset achievements if that was required.

Also I wasn't implying that all the achievements logic should be within an add-on, I appreciate that the game must know about a player's achievements when the game loads, because they are indeed visible on the main menu so their current status cannot reside within an add-on.

As I see it - and I may be utterly wrong here (not unusual) - there are 3 parts to an achievement:
  • Definition (achievements.cfg).
  • Status (preferences file), i.e. not started/in progress/completed.
  • Modify status (add-on), i.e. progress/completed.
All that said I realise that in the context of Wesnoth's achievements all this debate is beside the point so will shut up now. :)

Thanks for taking the trouble to reply,
cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
gnombat
Posts: 710
Joined: June 10th, 2010, 8:49 pm

Re: Reset achievements for UMC campaign?

Post by gnombat »

Pentarctagon wrote: March 17th, 2024, 6:18 pm A button or a command line option wouldn't be too hard. Doing it via WML/lua wouldn't be hard either, but I wouldn't want to add that functionality there due to the risk of achievements accidentally getting cleared when they shouldn't be due to a bug or someone deciding to intentionally try to wipe other players' achievements.
The risk is sort of there already, isn't it? I mean, it isn't possible to actually wipe other players' achievements, but it looks like an addon could just [set_achievement] for all of another addon's achievements (or even all mainline achievements)? That would essentially amount to the same thing (as you've now lost all information about which achievements have actually been achieved).
User avatar
Pentarctagon
Project Manager
Posts: 5566
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Reset achievements for UMC campaign?

Post by Pentarctagon »

Spannerbag wrote: March 24th, 2024, 11:40 am That said I would push back gently on this being a purely technical limitation, if an achievement is set during a playthrough of a particular add-on, I see no fundamental technical barrier preventing that same add-on being allowed to unset an achievement it previously set?
The problem is that Wesnoth doesn't know one playthrough from another playthrough, and by the time the scenario is running it also doesn't know from which add-on a particular piece of WML came from.
gnombat wrote: March 24th, 2024, 1:29 pm
Pentarctagon wrote: March 17th, 2024, 6:18 pm A button or a command line option wouldn't be too hard. Doing it via WML/lua wouldn't be hard either, but I wouldn't want to add that functionality there due to the risk of achievements accidentally getting cleared when they shouldn't be due to a bug or someone deciding to intentionally try to wipe other players' achievements.
The risk is sort of there already, isn't it? I mean, it isn't possible to actually wipe other players' achievements, but it looks like an addon could just [set_achievement] for all of another addon's achievements (or even all mainline achievements)? That would essentially amount to the same thing (as you've now lost all information about which achievements have actually been achieved).
It is a risk, but it doesn't follow that because there's one way to do a bad thing that it's fine to add a second different way to do it.
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
Spannerbag
Posts: 538
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Reset achievements for UMC campaign?

Post by Spannerbag »

Pentarctagon wrote: March 24th, 2024, 3:36 pm
Spannerbag wrote: March 24th, 2024, 11:40 am That said I would push back gently on this being a purely technical limitation, if an achievement is set during a playthrough of a particular add-on, I see no fundamental technical barrier preventing that same add-on being allowed to unset an achievement it previously set?
The problem is that Wesnoth doesn't know one playthrough from another playthrough, and by the time the scenario is running it also doesn't know from which add-on a particular piece of WML came from.
Ah, that's where I made an invalid assumption: I was implicitly assigning an achievement to an add-on and that isn't the case.
My thought was that if an add-on sets an achievement (i.e. creates an entry of some sort in preferences) it "owns" that achievement (or more precisely only that add-on can update that achievement record it previously created in preferences).
Edit: forgot to add that my reasoning for this is that the main menu knows which achievements are associated with which campaign.
(Also have migrated to 1.18.0 and haven't got any achievement entries in preferences yet so when I have that might explain a few things.)


Also surprised to learn that Wesnoth doesn't know where the WML originates from... I vaguely recall reading ages ago that the engine maintained namespaces and prepended campaign specific strings to every variable within said campaign to avoid name clashes between variables in different campaigns (I guess this really only matters for persistent variables as I doubt many players would run two sessions of Wesnoth at the same time?) - or have I got something wrong again?


Pentarctagon wrote: March 17th, 2024, 6:18 pm
gnombat wrote: March 24th, 2024, 1:29 pm
Pentarctagon wrote: March 17th, 2024, 6:18 pm A button or a command line option wouldn't be too hard. Doing it via WML/lua wouldn't be hard either, but I wouldn't want to add that functionality there due to the risk of achievements accidentally getting cleared when they shouldn't be due to a bug or someone deciding to intentionally try to wipe other players' achievements.
The risk is sort of there already, isn't it? I mean, it isn't possible to actually wipe other players' achievements, but it looks like an addon could just [set_achievement] for all of another addon's achievements (or even all mainline achievements)? That would essentially amount to the same thing (as you've now lost all information about which achievements have actually been achieved).
It is a risk, but it doesn't follow that because there's one way to do a bad thing that it's fine to add a second different way to do it.
I think you both make very good points and I'd like to understand the reasoning why achievements are divorced from add-ons?
Even though their status is displayed on the main menu I don't see why it follows that achievements cannot be "owned" by an add-on (as mentioned above the main menu associates achievements with add-ons).
This would, I guess, prevent (or at least restrict) the issue gnombat raised?
Just curious. :)

Thanks for your patience and explaining it all in a way my little brain can understand.

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Pentarctagon
Project Manager
Posts: 5566
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Reset achievements for UMC campaign?

Post by Pentarctagon »

Spannerbag wrote: March 25th, 2024, 10:14 am Also surprised to learn that Wesnoth doesn't know where the WML originates from... I vaguely recall reading ages ago that the engine maintained namespaces and prepended campaign specific strings to every variable within said campaign to avoid name clashes between variables in different campaigns (I guess this really only matters for persistent variables as I doubt many players would run two sessions of Wesnoth at the same time?) - or have I got something wrong again?
As far as I know, Wesnoth doesn't do anything like that - all the WML from the currently active content is loaded and merged together, and after that point where exactly it came from is unknown.
Spannerbag wrote: March 25th, 2024, 10:14 am I think you both make very good points and I'd like to understand the reasoning why achievements are divorced from add-ons?
Even though their status is displayed on the main menu I don't see why it follows that achievements cannot be "owned" by an add-on (as mentioned above the main menu associates achievements with add-ons).
This would, I guess, prevent (or at least restrict) the issue gnombat raised?
Just curious. :)
Since Wesnoth doesn't know where the WML setting/updating the achievement came from, separating achievements by add-on would only be visual - it wouldn't have any way to use that to keep one add-on from updating another add-on's achievements.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
gnombat
Posts: 710
Joined: June 10th, 2010, 8:49 pm

Re: Reset achievements for UMC campaign?

Post by gnombat »

Pentarctagon wrote: March 25th, 2024, 2:42 pm
Spannerbag wrote: March 25th, 2024, 10:14 am Also surprised to learn that Wesnoth doesn't know where the WML originates from... I vaguely recall reading ages ago that the engine maintained namespaces and prepended campaign specific strings to every variable within said campaign to avoid name clashes between variables in different campaigns (I guess this really only matters for persistent variables as I doubt many players would run two sessions of Wesnoth at the same time?) - or have I got something wrong again?
As far as I know, Wesnoth doesn't do anything like that - all the WML from the currently active content is loaded and merged together, and after that point where exactly it came from is unknown.
I think Spannerbag is talking about https://wiki.wesnoth.org/PersistenceWML#namespace ? But note that the addon author specifies what namespace to use (the engine does not do it automatically).
User avatar
Celtic_Minstrel
Developer
Posts: 2236
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Reset achievements for UMC campaign?

Post by Celtic_Minstrel »

Spannerbag wrote: March 25th, 2024, 10:14 am Also surprised to learn that Wesnoth doesn't know where the WML originates from... I vaguely recall reading ages ago that the engine maintained namespaces and prepended campaign specific strings to every variable within said campaign to avoid name clashes between variables in different campaigns (I guess this really only matters for persistent variables as I doubt many players would run two sessions of Wesnoth at the same time?) - or have I got something wrong again?
Wesnoth doesn't know where the WML came from for a very simple reason – when you start a new game, you specify a set of add-ons to load, and Wesnoth merges all those add-ons together to produce the WML for the game you're going to play.

In single-player mode, you often have only one add-on, namely a campaign, but there could also be some modifications. In multiplayer mode though you have the era, and potentially some included resources, and some modifications, and of course the actual scenario you're playing.

So by the time you're in the game, it's potentially a hodgepodge of many add-ons. Thus, there's no way to tell which piece of code came from which add-on.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Spannerbag
Posts: 538
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Reset achievements for UMC campaign?

Post by Spannerbag »

gnombat wrote: March 25th, 2024, 5:40 pm I think Spannerbag is talking about https://wiki.wesnoth.org/PersistenceWML#namespace...
Probably, IIRC I read it in a post when I was new to the forum and WML and probably misunderstood it, thereby establishing a tradition I've maintained to this day! :augh:

Thanks for pointing that out.

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Spannerbag
Posts: 538
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Reset achievements for UMC campaign?

Post by Spannerbag »

Pentarctagon wrote: March 25th, 2024, 2:42 pm Since Wesnoth doesn't know where the WML setting/updating the achievement came from, separating achievements by add-on would only be visual - it wouldn't have any way to use that to keep one add-on from updating another add-on's achievements.
Celtic_Minstrel wrote: March 26th, 2024, 4:36 am Wesnoth doesn't know where the WML came from for a very simple reason – when you start a new game, you specify a set of add-ons to load, and Wesnoth merges all those add-ons together to produce the WML for the game you're going to play... by the time you're in the game, it's potentially a hodgepodge of many add-ons. Thus, there's no way to tell which piece of code came from which add-on.
Thanks, the penny has finally dropped!
So, I think I will reinstate achievements and then plod on with the other stuff in my feedback/todo list.

Thanks ever so much for your time and patience.

Cheers,
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
Post Reply