larsiusprime / polymod

Atomic modding framework for Haxe
MIT License
161 stars 62 forks source link

[ENHANCEMENT] Mods having their own Libraries #79

Open DotWith opened 2 years ago

DotWith commented 2 years ago

Mod(s) Libraries would be hard to make due to manifests. Unless you were able to make it automatic, or making the assetLibraryPaths editable in runtime.

EliteMasterEric commented 2 years ago

From what I see, the ability to preload all the assets in a given library is the primary reason to even separate assets into libraries in the first place.

What exactly would a custom asset library look like? How would a mod declare an asset library, and how would the host application know when to preload its assets?

DotWith commented 2 years ago

Maybe something like _polymod_libraries.xml? And this xml would be very similar to a project.xml.

Cheemsandfriends commented 2 years ago

Mod(s) Libraries would be hard to make due to manifests. Unless you were able to make it automatic, or making the assetLibraryPaths editable in runtime.

I think that all files/ folders that inside the mods folder and the mods folder is in manifest, I don't think you should have a problem imo (Or I'm not understanding the suggestion?)

EliteMasterEric commented 2 years ago

@Cheemsandfriends I think the issue is that the exact behavior of asset libraries in Lime and OpenFL isn't well documented and the exact use case that DotWith wants this feature for isn't fully clear.

@DotWith What are you looking to achieve that Polymod can't currently do?

Cheemsandfriends commented 2 years ago

@MasterEric Oh, So he wants like a project.xml modifier to have the same syntaxis as the lime projects and that it replaces? My brain just exploded

imagen

Isn't that like changing the executable or something like that?

DotWith commented 2 years ago

@Cheemsandfriends I think the issue is that the exact behavior of asset libraries in Lime and OpenFL isn't well documented and the exact use case that DotWith wants this feature for isn't fully clear.

@DotWith What are you looking to achieve that Polymod can't currently do?

Add a folder in my mod. Example week8.

EliteMasterEric commented 2 years ago

Being able to maintain customized separate asset libraries is really convenient, since it allows you to precisely control how assets are loaded and organized.

However, defining them in XML doesn't seem appropriate since the only thing we're doing is defining a target path for the library.

Thus, I think the best way of implementing this feature is by adding an additional json file, like _polymod_config.json with the following contents:

{
  // Define additional asset libraries here.
  "assetLibraries": [
    {
        "name": "week7",
        "path": "./weeks/week7"
    },
  ]
}

With this, a mod file at the path weeks/week7/images/bg.png would be available in the week7 library at the path images/bg.png. This would have the same effect as adding "week7" => "./weeks/week7" to frameworkParams.assetLibraryPaths.