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

Convert Civs to Declarative Config #15

Merged
merged 3 commits into from
Feb 10, 2020

Conversation

exterkamp
Copy link
Contributor

I am working on making a cross reference feature for the helptext.
image

In order to support that, I refactored the civilization config to be defined as a js object instead of calls to enable(), unique() and disable(). This makes the config more declarative and easier to understand.

The civ objects are laid out thusly:

    CivName: {
        disableHorses: boolean,
        enabled: {
            buildings: list<string>,
            techs: list<string>,
            units: list<string>,
            unique: list<string>,
        },
        disabled: {
            buildings: list<string>,
            techs: list<string>,
            units: list<string>,
        },
        monkPrefix: string,
    },

In order to convert the config I made some helper scripts that you can see here and here.

You can preview the cross reference feature here: https://exterkamp.github.io/aoe2techtree/#Aztecs

js/civs.js Show resolved Hide resolved
js/civs.js Outdated
}

const civsConfig = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulirish any thoughts on a test that would be not inconvenient to make sure this is a no-op? Like some snapshot we could take of the entire state?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be ready to merge this, unless we want to work on this check before that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge it now, the check can still be done afterwards if desired.

Copy link
Member

@HSZemi HSZemi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this pull request! Your changes should also make it easier to implement some kind of soft validation, like that every civ that has a tower upgrade disabled has the corresponding tower disabled as well. Cool stuff!

I have added a few review comments (mainly about formatting and ordering).

Concerning the cross-reference feature: A nice idea! It slightly conflicts with the overall concept that you have to select a civ in order to see its tech tree, but I think the benefit outweighs that.
Your branch seems to be missing the last three commits from master, where I added additional data information like Line of Sight etc. There is still textual information about attack and armor classes to be added, which means that together with the cross reference feature, the infobox will take up a lot more space than it did before, which is something to look out for.

js/civs.js Outdated Show resolved Hide resolved
js/civs.js Outdated Show resolved Hide resolved
js/civs.js Outdated Show resolved Hide resolved
js/civs.js Outdated Show resolved Hide resolved
@exterkamp
Copy link
Contributor Author

exterkamp commented Feb 8, 2020

which means that together with the cross reference feature, the infobox will take up a lot more space than it did before, which is something to look out for.

This is very true. The box is getting bigger. @paulirish had the idea to put the cross reference in a <details> element to save space. Something like this
image
image

That way it could be hidden be default. Personally I find the cross reference to be super useful, I navigate to other civs entirely via cross reference buttons instead of the dropdown, so having it behind a clickable drop down isn't useful for me, but I admit that the helptext is getting very large.

But I can go into more detail in that PR, once this one is squared away!

@HSZemi HSZemi merged commit 6b1a714 into SiegeEngineers:master Feb 10, 2020
@pardoman
Copy link

I would really like to have the collapsable cross reference UI!

Currently, the panel is so tall that it overflows my screen:
image

The other option is just fixing the code that positions the help panel. Either options would result in a great outcome imho. Cheers~

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

Successfully merging this pull request may close these issues.

None yet

3 participants