Announcement

Collapse
No announcement yet.

Object Builder: Bug Reports

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ok, well there should also be ways to decrease its level also.
    Which Love Hina Girl Are You?
    Mitsumi Otohime
    Oh dear! Are you even sure you answered the questions correctly?) Underneath your confused exterior, you hold fast to your certainties and seek to find the truth about the things you don't know. While you may not be brimming with confidence and energy, you are content with who you are and accepting of both your faults and the faults of others. But while those around you love you deep down, they may find your nonchalance somewhat infuriating. Try to put a bit more thought into what you are doing, and be more aware of your surroundings.

    Comment


    • LGJ: Yes. I'm telling F_Smith to code KL as it was planned in the model, but it's final implementation is for sure something you and me will have to discuss in the social techs thread. KL is, undoubtly, a social tech.

      Comment


      • Rodrigo:

        Okay, we're about done. I fussed with the architecture a few different ways, and I think I've whittled it down to something that should work very well.

        This is important for you to know and understand, even tho is is highly code-related, so please bear with me if it seems too programmer-specific. But This is to allow you to know how the govt model's equations work in the game, and so Mark or anyone else can easily, quickly make changes to the govt model equations. We can even allow the tester to fiddle with the equations in the beast, if we want to.

        * * *

        The game's equations are going to be stored in 'Formulae' classes. Some sort of an object hierarchy for them will have to be worked up, but for now we've just got one -- GovtFormulae.

        Each equation has it's own 'method' -- getPeoplesPPPref, etc. The 'method name' will indicate exactly what it is for, so you should easily be able to find the equation you're looking for. All the govt models use the same formulae, so changing this class and recompiling the game changes the game.

        One word of warning -- I have been spending my time on the 'architecture' of the turn logic, not on specifically debugging these equations. I guarantee you I've gotten many/most/all of them in part/mostly/entirely wrong. And I'm sure I've even forgotten a few equations.

        So fix this for me, will ya?

        * * *

        So, on to the code:

        In the 'CivilizationTurnHandler', there is a method called 'oneYear()'. That method selects the appropriate 'GovtTurnHandler' (based upon which govt system is in use), and calls the method 'oneYear()' in the govt turn handler.

        That 'NegotiatedGovtTurnHandler' method 'oneYear()' currently goes thru the govt policies one by one and checks to see if it needs changing. Each policy setting method goes thru the groups with power, and multiplies their power % by the appropriate value return from the methods in 'GovtFormulae'.

        Code:
        public class GovtFormulae
        {
            /********************************************
             *    Ethnic Discrimination Preferences
             ********************************************/
            public int getPeoplesEDPref(CulturalAttributes culture)
            {
                int p = (1/(1+(5-(culture.getNationalism()/10)))) + ((100-culture.getEthnicTolerance())/10);
                
                return p;
            }
            
            public int getCapitalEDPref(CulturalAttributes culture)
            {
                int c = (1/(1+(5-(culture.getNationalism()/10)))) + ((100-culture.getEthnicTolerance())/10);
                
                return c;
            }
            
            public int getReligionEDPref(Religion state_religion)
            {
                int r = (1/(1+(5-(state_religion.getNationalism()/10)))) + ((100-state_religion.getEthnicTolerance())/10);
                
                return r;        
            }
            
            
            /********************************************
             *   Religious Discrimination Preferences
             ********************************************/    
            public int getPeoplesRDPref(CulturalAttributes culture)
            {
                int p = ((100 - culture.getReligiousTolerance())*5)/100;
                
                return p;
            }
            
            public int getCapitolRDPref(CulturalAttributes culture)
            {
                int c = ((100 - culture.getReligiousTolerance())*5)/100;
                
                return c;
            }
            
            public int getReligionRDPref(Religion state_religion)
            {
                int r = ((100 - state_religion.getReligiousTolerance())*5)/100;
                
                return r;
            }
            
            /********************************************
             *    Civil Rights Preferences
             ********************************************/
            public int getPeoplesCRPref(CulturalAttributes culture)
            {
                int p = culture.getIndividualism();;
                
                return p;
            }
            
            public int getCapitolCRPref(CulturalAttributes culture)
            {
                int c = culture.getIndividualism();;
                
                return c;
            }
            
            public int getReligionCRPref(Religion state_religion)
            {
                int r = state_religion.getIndividualism();
                
                return r;
            }
            
             
             
            /********************************************
             *    Private Property Preferences
             ********************************************/
            public int getPeoplesPPPref(CulturalAttributes culture)
            {
                int p = (1/(1+(5-(culture.getNationalism()/10)))) + ((100-culture.getEthnicTolerance())/10);
                
                return p;
            }
            
            public int getCapitolPPPref(CulturalAttributes culture)
            {
                int c = (1/(1+(5-(culture.getNationalism()/10)))) + ((100-culture.getEthnicTolerance())/10);
                
                return c;
            }
            
            public int getReligionPPPref(Religion state_religion)
            {
                int r = (1/(1+(5-(state_religion.getNationalism()/10)))) + ((100-state_religion.getEthnicTolerance())/10);
                
                return r;
            }
              
            /********************************************
             *    Slavery Preferences     
             ********************************************/
             public int getPeoplesSlaveryPref(CulturalAttributes culture)
            {
                int p = (int)Math.round(2*Math.sqrt((100 - culture.getEthnicTolerance()) * (100 - culture.getAsceticism())/1000));
                
                return p;
            }
            
            public int getCapitolSlaveryPref(CulturalAttributes culture)
            {
                int c = (int)Math.round(1.2*2*Math.sqrt((100 - culture.getEthnicTolerance()) * (100 - culture.getAsceticism())/1000));
                
                return c;
            }
            
            public int getReligionSlaveryPref(Religion state_religion)
            {
                int r = (int)(2*Math.sqrt((100 - state_religion.getEthnicTolerance()) * (100 - state_religion.getAsceticism())/1000));
                
                return r;
            }
            
            /********************************************
             *    Economic Planning Preferences     
             ********************************************/
             public int getPeoplesEPPref(CulturalAttributes culture)
            {
                int p = (1/(1+(5-(culture.getNationalism()/10)))) + ((100-culture.getEthnicTolerance())/10);
                
                return p;
            }
            
            public int getCapitolEPPref(CulturalAttributes culture)
            {
                int c = (1/(1+(5-(culture.getNationalism()/10)))) + ((100-culture.getEthnicTolerance())/10);
                
                return c;
            }
            
            public int getReligionEPPref(Religion state_religion)
            {
                int r = (1/(1+(5-(state_religion.getNationalism()/10)))) + ((100-state_religion.getEthnicTolerance())/10);
                
                return r;
            }
            
            /********************************************
             *    Social Policy Preferences     
             ********************************************/
             public int getPeoplesSPPref(CulturalAttributes culture)
            {
                int p = (1/(1+(5-(culture.getNationalism()/10)))) + ((100-culture.getEthnicTolerance())/10);
                
                return p;
            }
            
            public int getCapitolSPPref(CulturalAttributes culture)
            {
                int c = (1/(1+(5-(culture.getNationalism()/10)))) + ((100-culture.getEthnicTolerance())/10);
                
                return c;
            }
            
            public int getReligionSPPref(Religion state_religion)
            {
                int r = (1/(1+(5-(state_religion.getNationalism()/10)))) + ((100-state_religion.getEthnicTolerance())/10);
                
                return r;
            }
        
            /********************************************
             *    Foreign Policy Preferences     
             ********************************************/
             public int getPeoplesFPPref(CulturalAttributes culture)
            {
                int p = culture.getAggressiveness();
                
                return p;
            }
            
            public int getCapitolFPPref(CulturalAttributes culture)
            {
                int c = culture.getAggressiveness();
                
                return c;
            }
            
            public int getReligionFPPref(Religion state_religion)
            {
                int r = state_religion.getAggressiveness();
                
                return r;
            }    
        }

        Comment


        • F_Smith: I'm writting only to tell you I'll do my best to understand this code and help. Just be patient if I take some time to give you feedback.

          Comment


          • F_Smith:

            I decided not to comment your code post above. If you want I can do it anyway, but I felt the update to the new system (with People and Capitalists instead of classes directly) should be made right now and we're still working with the original model, as your code shows. I didn't want to comment your code because it's better IMO to start coding things as they really should be. Also, in the last days I've been working in ways to add some extra flexibility for social classes based on Axi's approach of the "contributions" and I think we should implement this now that we can instead of correcting things later.

            Again, if you prefer to go with the original plan, we can just save what I have made for later. Just tell me.

            What follows is the way I think things should be implemented to allow a greater flexibility. It partly is what the govt update was about and it also includes other approaches for modeling behavior. I hope nothing here involves a deep change to what you already have coded. Most equations shown are just the same you've seen already.

            A SYSTEM WITH A LITTLE EXTRA FLEXIBILITY

            1. We'll have 4 "families" of behaviors. Each family has its own equations to model behavior. Each social class defined is assigned to one of these families and will act in the game according to the respective behavior using the respective equations. The 4 families are:
            • Socioeconomic Family
            • Religious Family
            • Military Family
            • Administrative Family


            2. Each social class will have preferences of its own for Directly Negotiated Policies. A social class DOESN'T have a preference for individual Ideologically Negotiated Policies, but instead a set of Support Shares for ideologies. If there're M available ideologies, there're M+2 Support Shares for each social class:

            Govt Profile Support Share
            Ruler's Govt Profile Support Share
            Ideology1 Support Share
            Ideology2 Support Share
            ......
            IdeologyM Support Share

            3. Each social class needs a Population (long integer) instead of a demographic share. Population can change as the game evolves. Also, each social class needs the following variables, all in the 0-100 range:
            • Individual value
            • Ethics value
            • Warfare value
            • Kapital value
            • Innovation value
            • Literacy value
            • Administration value


            All values in this list are fixed for the game. They're set by the scenario designer or are pre-set in the default game. These will be called Behavioral Modifiers.


            4. The Default Game (the on-the-beast-default-game, really)
            For the default game we'll have 5 social classes:
            Upper Class (UC) Socioeconomic
            Middle Class (MC) Socioeconomic
            Lower Class (LC) Socioeconomic
            Religious Class (RC) Religious
            Warriors Class (WC) Military
            Bureaucratic Elite (BE) Administrative

            For those classes, Individual, Kapital, Ethics, Warfare and Administration values are (in the same order):
            UC: 1, 100, 0, 0, 0
            MC: 1, 20, 0, 0, 0
            LC: 1, 0, 0, 0, 0
            RC: 1, 0, 100, 0, 0
            WC: 1, 0, 0, 100, 0
            BE: 1, 0, 0, 0, 100

            I'm not specifying values for Innovation and Literacy because they don't have an effect here in politics.


            5. We'll have 5 "political blocks". People, Capitalists, Clergy, Administrative and Military. Each block merges ALL individual classes in a certain way. This means each political block has a preference for all policies and the political structure (pol.power shares) which are built merging preferences of individual social classes.

            6. The number of social classes may vary from game to game as set by scenario designers and players' starting options, while the number of political blocks (5) is always the same. The govt model will work with political blocks instead of social classes directly. Whenever a govt decision is called for negotiations or voting, we use, for the policy in question, political blocks' preferences.


            7. How Political Blocks' Preferences are Calculated?

            7.1. Directly Negotiated Policies
            The political block's preferences are computed aggregating social classes' preferences. Social classes' preferences are computed as described in point 8.

            For a given policy P (like Foreign Affairs, FE), a political block's preference is found computing this sum:

            Class1_P*Class1_Population*Critera1
            +Class2_P*Class2_Population*Critera2
            +....
            +ClassN_P*ClassN_Population*CriteraN

            and then dividing the result by this sum:

            Class1_Population*Critera1
            +Class2_Population*Critera2
            +...
            +ClassN_Population*CriteraN

            where:
            N is the total number of social classes.
            ClassX_P is social class X's preference for policy P.
            ClassX_Population is class X's population.
            CriteriaX depends on the political block being processed. If the political block corresponds to People, then CriteriaX is social class X's Individual value. If the political block being processed is Capitalists, then CriteriaX is social class X's Kapital value. CriteriaX is social class X's Ethics value if we're dealing with the Clergy block. CriteriaX is social class X's Warfare value if it's the military block. CriteriaX is social class X's Administration value if it's the administrative block.


            7.2. Ideologically Negotiated Policies

            We'll make just like DNP, but in DNP the values ClassX_P can be read directly from social class X. This is not true for INP because social classes don't have individual preferences for each INP. They only have Support Shares for available ideologies. Then, to use the same equation exposed in 7.1., we have to compute each ClassX_P for social class X and for each INP (5 pol.power shares and PrivateProperty, SocialPolicies and EconomicPlanning). This is made like this:

            ClassX_P=
            GovtProfileSupportShare_X*GovtProfile_P
            +Ruler'sGovtProfileSupportShare_X*Ruler_P
            +SupportShare1_X*Ideology1_P
            +SupportShare2_X*Ideology2_P
            +.....
            +SupportShareM_X*IdeologyM_P

            where M is the number of available ideologies, GovtProfile_P is the current value for pol.powershare/policy P, Ruler_P is the ruler's preference for pol.powershare/policy P and IdeologyK_P is the value for pol.powershare/policy P in ideology K.



            8. Social Classes' Preferences
            (all computations here in section 8 are at the social class level)

            In 7 we assumed social classes had already a preference for each DNP and they had Support Shares for ideologies. That info was just used in 7. Here's where I explain how to create that info.


            8.1. Socioeconomic Family
            To model behavior of social classes belonging to this family, cultural info is used. References here to cultural attributes are assumed to be taken from the ethnic group the social class belongs to.

            8.1.1. Directly Negotiated Policies
            (slavery, ethnic discrimination, religious discrimination, foreign affairs and civil rights)

            Slavery: (1+(0.002*Kapital))*2*SQRT((100-EthnicTolerance)*(100-Asceticism)/10000), rounded to the closest integer.

            ED: (1/(1+EXP(5-(Nationalism/10)))*(100-EthnicTolerance)/10, rounded to the closest integer.

            RD: (100-ReligousTolerance)*5/100, rounded to the closest integer.

            FA: Aggressiveness*(0.8+(0.002*Kapital))

            CR: Individualism


            8.1.2. Ideologically Negotiated Policies
            (For a later post. Here is where Support Shares are created)


            8.2. Religious Family
            As in the socioeconomic family, cultural info is used. In what follows, if the cultural attribute appears alone, the ethnic cultural attribute must be used directly. But if a "$" appears with it, it cannot be used directly, but like in this example:
            Individualism$=E_Individualism*(1-((IR*0.8)+0.2))+R_Individualism*((IR*0.8)+0.2)

            where IR is the ethnic attribute Importance of Religion, E_Individualism is the ethnic attribute Individualism and R_Individualism is the religious attribute Individualism for the religion the ethnic group follows.


            8.2.1. Directly Negotiated Policies
            (slavery, ethnic discrimination, religious discrimination, foreign affairs and civil rights)

            Slavery: (1+(0.002*Kapital))*2*SQRT((100-EthnicTolerance)*(100-Asceticism$)/10000), rounded to the closest integer.

            ED: (1/(1+EXP(5-(Nationalism/10)))*(100-EthnicTolerance)/10, rounded to the closest integer.

            RD: (100-ReligousTolerance$)*5/100, rounded to the closest integer.

            FA: Aggressiveness$

            CR: Individualism$


            8.2.2. Ideologically Negotiated Policies
            (For a later post. Here is where Support Shares are created)


            8.3. Military Family

            8.3.1. Directly Negotiated Policies
            (slavery, ethnic discrimination, religious discrimination, foreign affairs and civil rights)

            All policies are computed like this:

            H*(MC_People*People_X + MC_Capitalists*Capitalists_X + MC_Ruler*Ruler_X + MC_Clergy*Clergy_X)

            where People_X is current People's preference for policy X. Capitalists_X, Ruler_X and Clergy_X are understood the same way.

            MC_Ruler=(1-SIGN(E_ED+E_RD))*EXP(-0.03*(110-(Ruler_Polpower*100)))

            MC_People=(1-MC_Ruler)*People_pol.power/(1-Ruler_Polpower-Military_Polpower)

            MC_Clergy=(1-MC_Ruler)*Clergy_pol.power/(1-Ruler_Polpower-Military_Polpower)

            MC_Capitalists=(1-MC_Ruler)*Capitalists_pol.power/(1-Ruler_Polpower-Military_Polpower)

            where E_ED and E_RD are the ethnic group's attributes Ethnically Discriminated and Religiously Discriminated.

            H is a constant depending on the policy:
            Slavery: H=1
            ED: H=1.1
            RD: H=1
            FA: H=1.2
            CR: H=0.9


            8.3.2. Ideologically Negotiated Policies
            (For a later post. Here is where Support Shares are created)

            8.4. Administrative Family

            8.4.1. Directly Negotiated Policies
            (slavery, ethnic discrimination, religious discrimination, foreign affairs and civil rights)

            Slavery: (1+(0.002*Kapital))*2*SQRT((100-EthnicTolerance)*(100-Asceticism)/10000), rounded to the closest integer.

            ED: (1/(1+EXP(5-(Nationalism/10)))*(100-EthnicTolerance)/10, rounded to the closest integer.

            RD: (100-ReligousTolerance)*5/100, rounded to the closest integer.

            FA: Aggressiveness*(0.8+(0.002*Kapital))

            CR: Individualism


            8.4.2. Ideologically Negotiated Policies
            (For a later post. Here is where Support Shares are created)


            Notes

            Note1: The way I see it, there should be a OO-class called social class which in time has three OO-subclasses, one associated to one of the 4 families of behaviors. A social class would be an instance of one of these OO-subclasses. In this way, a social class would use the behavioral equations that correspond to the OO-subclass to which it belongs to.

            Note2: Although political blocks "contain" or "group" social classes, the groups overlap. That is, a social class can appear in none, one or more than one political block.

            Note3: An scenario designer creating a social class will put it in the right family (Socioeconomic, Religious, Administrative or Military) and will set the Ethics, Kapital, Innovation, Warfare, Individual, Administration and Literacy values for it (Behavioral Modifiers). I know the meaning of these is not completely clear to you, but I'll explain myself later. For now, it is sufficient to know that Behavioral Modifiers act changing behavior within a family of behavior creating slight different behaviors and then achieving greater flexibility.

            Note4: The goal is greater flexibility in the number and "abilities" of classes. All the above don't allow it as it is now because I still have to solve some things. But the idea of grouping social classes in families of behavior and allowing a setting of social classes via Behavior Modifiers will let us expand the system some more. This is not complete, yet!

            Note5: The model is still the same in essence. We'll just have a lot more classes (if desired) with some more features. But, this is not the promised land either!!! Don't dream you can now put in here whatever social class your wild imagination can come up with.

            Note6: Axi, if you have any comments on this post, please e-mail me and don't put it here! That way F_Smith and I can concentrate here on implementation rather than on theoretical discussions. Of course, if you see something REALLY bad, put the warning message right here.


            How does this sound, F_Smith?
            [This message has been edited by roquijad (edited September 13, 2000).]
            [This message has been edited by roquijad (edited September 24, 2000).]

            Comment

            Working...
            X