Messing with saving and reloading

Discussion of Lua and LuaWML support, development, and ideas.

Moderator: Forum Moderators

Post Reply
User avatar
ZombieKnight
Posts: 243
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Messing with saving and reloading

Post by ZombieKnight »

Hi
For S03 of my campaign, I'm planning some heavy time lifts and changes...
...
I already know how to "alter" the reality when starting the game (global variables, [if] and map changes for example)
That's useful for me but it's not good enough for all of my ideas.

This is an unexplored idea, so I don't know what way to implement it (the more elegant, the better)
1. How to disable reloading an older state of the game (or resulting into loading the latest one)?
(my ideas: global variable saving ... )
2. How to reload the game to one of its older states using code?

The (the best idea I could come up):
Since the save file contains all the history already AND you can read any file AND you can create .txt files...
What about just adding every action to the .txt file (rather than overwriting it) / edit it after every action
And then when loading the scenario (any of its saves) just have there [event] name=preload.
Which would set everything to the state of the game saved in the .txt file

Would my .txt writing and reading work?
Any idea how to achieve the desired behavior?
Thanks (only for reading this long text... even more if you'll try to help me ^^)
I had saurian in profile before, but I've merged my discord profile with forum one...
Working on campaign Bandits from Brown Hills
User avatar
Ravana
Forum Moderator
Posts: 3063
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Messing with saving and reloading

Post by Ravana »

There are ways but I am not going to give details since use case does not sound like something that should be done by campaign. If users wants to get extra motivation to not use saves it is up to [modification] to control.
User avatar
ZombieKnight
Posts: 243
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Messing with saving and reloading

Post by ZombieKnight »

I'm trying to create a "horror" scenario with
1. reducing information accessibility(like if a unit hits or not, how many hitpoints are left...),
2. some graphical and musical stuff
3. breaking the 4th wall
4. removing the player's "absolute" control over the game

Removing the player's "absolute" control over the game(save file things) has also a strong plot and lore importance
(It's about a "entity" that can opponent player, leading necromancers cult that, same as you can make some save-load cheese)
(I's campaign that is only for skilled and Wesnoth-knowing players)

...

Jup that's my reasons for modify this kind of stuff.
So I'd be glad if you'd help me/ share what you know about it.
I had saurian in profile before, but I've merged my discord profile with forum one...
Working on campaign Bandits from Brown Hills
User avatar
Celtic_Minstrel
Developer
Posts: 2271
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Messing with saving and reloading

Post by Celtic_Minstrel »

ZombieKnight wrote: May 2nd, 2024, 4:23 pm This is an unexplored idea, so I don't know what way to implement it (the more elegant, the better)
1. How to disable reloading an older state of the game (or resulting into loading the latest one)?
(my ideas: global variable saving ... )
2. How to reload the game to one of its older states using code?
Don't.

There is no supported way to disable save and load, and I'm pretty sure there never will be.

You can try to find some kind of workaround to do what you want. There might be something that'll work for you. I can't guarantee it'll continue to work in later versions.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
ZombieKnight
Posts: 243
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Messing with saving and reloading

Post by ZombieKnight »

I can disable reloading (as is done in ironman modes)
The thing is how to save every action?

(Should be easy with for example the txt file, since saves have hundreds of whole rounds saved in them)
But I'm asking here to find the most efficient way.

Other thing (/file you can edit), that came on my mind is editing global variable file with some smart saving system.

... so why you aren't willing to help me?
I had saurian in profile before, but I've merged my discord profile with forum one...
Working on campaign Bandits from Brown Hills
white_haired_uncle
Posts: 1274
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: Messing with saving and reloading

Post by white_haired_uncle »

You might think you can disable reloading, but you can't.

A player who doesn't like save/loading can simply choose not to do so. A player who wants to bad enough can simply, and I do mean simply, bypass whatever you try to do to stop them.

And even if you were successful, you'd break saving for "legitimate" reasons.
Speak softly, and carry Doombringer.
User avatar
ZombieKnight
Posts: 243
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Messing with saving and reloading

Post by ZombieKnight »

It's for one scenario and the all the save files from that scenario would load the very last progress from other file.

So you can leave the computer at any time.
And you can restart the scenario easily too.

So I won't break the savinv for "legitimate" reasons.
I had saurian in profile before, but I've merged my discord profile with forum one...
Working on campaign Bandits from Brown Hills
User avatar
ZombieKnight
Posts: 243
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Messing with saving and reloading

Post by ZombieKnight »

Oh I see, I'm retreating from that one...

Any idea how to save the game using add-on (and load it occasionally)?
I had saurian in profile before, but I've merged my discord profile with forum one...
Working on campaign Bandits from Brown Hills
User avatar
Celtic_Minstrel
Developer
Posts: 2271
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Messing with saving and reloading

Post by Celtic_Minstrel »

ZombieKnight wrote: May 3rd, 2024, 4:52 pm Any idea how to save the game using add-on?
I don't think there's any way to do that.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
ZombieKnight
Posts: 243
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Messing with saving and reloading

Post by ZombieKnight »

You've got all the variables needed to do that in-game.
So why couldn't you just put them all into global ones and then load them?
...
Here may be really usefull the core save-loading system.

I'd like to move this into new thread I've just created:
viewtopic.php?t=58186
I had saurian in profile before, but I've merged my discord profile with forum one...
Working on campaign Bandits from Brown Hills
User avatar
Celtic_Minstrel
Developer
Posts: 2271
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Messing with saving and reloading

Post by Celtic_Minstrel »

I don't think there's any reason why we couldn't have a way for an add-on to explicitly request a save or load, as long as:
  1. There are protections against overwriting other save files (maybe with the exception of save files explicitly requested by the same add-on).
  2. The user is not forced to load when the add-on requests it – though what happens if they refuse is up to the add-on (anything except re-requesting really; so a game over if they choose not to load is valid, for example)
  3. In general, it only supplements the existing auto-save system and cannot replace it entirely.
But such a thing doesn't exist, because no-one thought it would be useful enough to implement it. While I'd have no issue with an add-on requesting a save, I am a little leery of the idea of allowing an add-on to request a load… but I can imagine at least one possible use-case that seems legitimate, so I could likely be convinced.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Pentarctagon
Project Manager
Posts: 5588
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Messing with saving and reloading

Post by Pentarctagon »

Also would need a way to limit how much disk space such saves could take up.
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
ZombieKnight
Posts: 243
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Messing with saving and reloading

Post by ZombieKnight »

Hmm, you think?
I have like hundreds of saves and it's fine since it's all just some txt.
I had saurian in profile before, but I've merged my discord profile with forum one...
Working on campaign Bandits from Brown Hills
User avatar
Celtic_Minstrel
Developer
Posts: 2271
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Messing with saving and reloading

Post by Celtic_Minstrel »

Wait until an add-on has a bug and writes millions of saves.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
ZombieKnight
Posts: 243
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Messing with saving and reloading

Post by ZombieKnight »

Ok, I agree, but make the limit big enough, please, not like max. 3 save-files or smt like that ^^...
I had saurian in profile before, but I've merged my discord profile with forum one...
Working on campaign Bandits from Brown Hills
Post Reply