Author Topic: General Discussion  (Read 3788743 times)

0 Members and 9 Guests are viewing this topic.

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: SimBrothel: -PyTFall- Dev Thread: Writers needed!
« Reply #315 on: February 19, 2013, 03:00:17 PM »
I accidentally noticed that CherryWood has many great pics for schools in his folder. I write this post just in case if I'm the only one who have noticed them.

Yeap, I've noticed pics in yours and CW's folders. I'll see if I can get some work done on the code before I fall asleep.


BUGFIXES:


-----------
CW:
questangry, questhappy, questsad picture categories are using profile picture when missing.
Could it be please set that they will try to use questneutral category first before falling to profile?

Should now work as you want it to. It's up to you to test this.

-----------
Armegetton:
suggest switching line 184 with 185, currently you're showing the MP as agility and agility as MP.

Should be fixed as well.

----------
DarkTl:

House Percentage changes only after you remove mouse cursor from bar. Kinda inconveniently.

This is pissing me off too but I could not find an obvious fix. I'll take care of this much later when I get around to major screen redesign.

« Last Edit: February 19, 2013, 03:46:42 PM by Xela »
Like what we're doing?

Offline CherryWood

  • Hero Member
  • *****
  • Posts: 643
Re: SimBrothel: -PyTFall- Dev Thread: Writers needed!
« Reply #316 on: February 19, 2013, 04:27:00 PM »
I'm sorry, I'm here often, but because nothing I'm doing is related to jobs or other topics that were discussed, I didn't post for a while.


In last two weeks, I was interested in creating some renpy scenes or town locations, but I abandoned that until it will be more clear how main parts of game will work. So only I have is pictures for few new girls and backgrounds that I gathered, but that's nothing helpful now...


Now I'm working on texts for generic girlmeet interactions. I'm trying to sort them by status and traits, because I really like that idea. I will need to discuss that with all or you a bit, because there are some issues that needs to be decided, but I expect it will take at least a week before I can get it to a presentable state.

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: SimBrothel: -PyTFall- Dev Thread: Writers needed!
« Reply #317 on: February 19, 2013, 05:06:25 PM »
I'm sorry, I'm here often, but because nothing I'm doing is related to jobs or other topics that were discussed, I didn't post for a while.


In last two weeks, I was interested in creating some renpy scenes or town locations, but I abandoned that until it will be more clear how main parts of game will work. So only I have is pictures for few new girls and backgrounds that I gathered, but that's nothing helpful now...


Now I'm working on texts for generic girlmeet interactions. I'm trying to sort them by status and traits, because I really like that idea. I will need to discuss that with all or you a bit, because there are some issues that needs to be decided, but I expect it will take at least a week before I can get it to a presentable state.

Cool, are you planning to put those in game yourself or are you making a text file?
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: SimBrothel: -PyTFall- Dev Thread: Writers needed!
« Reply #318 on: February 20, 2013, 03:37:30 AM »
I'm trying to sort them by status and traits, because I really like that idea.
Btw, feel free to add traits if you think I missed any good ones.

Offline CherryWood

  • Hero Member
  • *****
  • Posts: 643
Re: SimBrothel: -PyTFall- Dev Thread: Writers needed!
« Reply #319 on: February 20, 2013, 04:58:47 AM »
Cool, are you planning to put those in game yourself or are you making a text file?
I'm still within text files and excel tabs now, but I'm willing to put it all into renpy code afterwards. It look like a repetitive work, so I should be able to do that if someone help me with first example.

Offline rudistoned

  • Full Member
  • ***
  • Posts: 229
Re: SimBrothel: -PyTFall- Dev Thread: Writers needed!
« Reply #320 on: February 20, 2013, 05:54:07 AM »
Hey guys,

here's the first version of an encounter system. The basic idea is to calculate a percentage, the capability, from the attributes of the character trying to master the encounter. Then the capability is checked five times against a random number between 0 and 99. Then, failures are counted. Very hard encounters allow no failures, very easy ones allow four failures. If the number of failed checks is not greater than the allowed number of failed checks, the encounter has been mastered. For a more detailed explanation, please look at the comments in the code below.

