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

Install custom models/textures through plugin manager #112

Open
rikkolovescats opened this issue Feb 17, 2023 · 1 comment
Open

Install custom models/textures through plugin manager #112

rikkolovescats opened this issue Feb 17, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request plugin-manager Everything plugin manager

Comments

@rikkolovescats
Copy link
Collaborator

rikkolovescats commented Feb 17, 2023

How about we have different directory in plugin manager repo called "assets" which'll look like this:

assets/
├── newLevel/
│   ├── newLevel.bob
│   ├── newLevel.cob
│   └── newLevel.dds
├── newCharacter/
│   ├── newCharacterHead.bob
│   ├── newCharacterHand.bob
│   ├── newCharacterOuch.ogg
|   ├── ...
├── ...

This directory won't be visible from plugin manager in-game, but any usual .py plugins that require custom assets can have a new method which'll signal plugin manager to automatically download and install assets from this "assets" directory available on GitHub:

class MyPlugin(ba.Plugin):
    def on_app_running(self):
        register_new_level()

    def custom_assets(self):
        # this method'll signal plugin manager to download n install 
        # all stuff available in assets/newLevel/ directory on github
        return ["newLevel",]
        # debatable - to handle assets stored in 3rd party sources, prefixing
        # this directory with the source url should help solve it:
        # return ["rikkolovescats/sahilp-plugins/newLevel",]

It might also be a good idea to wait until 1.8 to see if we can change or complement our ideas based on how the official game implements it.

@rikkolovescats rikkolovescats added enhancement New feature or request plugin-manager Everything plugin manager labels Feb 17, 2023
@rikkolovescats
Copy link
Collaborator Author

I thought about this a little more. I think the best way to implement this would be to mention custom assets in the plugin/minigame's corresponding json metadata file.

For example, soccer currently looks like this:

"soccer": {
"description": "Shoot the ball in left or right edge of the map to score",
"external_url": "",
"authors": [
{
"name": "Stary_Agent",
"email": "",
"discord": ""
}
],
"versions": {
"1.0.0": {
"api_version": 7,
"commit_sha": "e59073b",
"released_on": "02-11-2022",
"md5sum": "ceb7ac417c85396722fa9f7fee3cfc01"
}
}
},

If it were to use custom assets, it could look something like this:

"soccer": {
  "description": "Shoot the ball in left or right edge of the map to score",
  "external_url": "",
  "authors": [
    {
      "name": "Stary_Agent",
      "email": "",
      "discord": ""
    }
  ],
  "versions": {
    "1.0.0": {
      "api_version": 7,
      "commit_sha": "e59073b",
      "released_on": "02-11-2022",
      "md5sum": "ceb7ac417c85396722fa9f7fee3cfc01",
      "custom_assets": [
        {
          "file": "newLevel/newLevel.bob",
          "md5sum": "e0b0b3b0e0b0b3b0e0b0b3b0e0b0b3b0",
        },
        {
          "file": "newLevel/newLevel.cob",
          "md5sum": "c0c3c0e0c0c3c0e0c0c3c0e0c0c03c0e",
        },
        {
          "file": "newLevel/newLevel.dds",
          "md5sum": "b0b3b0e0b0b3b0e0b0b3b0e0b0b3b0e0",
        }
      ]
    }
  }
},

I think maintaining versions for every asset (like the way we do for plugins/minigames) seems unnecessary, so for now I think let's just use the present version of the asset. In case the local md5sum of the asset ever stops matching with the one present in this repo, plugin manager can attempt to update the local asset.

We can also auto populate the md5sum for assets using ci similar to how we do it for plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin-manager Everything plugin manager
Projects
None yet
Development

No branches or pull requests

1 participant