Announcement

Collapse
No announcement yet.

Attn: Code warriors -- Social Model -- OOA

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

  • Attn: Code warriors -- Social Model -- OOA

    Just ran thru the new Social Model, thought I'd throw out there some thoughtz. Please help!!!

    I seems like we have --

    Behaviors:

    Government -- (use interface from the Govt model)
    Religion -- (new interface needed)
    Culture -- (I'm not sure, think this is a new interface)

    What else am I forgetting?

  • #2
    See, it seems to me that all the above are Objects, not interfaces... FE Culture has data about values of people in the culture. What am I not getting here? Are you using the terminology interface different from a java-style interface? Or are you saying these are objects that Also need interfaces?
    Project Lead for The Clash of Civilizations
    A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
    Check it out at the Clash Web Site and Forum right here at Apolyton!

    Comment


    • #3
      Hi, Mark:

      That's exactly why we need to have these hash sessions. I'm not sure, to be honest. My thinking was that there is no such thing as a 'government', 'religion' or 'culture', they aren't actual 'things'. Just the behavior/interaction of a collection of people.

      If so, then (like an 'ActionListener'), we code up some 'Command' objects that implement 'Government', each with it's own implementations of the desired methods (changeTaxRate(), setPolicy(Policy p), and that's how you can easily arrange it so people can easily code up a govt. You just show the coders the Interface, and tell them to write a class that implements it.

      And there are many, many other benefits. Perhaps the single biggest one is how easily it fits into a 'mediator' pattern. But I'll wait until after we define the objects and behaviors before getting into that one . . .

      So -- is a govt a 'behavior', or an actual thing?
      [This message has been edited by F_Smith (edited June 20, 2000).]

      Comment


      • #4
        F_Smith:

        Hi. These are my thoughts about this:

        In civ game world the objects are fairly self-explainatory. To code them, you only have to decide which of their real-world properties and behaviours are game-relevant.

        I think that none of the "behaviours" you mentioned shouldnt be coded as object, simply because they do not have evident behaviour of their own. They present simply a state, modified by other objects, so better way to represent them would be structs.

        That is if you feel such abstract and fuzzy things really need to be defined.

        It is a natural approach to try and model population so it has properties such as culture, religion and such.

        (I appologize if I missed the point entirely I dont follow design state of clash but code design is always interesting to me)

        Comment


        • #5
          Hi, Vet:

          Welcome to the chat. You're exactly the kind of person I'm hoping will be able to help us with this. I'm so new to OOA/OOD, I've got a lot to learn.

          I'm inclined to agree with you, tho, these seem to be the interactions of objects rather than actual objects.

          How do we model such things? I'm unfamiliar with 'structs' -- I'm afraid I'm a Java-only coder. What, exactly, is a 'struct'?

          Comment


          • #6
            Sorry for confusing you

            Struct is a c keyword used to describe a variable that has other sub-variables.

            The difference from a class (object in c) is that it doesnt have any functions (methods) in it. I think java is simmilar.

            When you try to define all objects you are going to be using in the game it is tempting to do this:

            Player has:
            civs, advisors, score ..

            Civ has:
            cities, technology, gold ..

            City has
            population, units, buildings ..

            Population has
            numberofpeople, tolerance, individualism ..

            And so on for all game-world objects. This is a natural approach taken with variations in all civ games.

            If you want to implement a complex model in the game, say Economy or Religion, you would derive them from low-level objects such as buildings, companies and population.

            Depends on your design models of course

            Comment


            • #7
              Hi VetLegion:
              Kibbitz all you want, we can use all the help we can get...

              BTW Economy (ProvEcon actually) is a base object so far, since we don't have complex objects like buildings...

              I think Govt etc are clearly objects. Where we most need the behaviors IMOBOVLI (In my opinion, based on very little info ) Is when the models start talking to each other.
              Project Lead for The Clash of Civilizations
              A Unique civ-like game that will feature low micromanagement, great AI, and a Detailed Government model including internal power struggles. Demo 8 available Now! (go to D8 thread at top of forum).
              Check it out at the Clash Web Site and Forum right here at Apolyton!

              Comment


              • #8
                IMOBOVLI.... wow!

                Hi Vetlegion. I hope you stay in this process and participate also in the OOA for the govt model. You seem helpful!

                Ok. I'm going to shoot. I'm going to kind of ignore what has already been said and tell you what I see is needed, using a little bit of OOA language I've just learned...

                Each ethnic group in the civ is (I guess) an object of the "ethnic groups" OOA class with the following info (in parenthesis the type of variable):
                NATIONALITY (text)
                PRIMITIVE RELIGION (single)
                GRW (pointer, pointing to a GRW object)
                GRW's SPREADING RATE (single)
                RELIGIOUSLY DISCRIMINATED (boolean-false/true)
                ETHNICALLY DISCRIMINATED (boolean)
                SLAVERED (boolean)
                ETHNIC TOLERANCE (integer)
                RELIGIOUS TOLERANCE (integer)
                AGGRESSIVENESS (integer)
                ASCETICISM (integer)
                INDIVIDUALISM (integer)
                IMPORTANCE OF RELIGION (integer)
                EDUCATION LEVEL (integer)
                TRADITIONALISM (integer)
                NATIONALISM (integer)
                LAND CONNECTION (integer)
                TV_ETHNIC TOLERANCE (integer)
                TV_RELIGIOUS TOLERANCE (integer)
                TV_AGGRESSIVENESS (integer)
                TV_ASCETICISM (integer)
                TV_INDIVIDUALISM (integer)
                TV_IMPORTANCE OF RELIGION (integer)
                TV_TRADITIONALISM (integer)

                TV stands for "Tendency Values".

                Each GRW (Great Religion of the World) is an object of another OOA class (GRW class). In this case these objects are at the "planet level" with this info:
                NAME (text)
                RELIGIOUS TOLERANCE (integer)
                AGGRESSIVENESS (integer)
                ASCETICISM (integer)
                INDIVIDUALISM (integer)
                SACRIFICE (integer)
                COUNTDOWN (long integer)
                HOLY LAND (pointer, pointing at a map square)


                For each civ you need 2 vectors of values ("Contact Variables" and "Acceptance Variables"), each with N elements, where N is the number of GRW allowed in the game. All can take values 0 or 1, but cannot be boolean because they're used in sums in some procedures.

                At the province level you need a dynamic array of ethic groups and their populations. "Dynamic" because the number of EGs can change as time passes. Example:
                Romans, 10000
                Franks, 70000
                Celts, 120000
                This same is needed at the map square level.


                For each civ you need one object like this: "Environment Values", with variables:
                RELIGIOUS TOLERANCE (integer)
                AGGRESSIVENESS (integer)
                ASCETICISM (integer)
                INDIVIDUALISM (integer)

                For each civ you need one object like this: "Majorities Cultural Attributes" (MCA), with variables:
                ETHNIC TOLERANCE (integer)
                RELIGIOUS TOLERANCE (integer)
                AGGRESSIVENESS (integer)
                ASCETICISM (integer)
                INDIVIDUALISM (integer)
                IMPORTANCE OF RELIGION (integer)
                NATIONALISM (integer)

                For each civ you need an object with the same variables MCA has, called "Religious Class Mentality". This one will be used only in the govt model.

                For each civ you need a list of civs the former has trade with. The list is called Known Civs List and it has the name of the civ and the number of trade routes with it, like this:
                Persia, 5
                China, 11
                France, 2

                Each civ needs a nationality.

                Procedures needed:
                >>>>For ethnic groups:
                >Change Nationalism and Land Connection
                >Change all TV_* attributes using Environment Values, MCA values and attributes Aggressiveness, Religous Tolerance, Individualism and Asceticism from the GRW object the GRW pointer in the ethnic group is refering to.
                >Change Religious Tolerance, Ethnic Tolerance, Traditionalism, Asceticism, Aggressiveness, Individualism and Importance of Religion using the civ's "Tendency Values".
                >Check acceptance of GRW, using GRW objects and civ's Contact Variables. Acceptance Variables can change after this procedure is applied.
                >Move population to ethnic group with the same nationality the civ has.
                >Create ethnic group from merging.
                >Change Education Level.

                >>>>For the GRW
                >Decrease Countdown, and if zero, give birth to GRW

                >>>>For civ
                >Create Environment Values
                >Create MCA values
                >Create Religous Class Mentality values.
                >Change Contact Variables picking a random civ in the Known Civs List.

                >>>>For the province
                >Sum square map level populations to have province level populations on a ethnic group basis.

                I hope that helped.
                Rodrigo

                Comment


                • #9
                  Vet:

                  A data structure, then.

                  Java, I believe, uses an object for that purpose. Because of that 'gang-of-four' book on patterns, that class has come to be called a 'command' object, since it is an object to handle/command the variable states of interacting objects. And this sub-class typically implements an 'interface', rather than extending an abstract class, in order to help seperate objects from behaviors.

                  Does this approach seem similar to a 'struct'?

                  And, as always, I may have misunderstood one or all of the ideas above, and am now swimming without a yacht in the middle of the south Pacific . . .

                  Comment


                  • #10
                    rodrigo:

                    Good job, man! Great contribution!

                    Overall, very solid. I might suggest a few changes, tho:


                    Relating to public class EthnicGroup--

                    1) Would you mind if I lumped 'PRIMITIVE RELIGION', GRW and GRW SPREADING RATE' into another object called 'Religion'?

                    2) Similarly, can 'RELIGIOUSLY DISCRIMINATE', 'ETHNICALLY DISCRIMINATED', 'SLAVERED', 'ETHNIC TOLERANCE', 'RELIGIOUS TOLERANCE', 'ASCETICISM', 'INDIVIDUALISM' and 'IMPORTANCE OF RELIGION' be combined into a 'Culture' object?

                    3) Again, 'EDUCATION LEVEL', 'TRADITIONALISM', 'NATIONALISM' and 'LAND CONNECTION' could become something like BodyPolitic, perhaps?

                    4) And absolutely we should encapsulate all the TV variables in a 'TendencyValues' object, agreed?


                    That's enough for now. I'll probably have a few more 'suggestions' later. I'm actually going to code up a quick prototype along those lines. Any changes/inputs from others is veeeeeeeeeery welcome -- I've never gotten anything exactly right the first time! (Well, maybe my daughter . . .)

                    Comment


                    • #11
                      F_Smith:

                      About your proposals:
                      "1) Would you mind if I lumped 'PRIMITIVE RELIGION', GRW and GRW SPREADING RATE' into another object called 'Religion'?"
                      It makes sense.

                      "2) Similarly, can 'RELIGIOUSLY DISCRIMINATE', 'ETHNICALLY DISCRIMINATED', 'SLAVERED', 'ETHNIC TOLERANCE', 'RELIGIOUS TOLERANCE', 'ASCETICISM', 'INDIVIDUALISM' and 'IMPORTANCE OF RELIGION' be combined into a 'Culture' object?

                      3) Again, 'EDUCATION LEVEL', 'TRADITIONALISM', 'NATIONALISM' and 'LAND CONNECTION' could become something like BodyPolitic, perhaps?"

                      I'd suggest this grouping instead:
                      group1
                      AGRESSIVENESS
                      INDIVIDUALISM
                      RELIGIOUS TOLERANCE
                      ASCETICISM

                      group2
                      EDUCATION LEVEL
                      IMPORTANCE OF RELIGION
                      NATIONALISM
                      TRADITIONALISM
                      LAND CONNECTION
                      ETHNIC TOLERANCE

                      group3
                      ETHNICALLY DISCRIMINATED
                      RELIGIOUSLY DISCRIMINATED
                      SLAVERED

                      This suggestion arises because of the calculations needed, so in each group calculations are kind of the same for each variable. In particular, group1 groups the same variables the Great Religions of the World OO-class contains as thier "moral codes".

                      "4) And absolutely we should encapsulate all the TV variables in a 'TendencyValues' object, agreed?"
                      agreed

                      Great! Keep on going, F_Smith!

                      Rodrigo

                      Comment


                      • #12
                        Alright!

                        Simple stuff to code up. I'm finished with coding the objects. We can change their details at will, and I'm betting that will happen, but it will be a simple matter to change the methods involved.

                        If anyone wants a copy, I'll send it to you. Altho it's pretty self-explanatory from the above. In fact, I'll make a post later tonight repeating the design hierarchy in as clear and concise a fashion as possible.

                        Next, on to the govt model, perhaps? Maybe this coming weekend . . .

                        Comment


                        • #13
                          Good!
                          I hope the social model document explains well most of the calculations needed in the methods. If you see something you don't understand, let me know.

                          Comment


                          • #14
                            Okay:

                            Open-source approach front and center, I suppose. Here's the beginnings of the code for the social model. Feel free to use this/change this/slam this/all of the above. This is just version .00001! I am not a genius. I need your help to do this right. I'm very sure I've missed a few of the changes that have been discussed over the last few days -- feel free to point out loudly whenever my natural ignorance leaked thru.

                            You can get all the source for both models I'm working on at http://home.austin.rr.com/lostmerchant/Clash/source/.
                            Code:
                            *******************************************
                            
                            import java.util.*;
                            
                            public interface Culture
                            {
                                public void         addTrait(Policy p);
                                public Policy       getTrait(String t);    
                                public Enumeration  getAllTraits();
                            }
                            
                            *******************************************
                            
                            import java.util.*;
                            
                            public class PopularCulture implements Culture
                            {
                                private String name;
                                private Vector traits;
                                
                                public PopularCulture(String n)
                                {
                                    name = n;
                                    
                                    traits = new Vector();
                                }
                                
                                public void addTrait(Policy p)
                                {
                                    traits.addElement(p);        
                                }
                                
                                public Policy getTrait(String t)
                                {
                                    Enumeration enum = traits.elements();
                                    
                                    while(enum.hasMoreElements())
                                    {
                                        Policy trait = (Policy)enum.nextElement();
                                        
                                        if(trait.equals(t))
                                        {
                                            return trait;
                                        }
                                    }
                                    
                                    return null;
                                }
                                
                                public Enumeration getAllTraits()
                                {
                                    return traits.elements();
                                }
                            }
                            
                            ***************************************
                            
                            
                            /**
                             * This data structure could be a simple HashMap instead, but making it an object
                             *   leaves room for further enhancement of the 'values' or implementations
                             *   of a 'policy' beyond a single integer.
                             * 
                             * @author The gang
                             * @version .00001
                             * @since Jun 2000
                             */
                             
                            public class Policy
                            {
                                private String name;
                                private int    value;
                                
                                public Policy(String n)
                                {
                                    name = n;        
                                }
                                
                                public Policy(String key, int value)
                                {
                                    name = key;
                                    setValue(value);
                                }
                                
                                public void setValue(int v)
                                {
                                    value = v;
                                }
                                
                                public int getValue()
                                {
                                    return value;
                                }
                                
                                public boolean equals(Object o)
                                {
                                    return o.equals(name);
                                }
                            }
                            
                            *****************************************
                            
                            import java.util.*;
                            
                            public interface Religion
                            {
                                public void         addReligousDoctrine(Policy p);
                                public void         addReligousDoctrine(String key, int value);
                                public Policy       getReligousDoctrine(String p);
                                public Enumeration  getAllDoctrines();    
                            }
                            
                            ****************************************
                            
                            import java.util.*;
                            
                            public class PrimitiveReligion implements Religion, Culture
                            {
                                private String name;
                                private Vector doctrines;
                                private Vector traits;
                                
                                public PrimitiveReligion(String n)
                                {
                                    name = n;
                                    
                                    doctrines = new Vector();
                                    traits = new Vector();
                                }
                                
                                public void addReligousDoctrine(Policy p)
                                {
                                    doctrines.removeElement(p);
                                    doctrines.addElement(p);
                                }
                                
                                public void addReligousDoctrine(String key, int value)
                                {           
                                    doctrines.removeElement(key);        
                                    doctrines.addElement(new Policy(key, value));
                                }
                                
                                public Policy getReligousDoctrine(String p)
                                {
                                    Enumeration enum = doctrines.elements();
                                    
                                    while(enum.hasMoreElements())
                                    {
                                        Policy pol = (Policy)enum.nextElement();
                                        
                                        if(pol.equals(p))            
                                            return pol;
                                    }
                                    
                                    return null;
                                }
                                
                                public Enumeration getAllDoctrines()
                                {
                                    return doctrines.elements();
                                }
                                
                                public void addTrait(Policy p)
                                {
                                    traits.removeElement(p);
                                    traits.addElement(p);
                                }
                                
                                public Policy getTrait(String t)
                                {
                                    Enumeration enum = traits.elements();
                                    
                                    while(enum.hasMoreElements())
                                    {
                                        Policy p = (Policy)enum.nextElement();
                                        
                                        if(p.equals(t))
                                            return p;                
                                    }
                                    
                                    return null;
                                }
                                
                                public Enumeration getAllTraits()
                                {
                                    return traits.elements();
                                }
                                
                                public String toString()
                                {
                                    return name;
                                }    
                            }
                            
                            *******************************************
                            
                            public class GreatWorldReligion extends PrimitiveReligion
                            {    
                                private int counter;
                                private MapSquare holy_land;
                                
                                public GreatWorldReligion(String n)
                                {
                                    super(n);
                                }
                                
                                public void setHolyLand(MapSquare h)
                                {
                                    holy_land = h;
                                }
                                
                                public MapSquare getHolyLand()
                                {
                                    return holy_land;
                                }
                            }
                            Now unless I've completely missed my boat, we will have 'EthnicGroups' that will hold a pop number, EG name, Religion object, Culture object, 'TendencyValues' object, and one other grouping of related vars. Each 'MapSquare' will have a collection of 'EthnicGroup' objects.

                            And there is still more to add to 'EthnicGroups', I should think. 'SocialClasses', for one. But that's for another post, since I didn't see a consensus on how social classes will work out (did I miss it? Please help!) . . .

                            P.S.-- feel free to mentally (or otherwise) switch the simple Vectors to better, Java2 collections. I'm trying to keep this Java 1.x for now, so I can post demos at a website that will work in IE5.

                            For now, anyway.
                            [This message has been edited by F_Smith (edited July 08, 2000).]

                            Comment


                            • #15
                              One quick thought about Social Classes -- if we have Govt also extend 'Culture', then perhaps the individual's cultural behavior can be determined by determining their social class:

                              The EG segment in the Ruling class use the cultural traits of their govt?

                              The Religous class uses the cultural traits of their religion?

                              Otherwise, use the cultural traits of the Ethnic group's culture?

                              Or, perhaps, some social classes have their own 'culture'? Intellectual class? Warrior class? 'Death Cult' class? 'Empath' class? Wizard class?

                              Each could have their own 'cultural traits'.

                              All of this seems very possible. Without any difficulty. Any thougths?

                              Comment

                              Working...
                              X