I'm not perfectly happy with the success percentages, but it's good enough I think.

Do you like the system so far?

The goal is that you can later write (for example):
Code: [Select]
trap = TrapEncounter()
trap.difficulty = 4
trap.characters = [warrior1, warrior2]
success = trap.run_encounter()

@Xela
I will use inheritance to implement this as not using it would multiply lots of code. However, if you insist, we can take the inheritance out when copying the code into RenPy.

The following code is untested, will contain typos and will not run. I show it here so you can review the comments and the basic system.

Code: [Select]
class BaseEncounter(object):
    '''Represents a problem questing characters have to master.
   
    Difficulty
    The difficulty describes how hard it is to master this encounter. It ranges
    from 'very easy' = 1 to 'very hard' = 5.   
   
    Mastering the encounter
    In order to master the encounter, the characters must pass a number of
    encounter checks equal to the difficulty, e.g. one check for a very easy
    encounter or three checks for a normal encounter. If they succeed within
    five tries, they master the encounter. If the characters fail at
    6 - difficulty encounter checks, e.g. 2 for a hard enounter, they fail the
    encounter and collectively suffer consequences.
   
    The encounter check
    A random number between 0 and 99 is rolled. If it is lower than the
    capability of the character, the check succeeds.
   
    Probability of failure at various capabilities and difficulties
    10% capability "Rookie"
        'very easy', one successful check needed to master encounter
            probability to fail one check: 1 - 0.1 = 0.9
            probability to fail all five: 0.9 * 0.9 * 0.9 * 0.9 * 0.9 = 0.59
            Rookies succeed at very easy encounters in 41 out of 100 tries.
           
        'very hard', five successful checks needed to master encounter
            probability to succeed on one check: 0.1
            probability to master all five: 0.1 * 0.1 * 0.1 * 0.1 * 0.1 =0.00001
            Rookies succeed at very hard encounters in 1 out of 10000 tries.
           
    90% capability "Master"
        'very easy', one successful check needed to master encounter
            probability to fail one check: 1 - 0.9 = 0.1
            probability to fail all five: 0.1 * 0.1 * 0.1 * 0.1 * 0.1 = 0.00001
            Masters succeed at very easy encounters in 9999 out of 10000 tries.
           
        'very hard', five successful checks needed to master encounter
            probability to succeed on one check: 0.9
            probability to master all five: 0.9 * 0.9 * 0.9 * 0.9 * 0.9 = 0.59
            Masters succeed at very hard encounters in 59 out of 100 tries.
    '''
    def __init__(self):
        self.difficulty = 3
        self.characters = []
       
    def capability(self, char):
        '''Returns how capable the character is at mastering this encounter.
       
        A percentage is returned. 100 means the character will master this
        encounter every single time. 1 means the character will master this
        encounter in 1 out of 100 tries (on average).
        '''
        # sub classes must implement this method
        return -1
       
    def most_capable(self, charlist):
        '''Returns the character most capable of mastering an encounter check.
        '''
        cap2char = {}
        for char in charlist:
            # there could be several chars with equal capability
            try:
                cap2char[self.capability(char)].append(char)
            except KeyError:
                cap2char[self.capability(char)] = [char]
        maxcap = max(cap2char.keys())
        most_capable = random.choice(cap2char[maxcap])
        return most_capable
       
    def take_check(self, char):
        '''A character takes an encounter check, returns True if successful.
        '''
        roll = random.randint(0, 99)
        if roll<self.capability(char):
            self.mastered_check(char)
            passed = True
        else:
            self.failed_check(char)
            passed = False
        return passed
           
    def mastered_check(self, char):
        '''Applies the effects of a successful encounter check to the character.
        '''
        # should increase character tiredness here
        char.tiredness += 20
        # could also increase happiness, experience, ...
       
    def failed_check(self, char):
        '''Applies the effects of a failed encounter check to the character.
        '''
        # should increase character tiredness here
        char.tiredness += 20
        # should also apply negative effects: reduce health, happiness
       
    def run_encounter(self):
        '''This will play out the encounter.
        '''
        msg = "no characters defined for encounter '%s'"
        assert self.characters, msg % self
        # determine the maximum number of failed checks
        maxfail = 5 - self.difficulty
        # perform up to five encounter checks
        failedchecks = 0
        for i in range(0, 5):
            checkchar = self.most_capable(self.characters)
            success = self.take_check(checkchar)
            if not success:
                failedchecks += 1
        # see if the characters mastered the encounter
        if failedchecks>maxfail:
            mastered = False
            for char in self.characters:
                self.failed_encounter(char)
        else:
            mastered = True
            for char in self.characters:
                self.mastered_encounter(char)
        return mastered
       
    def mastered_encounter(self, char):
        '''Applies the effects of a mastered encounter to the character.
        '''
        char.experience += (self.difficulty * self.difficulty)
        # could also increase happiness, fame
       
    def failed_encounter(self, char):
        '''Applies the effects of a failed encounter to the character.
        '''
        pass
        # should apply negative effects: reduce health, happiness, fame

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: SimBrothel: -PyTFall- Dev Thread: Writers needed!
« Reply #321 on: February 20, 2013, 07:19:17 AM »
I'm still within text files and excel tabs now, but I'm willing to put it all into renpy code afterwards. It look like a repetitive work, so I should be able to do that if someone help me with first example.

