Ren'Py Implementing a simple tagging system in directories

Tribe

Member
Game Developer
May 5, 2021
226
492
My project includes image sets that rely on tags to provide players with a customizable experience. The tagging system requires users to simply drop their content into folders with a simple and consistent naming scheme. For instance, game/real_porn/bedroom/playful_personality/Jimmy Anaconda/(images).
It works. I could walk away and be content, but I am only human. I'm looking for a way to broaden, simplify, or enhance what I already have.

My main issue right now is that, in the example above, Jimmy can only be found in the bedroom. If I put Jimmy in the kitchen, for example, he'll be a completely different Jimmy who looks exactly like Jimmy in the bedroom. And if I force the idea that it's the same Jimmy as the other Jimmy, any and all Jimmies, even if they're different Jimmies, will be that Jimmy. The simplest solution is to add an additional directory that can house multiple image sets, but that would require a sixth subdirectory, and... this can't go on.

So... I'm here to ask for advice on how to expand my tagging system without overwhelming the users. The simplest solution I can think of is to have Ren'Py read tags from a .txt file. Is that something that could work? Tell me, what would you do in this situation?

Here is what I'm using currently:

Python:
init python:
    def Init_Enemy_Dict():
     
        temp_list_1 = ["real", "hentai"]
        temp_list_2 = ["outdoor", "town", "water"]
        temp_list_3 = ["serious", "playful", "bold", "bratty", "lewd", "submissive"]
        temp_list_4 = {}

        for a in temp_list_1:
            for b in temp_list_2:
                for c in temp_list_3:
                    working_dir1 = renpy.os.path.join(config.gamedir, "Enemies", a, b, c)
                    for d in renpy.os.listdir( working_dir1 ): # d is a folder with the charater name
                        if not renpy.os.path.isdir( renpy.os.path.join( working_dir1, d ) ): continue
                        working_dir2 = renpy.os.path.join(config.gamedir, working_dir1, d)
                        e = f"Enemies/{a}/{b}/{c}/{d}/"
                        g = [] # list of images in the folder
                        i = "" # avatar image
                        for f in renpy.os.listdir( working_dir2 ):
                            g.append(e + f)
                            if "avatar" in f:
                                i = e + f
                        if i == "":
                            i = g[0]
                         
                        h = False
                        if len(g) > 1:
                            h = True # Eligable for multi-image interactions
                     
                        j = False
                        if a == "real":
                            j = True

                        k = str(d)
                        k = k.replace("_", " ")
                        k = ' '.join(k.split(' ')[0:2])
                        k = ''.join([i for i in k if not i.isdigit()])
                        k = k.title()

                        temp_list_4[ e ] = [ working_dir2 , j , b , c , g , h , i, k]

                        # enemy_list[path]= [

                            # (0)directory,
                            # (1)real?/hentai (bool),
                            # (2)biome,
                            # (3)personality,
                            # (4)image list (list),
                            # (5)has multiple images? (bool),
                            # (6)avatar image,
                            # (7)display name (string)

                        #]

        return temp_list_4
I'd appreciate any feedback. My next game will require a much more extensive tagging system (possibly not as user-friendly), so I'm open to suggestions. Thank you for your time, and have a wonderful holiday season! Love you guys!
 
Last edited: