Multiple quicksaves

Open-source port of PoP that runs natively on Windows, Linux, etc.
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Multiple quicksaves

Post by atrueprincefanfrom18 »

Can there be a Quicksave history? Occasionally it does happen that in hard mods, player make mistakes and Quicksave, thereby losing their old Quicksave file. If it's gonna take a lot of time to create the GUI to manage Quicksave files, I think it can be done to create a folder, say "backup-quicksaves" and then keep moving the files there?
What do you guys think?
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
Akruzen
Developer
Developer
Posts: 141
Joined: April 30th, 2016, 10:16 am

Re: SDLPoP; David's open-source port of PoP

Post by Akruzen »

atrueprincefanfrom18 wrote: January 2nd, 2022, 1:38 pm Can there be a Quicksave history? Occasionally it does happen that in hard mods, player make mistakes and Quicksave, thereby losing their old Quicksave file. If it's gonna take a lot of time to create the GUI to manage Quicksave files, I think it can be done to create a folder, say "backup-quicksaves" and then keep moving the files there?
What do you guys think?
I think we can assign a different key for each different quicksaves. For example, from F1 to F12, pressing F1 will generate a file named "Quicksave_F1". And when pressing Ctrl+F1, it will load up Quick Slot 1.

I think I will try to add this feature on my own. I will just need to change the following things:
1. Keys for quicksave and quickload
2. File name while generating and loading the quicksave file

Not sure how difficult it is going to be, but I think it won't be much difficult.
What if life is a video game and Déjà Vu are just checkpoints?
User avatar
VelCheran
Vizier
Vizier
Posts: 127
Joined: May 28th, 2020, 7:26 pm

Re: SDLPoP; David's open-source port of PoP

Post by VelCheran »

The other solution would be to do like the game Divinity: Original Sin for instance, which lets the player decide how many quicksaves he wants. If you set the number to 8, each press on quicksave key will erase the next slot until it reaches 8, in which case it will start from the beginning.
User avatar
Akruzen
Developer
Developer
Posts: 141
Joined: April 30th, 2016, 10:16 am

Re: SDLPoP; David's open-source port of PoP

Post by Akruzen »

I have tried to implement the idea of multiple quick saves. The game will save from F1 to F5, and load from F6 to F10. For example, if you save in slot 1 using F1, press F6 to load slot 1. If you save in slot 2 using F2, press F7 to load slot 2 and so on.



To try for yourself, replace the data.h and seg000.c in the src folder with the attached with files and recompile the game.

P.S. This version is not tested for the Replay feature.
Attachments
seg000.c
Added code to support multiple quicksaves.
(68.56 KiB) Downloaded 68 times
data.h
Added "slot_key" variable which stores which slot is to be operated on.
(23.73 KiB) Downloaded 66 times
What if life is a video game and Déjà Vu are just checkpoints?
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: SDLPoP; David's open-source port of PoP

Post by atrueprincefanfrom18 »

Akruzen wrote: January 3rd, 2022, 8:29 am I have tried to implement the idea of multiple quick saves. [...]
This looks really cool, I just found one bug - if you are on the SDLPoP loading screen (the info screen where it shows the version and all, if you press F9, it Quickloads the first version, it's a minute bug, can be fixed easily :D)
Rest is all good. I still have to remember the key presses, because I press F6 for Quicksave unknowingly and it Quickloads :lol:
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: SDLPoP; David's open-source port of PoP

Post by David »

Akruzen made a pull request for this feature: https://github.com/NagyD/SDLPoP/pull/270
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: SDLPoP; David's open-source port of PoP

Post by atrueprincefanfrom18 »

David wrote: January 8th, 2022, 9:20 pm Akruzen made a pull request for this feature: https://github.com/NagyD/SDLPoP/pull/270
I think Quicksaving with one key and then Quickloading the same slot with a CTRL or ALT key makes sense. Or CTRL + [KEY] to save and ALT + [KEY] to load. I think bringing up to menu to ask which slot to save to might be a bad idea.
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
Akruzen
Developer
Developer
Posts: 141
Joined: April 30th, 2016, 10:16 am

Re: SDLPoP; David's open-source port of PoP

Post by Akruzen »

Hey David,

Thanks for taking a look at the feature. While assigning keys, I also had the same problem to decide the keys for quicksave and quickload. Initially, I had thought similarly as @atrueprincefanfrom18, for assigning same button for quickload and quicksave with the difference being of addition of an alternate key (e.g. Ctrl, Alt, etc).
Let's say for now we assign F1 for quicksave and Alt+F1 for quickload.
Now, I saw in the code that the game might need to be saved while Shift key is pressed (for example while hanging, during sword strike, careful step, etc). In such scenarios, if we assign Alt+F1 to quickload, I am sceptical that the keyboard might not register the keystrokes unless it has anti-ghosting facility. Hence I was trying to avoid the 'three key presses' scenario.
However, considering such cases will be uncommon, the "F1 to save and Alt+F1 to Load" keystrokes might be a good idea (a mere suggestion, other suggestions are always welcome :) )
And, as for the quicksave and quickload button in the menu, we can keep it default to slot 1 and rename the menu items accordingly. I think 5 slots might be enough (From F1 to F5 and from Alt+F1 to Alt+F5), so that other function keys might be useful for any future features.
What do you think?
What if life is a video game and Déjà Vu are just checkpoints?
dmitry_s
Developer
Developer
Posts: 148
Joined: July 27th, 2021, 7:22 am

