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

add create_default Sc #54

Open
santolucito opened this issue Feb 6, 2025 · 1 comment
Open

add create_default Sc #54

santolucito opened this issue Feb 6, 2025 · 1 comment

Comments

@santolucito
Copy link

def from_file(cls: Type[S], path: str, game_version: str = "DE", name: str = "") -> S:

I'd like to propose a create default function that loads a empty.aoe2scenario and returns this. @Tshin120 and I found it is a bit handy to have when trying to make maps from scratch. The downside is that then a .aoe2scenario file is a dependency in the library, which might need to be updated between version (not sure how much these change). If you like the idea, lmk and either me or @Tshin120 can make a pull request

@KSneijders
Copy link
Owner

Hey!
Funnily enough, this was a feature a while back (AoE2Scenario.from_default()). It was done through the version JSON file, every "retriever" having a default value and using that to construct the scenario, so no actual file was necessary.

The problem back then was that it was hard to maintain as scenarios changed a lot more than they do these days, and I didn't have the setup and tooling that is included in ASP now.
It also wasn't used much or at all as far as I could tell. That's the main reason why I haven't re-introduced it.

There are two ways of solving this:

  1. The first would be like you proposed, placing a scenario file inside the library. This would be quite simple, and technically speaking not too difficult to maintain. It could also be the smallest size possible 1P (80) for example, which would make the file even smaller in size.

  2. The second would be how it was done a while ago. Updating the default values of all retrievers to generate a scenario from that.
    From a code-base perspective I'd prefer this over having a binary file in there, but it also is more work.
    In that case, there'd probably need to be a _debug_x tooling function on the scenario file, which could be used after reading a scenario.
    It'd read its own JSON version file and update every retriever default in it according to the values that were read. And afterwards, write the updated values back to the JSON version file.

Both options require opening the game for a scenario, so maintainability is almost equal. And I do agree this should be a feature again as you don't always have a scenario file at the ready.

Let me know what you think 🙂

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