After you're done with preparations, give me the most complicated interaction with as many hooks/conditions/requirements as possible and I'll write that code for you. You can work from there on your own and ask question if you get stuck with something.
Like what we're doing?

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: SimBrothel: -PyTFall- Dev Thread: Writers needed!
« Reply #322 on: February 20, 2013, 07:26:53 AM »
Hey guys,

here's the first version of an encounter system. The basic idea is to calculate a percentage, the capability, from the attributes of the character trying to master the encounter. Then the capability is checked five times against a random number between 0 and 99. Then, failures are counted. Very hard encounters allow no failures, very easy ones allow four failures. If the number of failed checks is not greater than the allowed number of failed checks, the encounter has been mastered. For a more detailed explanation, please look at the comments in the code below.

I'm not perfectly happy with the success percentages, but it's good enough I think.

Do you like the system so far?

The goal is that you can later write (for example):
Code: [Select]
trap = TrapEncounter()
trap.difficulty = 4
trap.characters = [warrior1, warrior2]
success = trap.run_encounter()

@Xela
I will use inheritance to implement this as not using it would multiply lots of code. However, if you insist, we can take the inheritance out when copying the code into RenPy.

The following code is untested, will contain typos and will not run. I show it here so you can review the comments and the basic system.

Code: [Select]
class BaseEncounter(object):
    '''Represents a problem questing characters have to master.
   
    Difficulty
    The difficulty describes how hard it is to master this encounter. It ranges
    from 'very easy' = 1 to 'very hard' = 5.   
   
    Mastering the encounter
    In order to master the encounter, the characters must pass a number of
    encounter checks equal to the difficulty, e.g. one check for a very easy
    encounter or three checks for a normal encounter. If they succeed within
    five tries, they master the encounter. If the characters fail at
    6 - difficulty encounter checks, e.g. 2 for a hard enounter, they fail the
    encounter and collectively suffer consequences.
   
    The encounter check
    A random number between 0 and 99 is rolled. If it is lower than the
    capability of the character, the check succeeds.
   
    Probability of failure at various capabilities and difficulties
    10% capability "Rookie"
        'very easy', one successful check needed to master encounter
            probability to fail one check: 1 - 0.1 = 0.9
            probability to fail all five: 0.9 * 0.9 * 0.9 * 0.9 * 0.9 = 0.59
            Rookies succeed at very easy encounters in 41 out of 100 tries.
           
        'very hard', five successful checks needed to master encounter
            probability to succeed on one check: 0.1
            probability to master all five: 0.1 * 0.1 * 0.1 * 0.1 * 0.1 =0.00001
            Rookies succeed at very hard encounters in 1 out of 10000 tries.
           
    90% capability "Master"
        'very easy', one successful check needed to master encounter
            probability to fail one check: 1 - 0.9 = 0.1
            probability to fail all five: 0.1 * 0.1 * 0.1 * 0.1 * 0.1 = 0.00001
            Masters succeed at very easy encounters in 9999 out of 10000 tries.
           
        'very hard', five successful checks needed to master encounter
            probability to succeed on one check: 0.9
            probability to master all five: 0.9 * 0.9 * 0.9 * 0.9 * 0.9 = 0.59
            Masters succeed at very hard encounters in 59 out of 100 tries.
    '''
    def __init__(self):
        self.difficulty = 3
        self.characters = []
       
    def capability(self, char):
        '''Returns how capable the character is at mastering this encounter.
       
        A percentage is returned. 100 means the character will master this
        encounter every single time. 1 means the character will master this
        encounter in 1 out of 100 tries (on average).
        '''
        # sub classes must implement this method
        return -1
       
    def most_capable(self, charlist):
        '''Returns the character most capable of mastering an encounter check.
        '''
        cap2char = {}
        for char in charlist:
            # there could be several chars with equal capability
            try:
                cap2char[self.capability(char)].append(char)
            except KeyError:
                cap2char[self.capability(char)] = [char]
        maxcap = max(cap2char.keys())
        most_capable = random.choice(cap2char[maxcap])
        return most_capable
       
    def take_check(self, char):
        '''A character takes an encounter check, returns True if successful.
        '''
        roll = random.randint(0, 99)
        if roll<self.capability(char):
            self.mastered_check(char)
            passed = True
        else:
            self.failed_check(char)
            passed = False
        return passed
           
    def mastered_check(self, char):
        '''Applies the effects of a successful encounter check to the character.
        '''
        # should increase character tiredness here
        char.tiredness += 20
        # could also increase happiness, experience, ...
       
    def failed_check(self, char):
        '''Applies the effects of a failed encounter check to the character.
        '''
        # should increase character tiredness here
        char.tiredness += 20
        # should also apply negative effects: reduce health, happiness
       
    def run_encounter(self):
        '''This will play out the encounter.
        '''
        msg = "no characters defined for encounter '%s'"
        assert self.characters, msg % self
        # determine the maximum number of failed checks
        maxfail = 5 - self.difficulty
        # perform up to five encounter checks
        failedchecks = 0
        for i in range(0, 5):
            checkchar = self.most_capable(self.characters)
            success = self.take_check(checkchar)
            if not success:
                failedchecks += 1
        # see if the characters mastered the encounter
        if failedchecks>maxfail:
            mastered = False
            for char in self.characters:
                self.failed_encounter(char)
        else:
            mastered = True
            for char in self.characters:
                self.mastered_encounter(char)
        return mastered
       
    def mastered_encounter(self, char):
        '''Applies the effects of a mastered encounter to the character.
        '''
        char.experience += (self.difficulty * self.difficulty)
        # could also increase happiness, fame
       
    def failed_encounter(self, char):
        '''Applies the effects of a failed encounter to the character.
        '''
        pass
        # should apply negative effects: reduce health, happiness, fame