Re: SDLPoP; David's open-source port of PoP

Post by dmitry_s »

If you were to use "key_states[SDL_SCANCODE_LSHIFT] || key_states[SDL_SCANCODE_RSHIFT]" instead of the "control_shift" variable (to use Shift-Fx) there should be no problems with quicksave.

I would not use Alt because operating systems use Alt shortcuts for window control. For example, Alt-F4 closes the current window in most apps.

Control is probably the best key to use since it is not used in gameplay except for functions like reloading the level.
User avatar
Akruzen
Developer
Developer
Posts: 141
Joined: April 30th, 2016, 10:16 am

Re: SDLPoP; David's open-source port of PoP

Post by Akruzen »

dmitry_s wrote: January 9th, 2022, 10:15 am If you were to use "key_states[SDL_SCANCODE_LSHIFT] || key_states[SDL_SCANCODE_RSHIFT]" instead of the "control_shift" variable (to use Shift-Fx) there should be no problems with quicksave.

I would not use Alt because operating systems use Alt shortcuts for window control. For example, Alt-F4 closes the current window in most apps.

Control is probably the best key to use since it is not used in gameplay except for functions like reloading the level.
That's true, Alt key should probably be reserved for windows operations. I have changed the feature to Ctrl. Now, to save, all you need to do is Press F1/F2/F3/F4/F5 and to load, press Ctrl + Function Key (F1/F2/F3/F4/F5). By default, the menu quicksave and quickload will save to slot one.

I also have made a pull request in the multi-quicksave branch. To try it or test for bugs, download and compile code from here.
What if life is a video game and Déjà Vu are just checkpoints?
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: SDLPoP; David's open-source port of PoP

Post by atrueprincefanfrom18 »

Nice, this looks good!
Will need some time to memorise the inputs, my finger still goes on F9 to Quickload :lol:
Great job @Akruzen!
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: SDLPoP; David's open-source port of PoP

Post by Norbert »

I do have some suggestions.

Maybe F6/F9 could quick save-to/load-from the active slot. And F7/F8 could decrease/increase the active slot, with brief feedback in the status bar. This way, each key only does one thing. This is easier to remember, backwards compatible, results in fewer 'Ctrl' mistakes, leaves more keys/combos available for future use, and would solve a key-combo conflict with some Linux window managers, such as Xfce, that use Ctrl combined with function keys for workspace switching.

Regardless, the splash text could be improved visually to avoid repetition of "in-game", and avoid characters next to the window border. Also, instructions will be easier to understand if we can give, instead of describe, key combos. Example, for the current build:

Code: Select all

Five quick save slots are available in-game.
Save to them with F1, F2, F3, F4, or F5.
Load with Ctrl+F1 ... Ctrl+F5.
User avatar
Akruzen
Developer
Developer
Posts: 141
Joined: April 30th, 2016, 10:16 am

Re: SDLPoP; David's open-source port of PoP

Post by Akruzen »

Norbert wrote: January 9th, 2022, 9:36 pm I do have some suggestions.

Maybe F6/F9 could quick save-to/load-from the active slot. And F7/F8 could decrease/increase the active slot, with brief feedback in the status bar. This way, each key only does one thing. This is easier to remember, backwards compatible, results in fewer 'Ctrl' mistakes, leaves more keys/combos available for future use, and would solve a key-combo conflict with some Linux window managers, such as Xfce, that use Ctrl combined with function keys for workspace switching.

Regardless, the splash text could be improved visually to avoid repetition of "in-game", and avoid characters next to the window border. Also, instructions will be easier to understand if we can give, instead of describe, key combos. Example, for the current build:

Code: Select all

