Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deck codes doesn't include deck name (Quality of Life) #17

Open
sampaiodias opened this issue Oct 20, 2019 · 5 comments
Open

Deck codes doesn't include deck name (Quality of Life) #17

sampaiodias opened this issue Oct 20, 2019 · 5 comments

Comments

@sampaiodias
Copy link

It would be very useful to have the deck name inside the deck code, as after importing the deck we have to select the deck, click edit, and manually type the name (which in many cases is a net deck with a proper name already).

One solution I can see for it is to split the string into 2+ parts, where the last one is the deck code itself.

Example: LoR=Discard Aggro=CEBAGAIDCQRSOCQBAQAQYDISDQTCOKBNGQAACAIBAMFQ

Another solution is to transform it into a Json file, which certainly helps with future additions of fields while also removing the need to provide the name (or other fields) every time.

{
    "name":"Discard Aggro",
    "code":"CEBAGAIDCQRSOCQBAQAQYDISDQTCOKBNGQAACAIBAMFQ"
}

// Also valid, as the json deserializer will set the name field to null

{
    "code":"CEBAGAIDCQRSOCQBAQAQYDISDQTCOKBNGQAACAIBAMFQ"
}
@Rafalonso
Copy link
Contributor

I like the idea, in other card games, you end up having a lot of unnamed decks that you dont remember what their purpose is but are afraid to delete 😛 . Just feels like strings would get too long. Also I'm not a fan of mixing bytes/unicode with base32.

JSON is interesting. It's probably not a good idea because of mobile players which I guess they plan on releasing in the future.

@sampaiodias
Copy link
Author

Why would JSON be a problem for mobile? It is a format that is universally used by developers, including on mobile.

The example I gave also doesn't increase the string length by a lot (only a few extra chars). Hearthstone has a much bigger deck code string (with the deck name and description) and I never found someone who pointed that as a problem.

@Rafalonso
Copy link
Contributor

Developers have no problem with it but remember that these code strings will be used by players (Unless I'm interpreting the intent of the JSON wrong).

I guess there's no harm with it being part of the deck string as long as it's also b32 encoded.

@sampaiodias
Copy link
Author

As far as I understand, players will always use deck codes with Ctrl C Ctrl V (even the deck code itself is not human readable). The intent of json here is to provide useful data along the deck code to improve the deck sharing ecosystem and the import-export usability.

An example:

using Newtonsoft.Json;

public class DeckCodeObject
{
    public string name;
    public string code;
}

public class MyDeckCodeImporter
{
    public void ImportDeckFromJson(string json)
    {
    	DeckCodeObject deckObject = JsonConvert.DeserializeObject<DeckCodeObject>(json);
    	CardCodeAndCount decoded = LoRDeckEncoder.GetDeckFromCode(deckObject.code);

    	// Do something with 'deckObject.name' and 'decoded'
    }
}

@sampaiodias
Copy link
Author

sampaiodias commented Oct 21, 2019

Also, not changing the current encoding doesn't break the current system (LoRDeckEncoder). If we had to convert to Base32 every additional data (like the deck name) to the final string, maintaining the system would be really hard, as any field changes or additions will break LoRDeckEncoder.GetDeckFromCode and LoRDeckEncoder.GetCodeFromDeck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants