LuisMayo / objection_engine

Library that turns comment chains into ace attorney scenes, used in several bots
MIT License
105 stars 20 forks source link

Objection 4 #102

Closed Meorge closed 1 year ago

Meorge commented 1 year ago

See issue #97 for discussion of the new engine's features.

In order for this to work, the assets_v4 folder must be placed in the same folder as the original assets folder: https://drive.google.com/open?id=1-2NV-wpXPovJXW3KaI34AXRZFsrqm1oM

Some example scripts are included in the examples/v4 folder.

More dependencies have been added, so make sure to run poetry lock --no-update and poetry install before running an example script.


EDITTED BY MAINTAINER (@LuisMayo ) Things to solve before merging.

LuisMayo commented 1 year ago

It is correct

Score _ont hasn't ever been used from the outside afaik so you if is_renderable is restored using another implementation it should be fine too

Meorge commented 1 year ago

I've pushed a fix for the score parameter issue. It also includes an example script to demonstrate it, which can produce a video like this:

https://user-images.githubusercontent.com/9957987/228407720-838b3f6a-7be3-4f4a-a80a-c3fbd30cfd40.mp4

This fix also moves the location of the "igari" font folder into the "textbox/font" folder, to keep things consistent. Here is what my assets folder structure looks like now:

Screenshot 2023-03-28 at 7 05 14 PM

Later tonight or tomorrow I should be able to get the is_renderable() function reimplemented.


I saw you mention on the Discord server that the new engine was taking up more RAM. I think that's to be expected to a certain extent, since it loads all the characters into memory iirc, but do you think there might be some sort of memory leak we should investigate?

Meorge commented 1 year ago

is_renderable() has been pushed! To keep it consistent with the old code, it uses FONT_ARRAY (i.e., the main textbox fonts) by default, but I'd suggest sending it the NAMETAG_FONT_ARRAY like so:

# ace-attorney-twitter-bot/comment_list_brige.py

import requests
from objection_engine.beans.comment import Comment as obj_comment
from objection_engine.beans.text import is_renderable
from objection_engine.font_constants import NAMETAG_FONT_ARRAY

class Comment:
    def __init__(self, tweet):
        # check if username is renderable, if not, use their "screen_name"
        if is_renderable(tweet.user.name, font_array=NAMETAG_FONT_ARRAY): # include nametag fonts
            self.author_name = tweet.user.name
        ...
LuisMayo commented 1 year ago

Hi

Sorry I closed the MR. Open again

Thanks for the new commits.

About the memory leak I don't think so. However I fear that the memory usage may be unlimited Since that's a bug that I had to fix in the old version of the library

I'll try to check it and merge. Sorry got the wait.

Thanks

LuisMayo commented 1 year ago

Hi

I've been doing some tests. I don't think there's a memory leak. It just takes more memory than the old engine that's for sure.

I've pushed a commit fixing the OE_DIRECT_H264_ENCODING variable as it wasn't working properly.

There's a setting the new engine is not honoring. oe_bypass_sentiment. Which when set as an enviorenment will disable the sentiment analysis capabilities entirely. This setting should be honored before merging. Once we have it I'll finally push that sweet button.

Thanks!

Meorge commented 1 year ago

I've pushed a change that should do that! It looks like setting the manual score on a comment will still cause a character to use an emotion sprite - only the automatic/ML sentiment analysis is disabled (always detects 'neutral').

LuisMayo commented 1 year ago

This has been pending for too long already.

Thanks a lot for this huge contribution, you're forever an integral part of this engine.

Congratulations on the merge!

Thanks a lot.

Meorge commented 1 year ago

Thanks so much! :D