Five quick save slots are available in-game.
Save to them with F1, F2, F3, F4, or F5.
Load with Ctrl+F1 ... Ctrl+F5.
That seems good, the backward compatibility will give a good advantage if it is merged with the master branch. The slot selection idea also seems good, similar idea was suggested by David here. I think assigning numerical keys 1,2, 3, 4 and 5 for selecting the slot and keeping F6 and F9 for quicksave and quickload might be a good idea instead increasing or decreasing the active slot so that user can do the saving/loading faster. Slot selection will resolve the ambiguity regarding the functions of quicksave and quickload present in the menu since it will Save/Load in the slot currently selected.
Pressing numeric keys (1 to 5) will briefly display the slot selected in the space where remaining time gets displayed (display_bottom_text). Then the user can save or load the game from the slot. Unless changed, all the operations will be performed on the selected slot (defaulted to 1). This could also improve the splash screen readability by just adding "Press 1, 2, 3, 4, 5 to select slot." to current "Press F6/F9 to Save and Load the game."
What do you think?
What if life is a video game and Déjà Vu are just checkpoints?
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: SDLPoP; David's open-source port of PoP

Post by Norbert »

Single keys without modifiers are 'valuable', 'expensive', 'high profile'. Instinctively, I feel a better solution must be available than giving up an arbitrary number of non-modified numeric keys just for quick saving/loading.

At the same time, as you write, my suggestion of allowing cycling back and forth through slots may not be fast enough.

We could require the user to press a specific key first, before a numeric key can be pressed to activate a slot, e.g. F7,3 to select slot 3.
Or, we could make F7/F8 save-to/load-from slots, e.g. F8,2 to immediately load from slot 2.

Actually, maybe we could use Ctrl+F6 to quick load from a specific slot, and Ctrl+F9 to quick save to a specific slot. Most Linux window managers will probably either a) not use Ctrl+function-keys for workspace switching, or b) only use Ctrl+F1...Ctrl+F4 for this purpose. Would this be fast enough once users get used to it? E.g. Ctrl+F9,7 to quick load from slot 7.

Or maybe pressing down F6/F9 for more than 1 second could ask for a slot number?
User avatar
Akruzen
Developer
Developer
Posts: 141
Joined: April 30th, 2016, 10:16 am

Re: SDLPoP; David's open-source port of PoP

Post by Akruzen »

Norbert wrote: January 10th, 2022, 12:51 pm Single keys without modifiers are 'valuable', 'expensive', 'high profile'. Instinctively, I feel a better solution must be available than giving up an arbitrary number of non-modified numeric keys just for quick saving/loading.
Yeah, that is a kind of downside to my solution.
Norbert wrote: January 10th, 2022, 12:51 pm Actually, maybe we could use Ctrl+F6 to quick load from a specific slot, and Ctrl+F9 to quick save to a specific slot. Most Linux window managers will probably either a) not use Ctrl+function-keys for workspace switching, or b) only use Ctrl+F1...Ctrl+F4 for this purpose. Would this be fast enough once users get used to it? E.g. Ctrl+F9,7 to quick load from slot 7.

Or maybe pressing down F6/F9 for more than 1 second could ask for a slot number?
How about this, we straight away avoid the usage of Combinational Keys (like Shift, Ctrl, Alt, etc.) and use the number keys along with F6 and F9? For example, to save to slot 1, press "F6" with "1" pressed (press and hold key 1, press F6 key, release both keys) and similar to load from slot 1, just with F9.
To keep it backward compatible, pressing F6 or F9 without any numeric keys will overwrite the last used slot (slot is defaulted to 1 if it isn't used anytime before). So if user previously used slot 2 save or load, the game will keep on performing operations on second slot unless the user changes the slots.
However, though this solution removes the need to use combinational keys, there is one tiny problem with this solution. If in future, the numeric keys are required for any other operations, their functions will need to be executed only after the numeric key is released. Let me take an (exaggerated) example. If in future, we assign numeric keys for switching to different weapons (like Assassin's Creed, Tomb Raider, etc), the weapons will only be switched when the compiler recognizes the key release. So, if pressing 2 switches weapon from sword to gun, the gun will not be drawn if we hold the 2 key since compiler will be waiting if we want to actually press the numeric key or we have to save/load and hence pressed "2" key for holding. This might not affect extensively, since usually the time frame between "Key Press" and "Key Release" is very small if the user intends to press the key and not hold it.

I initially thought that "F6/F9+NumKey" might be a better solution (instead of "NumKey+F6/F9"), but it creates a problem during quickload since holding F9 quickloads the game continuously until F9 is released.
Let me know your thoughts :)
What if life is a video game and Déjà Vu are just checkpoints?
Post Reply