Skip to content

Install custom models/textures through plugin manager #112

Open

Description

@rikkolovescats

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.

Activity

  1. rikkolovescats commented on Apr 30, 2023

    @rikkolovescats
    CollaboratorAuthor

    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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions