EtienneLamoureux / TQVaultAE

Extra bank space for Titan Quest Anniversary Edition
MIT License
272 stars 62 forks source link

Add a character save management system #469

Closed hguy closed 1 year ago

hguy commented 1 year ago

Over time, the number of character saves is growing. It can be a real chore to scroll through all your character in the main screen of the game.

It would be nice to be able to create "character tags" and be able to deploy on demand in the regular save directory characters assigned to each tags.

You only want to play regularly with a small set of characters and sometime replaying an old one.

Technicaly it's about moving characters directories in and out $(TQSaveDirectory)\SaveData\Main (\User for mods) in a comprehensive way.

Archived character directories would be stored in the \ArchivedCharacters subdirectory.

Tag mappings would be stored as a json in \ArchivedCharacters\tqvault-tags.json file.

{
    "tags" : [
        {
            "name" : "HCDungeonPushing", 
            "color" : {
                "R" : 10, 
                "G" : 11, 
                "B" : 12 
            }
        },
        {
            "name" : "AllDefense", 
            "color" : {
                "R" : 20, 
                "G" : 21, 
                "B" : 22 
            }
        }
    ],
    "mapping" : [
        { "player" : "Main\\_character1", "tags" : ["AllDefense"] },
        { "player" : "Main\\_character2", "tags" : ["AllDefense", "HCDungeonPushing"] },
        { "player" : "User\\_characterMod", "tags" : ["HCDungeonPushing"] },
    ]
}

The shelved characters should still be available for selection, management and search through. TQVault code must adapt to that new directory structure.

A modal window should be available for tag management (basic CRUD operations) and tag assignments.

Tags should be visible, if possible, in the dropdown item near the name of the character (rendered in color).

The BackGroundColor of the dropdownitem, should indicate if the character is "archived" or not (some grey color VS normal white).

A context menu on the DropDown control should be available for fast "tag assignment" of the selected character, "Shelve/Unshelve current character" and "Shelve/Unshelve per tag".

epinter commented 1 year ago

Months ago I started to work on a feature for TQRespec to reduce the number of characters visible in game. I'm keeping it simple by just moving the character directories (no file changes) to an Archive subdirectory inside Main and other directory inside User (to try to keep the saves synchronized with steam, if the user has it enabled). In my case, I won't support multiple destinations or groups like you are planning, just Archive and Unarchive actions.

If you decide to do something similar, we can use the same directory name to keep it compatible between both softwares.

I have almost everything ready. UI is working, I just need to add some safeguards to code and recheck error handling.

hguy commented 1 year ago

Months ago I started to work on a feature for TQRespec to reduce the number of characters visible in game

Looks like we had the same idea :)

I put it there because i'm busy ATM, so maybe someone could give it a try.

Concerning directories structure. Your system is a One/Off so having something like that would be compatible and complementary with both systems. TQRespect use \Archives and TQVault use \Archives\Groups so TQVault could unshelve a Group or an individual character previously archived by TQRespect. Leaving the user use both tools the way he like.

$(TQSaveDirectory)\SaveData\Main
    \Archives
        \Groups
            \allDefense
                \_defensechar1
                \_defensechar2
            \speedrunning
            \ThemedMeleeBuilds
            \HCDungeonPushing
        \_tqrespectchar1
        \_tqrespectchar2
        \_tqrespectchar3
hguy commented 1 year ago

TQVault could have a default group Archives that cannot be deleted and is mapped to that common directory for both tools.

hguy commented 1 year ago

Maybe having Archives and Groups at same level easier to handle in code. @epinter Give me your feed back on this.

$(TQSaveDirectory)\SaveData\Main
    \Archives
    \Groups
epinter commented 1 year ago

Maybe having Archives and Groups at same level easier to handle in code. @epinter Give me your feed back on this.

$(TQSaveDirectory)\SaveData\Main
    \Archives
    \Groups

The structure I have is like you described:

$(TQSaveDirectory)\SaveData\Main\ArchivedCharacters
                                              \_char1
                                              \_char2
$(TQSaveDirectory)\SaveData\User\ArchivedCharacters
                                             \_char3
                                             \_char4

Keeping Archives and Groups will surely be easier to manage in code, but personally I'm a bit afraid of managing a tree of directories moving the savegame everytime a user wants to change the group.

What do you think about tags for characters ?

You could leave all of them inside the ArchivedCharacters directory (so they would disappear in game), and store somewhere something like:

Main/_char1=allDefense Main/_char2=ThemedMeleeBuilds User/_char3=HCDungeonPushing

I think this way you could even add more than one tag per character and improve the search you want, and wouldn't lose the tags when move back from archive. I just don't know where you would store this data... :D

epinter commented 1 year ago

A text file inside the character directory with a list of tags wouldn't hurt.

hguy commented 1 year ago

Yes that's a nice take one the idea and prevent to much directory manipulation. We can store this mapping in user settings or in a new file txt, json, xml. We just need to state on the directory name so you can release your feature (it's almost done).

epinter commented 1 year ago

Now I'm using ArchivedCharacters

hguy commented 1 year ago

@epinter I have adjusted the requierements.

epinter commented 1 year ago

Very nice. I like the JSON.

hguy commented 1 year ago

@epinter, @mmmilord Finally, i've done it. It's available in PR #465

hguy commented 1 year ago

@epinter i ended up saving tag config file in TQVaultData/Config/TagConfig.json for convenience. It's should not impact your implementation.