abaddonpuff / project_G

Game on Python!
GNU General Public License v3.0
2 stars 0 forks source link

app business logic #4

Closed abaddonpuff closed 2 months ago

abaddonpuff commented 3 months ago

Game is going to be a dating SIM. So the goal for the player is going to be to be able to get a Date with one of the boys or girls, for that it will be required to interact with the boys or girls, the people around them based on a profile. For that it will be required to start an interaction with all of the people there. E.g.

Girl/Boy 1 will be friends with the store person, the coworkers from where they work and a family relative.

Player would be required to speak and befriends with those to get closer to Girl/Boy. Depending on the level of affinity the Girl/Boy has with the player it will be the response it will get.

If they want to befriend somebody close they need to start increasing the affinity of the other characters as well.

If the Girl/Boy1 is friends with the store person, player will be required to interact with the store person, in order to receive a satisfactory response the player needs to buy from that store to increase the affinity level of the store person first.

Saying nice things (this is where NLP comes into play) will little by little increase the affinity of a person.

So the concept would be relatively simple:

Nice thing + 0 affinity = neutral answer and adds affinity regular chatting + 0 affinity = neutral answer no affinity added Not nice + 0 affinity = Bad response and lose affinity ... ... .. .. Nice thing + 100 affinity = Nice response, player advances this way regular chatting + 100 affinity = nice answer no affinity added Not nice + 100 affinity = Neutral - bad response, loses affinity

bbelderbos commented 3 months ago

This is really cool, thanks. What about using spaCy for the nlp part? Game wise this is a great exercise for OOP in Python. Will look a bit more in detail tomorrow ...

bbelderbos commented 3 months ago

Let's discuss to better understand but is it something like this?

class Player:
    def __init__(self, name):
        self.name = name

class Character:
    def __init__(self, name):
        self.name = name
        self.affinity = 0

    def adjust_affinity(self, amount):
        self.affinity += amount

    def get_response(self, interaction_type):
        if interaction_type == "nice":
            if self.affinity < 50:
                return "Neutral answer."
            else:
                return "Nice response, player advances."
        elif interaction_type == "regular":
            return "Neutral answer, no affinity added."
        elif interaction_type == "not_nice":
            if self.affinity < 50:
                return "Bad response, loses affinity."
            else:
                return "Neutral - bad response, loses affinity."

# Function to classify player input
def classify_input(text):
    # Pseudo code for NLP classification
    if "great" in text or "nice" in text:
        return "nice"
    elif "okay" in text or "fine" in text:
        return "regular"
    else:
        return "not_nice"

# Function to handle interaction
def handle_interaction(player, character, text):
    interaction_type = classify_input(text)
    if interaction_type == "nice":
        character.adjust_affinity(10)
    elif interaction_type == "not_nice":
        character.adjust_affinity(-10)
    response = character.get_response(interaction_type)
    return response

# Example usage
player = Player("Player1")
store_person = Character("Store Person")

input_text = "You look great today!"
response = handle_interaction(player, store_person, input_text)
print(response)

# Output: "Neutral answer." (assuming initial affinity is 0 and nice interaction)
abaddonpuff commented 3 months ago

Yes this is kind of the logic I'm hoping for; For this portion of the code I would expect only 1 player to be working (Although I think it would be an awesome Idea to make it multiplayer)

class Player: def __init__(self, name): self.name = name

This would be completeley accurate. I will add something like

class Character:
    def __init__(self, name):
        self.name = name
        self.affinity = 0
        self.intelligence = 0
        self.charm=0
        self.ambition=0
        self.confidence=0
        self.loyalty=0
        self.patience=0
        .... etc
        self.adventurousness=0

To describe the character's personality and how you speak to it would affect the affinity. E.g. if the player takes too much tries to get a good answer a character with patience 5 /100 would start to lose affinity and provide worst and worst responses. All but Affinity would be fixed values per character

All the rest sounds amazing.

bbelderbos commented 3 months ago

Yeah first focus on single player to keep complexity down. Happy we're aligned on this piece.

abaddonpuff commented 2 months ago

App logic on track :D