Looks good, I do not have time to try it out right now, maybe later in the evening. Do not take anything out. Program as you see fit and I'll ask questions if something is not clear to me. Let's agree to work this way from now on, use any standard python/pygame libraries as you please. Avoid inheritances when possible but use it when it is an obvious advantage and writes better code.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: SimBrothel: -PyTFall- Dev Thread: Writers needed!
« Reply #323 on: February 20, 2013, 07:28:42 AM »
The goal is that you can later write (for example):
Code: [Select]
trap = TrapEncounter()
trap.difficulty = 4
trap.characters = [warrior1, warrior2]
success = trap.run_encounter()
Maybe some traits could increase or decrease probability of successful check a little (5-10%), regardless of stat value, for example Assassin or Warrioir in a fighting check, or Clumsy an a trap check.
Something like
trap.goodtraits = [assassin, warrior]
trap.badtraits = [clumsy]

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: SimBrothel: -PyTFall- Dev Thread: Writers needed!
« Reply #324 on: February 20, 2013, 08:23:13 AM »
Checking vs a random  to 99 is not correct. I assume that it is the skill being checked here. Some skills in Pytfall can go waaaay above 100.
j
Like what we're doing?

Offline rudistoned

  • Full Member
  • ***
  • Posts: 229
Re: SimBrothel: -PyTFall- Dev Thread: Writers needed!
« Reply #325 on: February 20, 2013, 09:02:04 AM »
@Xela
The random number (0 to 99) is checked against a characters capability for a certain encounter. This capability is defined as a percentage (1 to 100) and is calculated from the characters attributes (and possibly traits). It is the responsibility of the encounter to calculate the capability correctly.

@DarkTl
Factoring in traits is entirely possible and should be done in the implementation of the capability method of the respective encounter class, TrapEncounter in the given example.

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: SimBrothel: -PyTFall- Dev Thread: Writers needed!
« Reply #326 on: February 20, 2013, 10:24:43 AM »
@Xela
The random number (0 to 99) is checked against a characters capability for a certain encounter. This capability is defined as a percentage (1 to 100) and is calculated from the characters attributes (and possibly traits). It is the responsibility of the encounter to calculate the capability correctly.

@DarkTl
Factoring in traits is entirely possible and should be done in the implementation of the capability method of the respective encounter class, TrapEncounter in the given example.

Kewl. It sounds both fun and complex. We'll wait for rest of the code.

I will put on a couple hours in advanced logic of whore job tonight if time allows. Right now it's the most basic variant of itself.
Like what we're doing?

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: SimBrothel: -PyTFall- Dev Thread: Writers needed!
« Reply #327 on: February 20, 2013, 06:02:10 PM »
Did some good work on whore job tonight! Now it has skill checks, modifies more stats, more checks for refusals, splits income by house percentage and has a much more coherent code structure that I am beginning to adapt for all jobs. Also fixed a couple of small bugs that poped up here and there.



I would post code just for the fun of it but usual error gets in the way:

================================
The following error or errors occurred while posting this message:
The message exceeds the maximum allowed length (20000 characters)
================================

Already gave it a quick test, couple of pics will be attached to the post.

More and better texts are needed but there is still to much work left on logic for me to create a pastebin. In any case, I'll see if I can get some sleep now...

 
« Last Edit: February 20, 2013, 06:18:02 PM by Xela »
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: SimBrothel: -PyTFall- Dev Thread: Writers needed!
« Reply #328 on: February 21, 2013, 04:48:51 AM »
A couple of questions. Do we actually have, or supposed to have, or will have years in game's calendar? And if yes, which year is now ingame?

Also I'd like to make some cleaning in dropbox folder, since it becomes a bit messy. Does anyone still need pics I've uploaded in the very start of this thread, like advertising staff and so on? I'll just reorganize them if yes, and delete if no.
« Last Edit: February 21, 2013, 05:17:57 AM by DarkTl »

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: SimBrothel: -PyTFall- Dev Thread: Writers needed!
« Reply #329 on: February 21, 2013, 05:08:39 AM »
A couple of questions. Do we actually have, or supposed to have, or will have years in game's calendar? And if yes, which year is now ingame?

Not for the Sim Brothel version unless team feels like one is required. Maybe for WM version, but even there I cannot see significant advantage in it. I don't recall any good events in other games that used specific dates that cannot be just day numbers. Moon calender/Day of the week calender Rudi coded in on the other hand offers great possibilities.


Also I'd like to make some cleaning in dropbox folder, since it becomes a bit messy. Does anyone still need pics I've uploaded in the very start of this thread, like advertising staff and so on? I'll just reorganize them if yes, and delete if no.

I have them on my PC separately and I am likely to require those for interface design.
« Last Edit: February 21, 2013, 05:10:43 AM by Xela »
Like what we're doing?