Announcement

Collapse
No announcement yet.

Population, demography, and recruits

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

  • #16
    I agree that these improvements are a good idea, but do not give them a high priority. There are very many other things, particularly AI which I give a higher priority.

    As to the calculations, you don't have to do them - I will, and they will be hidden in the population data object. I do not see it as at all complicated.

    Cheers

    Comment


    • #17
      I want to have militia before AI because AI will have to take militia into account, so it would be better if it was already in when we start on AI. And AI is the first thing I wanted to code in Clash so I'd rather go for it but I don't think it is time yet.
      I'll add whatever methods I need in Population classes, and additional data I need in order to test. You will then change the internals as you see fit.
      That is not as if it aws a lot of work either. I'll spend much more time on the actual militia stuff.
      Clash of Civilization team member
      (a civ-like game whose goal is low micromanagement and good AI)
      web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

      Comment


      • #18
        I have started coding. This is a bit code-verbose, so I put in bold things which are of interest to non coders.
        Here is what I need to know:
        1)In a square how many people of each Ethnicity are able to fight.
        2)For each Ethnicity how it relates to attacking and defending civ.
        3)To deal damage only to the adult/fighting population of the Ethnicity.

        1) I can retrieve by Ethnicity without changing the APIs.
        2) I could call EthnicGroup.getNationality() but don't know how to retrieve EthnicGroup objects from the square. So I use Administration.getEthnicDiscrimination based on the civ government. Militia will rise to support either the attacking or defending government, if that government's ethnic discrimination is twice less than the other government's discrimination. If discriminations are both 0, noone rises. This sinulates a population welcoming foreigners as "libertador". They may revolt afterwards, but that is another problem (think Columbia vs. Ecuador...)
        3) I have to know the number of fighting people per Ethnicity (thus in PopulationElement). This means storing additional data in PopulationData, and transmitting it to PopulationElement. I keep saying this is awkward, as we will have to replenish this fighting population based on calculus I find too complicated to do. Thus I skip a separate adult/fighting population now, and consider everyone can fight. One fifth of available population may be enlisted. This is because mainly of laziness in front of what I consider to be a complex modelization and the fact that Mark doesn't want too much detail.
        I still have trouble removing population from the PopulationGroup as I have to carry on a PopulationData argument around when I only need a PopulationElement. It can be done, but I find it awkward. I will do it, but I have to complain somewhere.
        As a side note:
        Distinction between EthnicGroup and Ethnicity is not clear in the code (at least some APIs seem to confuse one another). I may end up renaming some methods for consistency's sake if I have to use them.

        Another point is what kind of elements are created when a militia arises. Note that I say elements. This won't be a unit, and they won't profit from mixed arms tactics and such. They will be the poorest army available...
        But I would like to make the element choice based on tech. When there are hunting rifles available, militia is more efficient than clubmen militia. This would mean a backward civ liberating a square of its own people may find people better armed revolting. Should there be any special tech bonus there?
        I don't know the tech model enough, but are there RP's transmitted when a square is conquered? Particularly if that square is full of friendly (to the conqueror) population?
        Clash of Civilization team member
        (a civ-like game whose goal is low micromanagement and good AI)
        web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

        Comment


        • #19
          Hi Laurent:

          Just a few comments...

          Originally posted by LDiCesare
          2) I could call EthnicGroup.getNationality() but don't know how to retrieve EthnicGroup objects from the square. So I use Administration.getEthnicDiscrimination based on the civ government. Militia will rise to support either the attacking or defending government, if that government's ethnic discrimination is twice less than the other government's discrimination. If discriminations are both 0, noone rises. This sinulates a population welcoming foreigners as "libertador". They may revolt afterwards, but that is another problem (think Columbia vs. Ecuador...)
          Ummm.... This doesn't make any sense to me. The people will have an affinity for a government, possibly Despite its ethnic discrimination (ED) settings. The whole idea of ED is there is a Favored EG in each civ that is not subject to ED. The way you have it, it seems to me that if a German area in WWII were taken over by the allies, the local Germans would rise up in favor of the Allies if they had much better ED settings than the Nazis. Generally if the civ doesn't discriminate against an EG, it shouldn't bother that EG.

          Until the right social model stuff is hooked up, I'd just say we should have two states. An EG in a square has "affininty" for a civ, or it doesn't. If the EG name is essentially the same as the civ name of one of the combattants then we define it as having affinity. It will welcome troops from that civ with open arms, and will fight with those troops against someone else. If there is no affinity then maybe the criterion you used in 2 could apply. However I'm not sure that's the best long-term answer. Maybe the best response of a local militia is to stay out of a fight and let the two armies potentially beat each other to death.

          This would mean a backward civ liberating a square of its own people may find people better armed revolting. Should there be any special tech bonus there?
          Maybe, but seems like another D13 issue .

          I don't know the tech model enough, but are there RP's transmitted when a square is conquered? Particularly if that square is full of friendly (to the conqueror) population?
          No, nothing like that yet.
          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


          • #20
            I am OK for a preferred civ. That actually exists as EthnicGroup.getNationality(). I would have used it, but I don't know how to retrieve an EthnicGroup from a square.
            I would think ethnic discrimination is high for any ethnicity you do not know. And Germans wouldn't rise against Germans as they are the favored ethnicity of the civ, hence GermansCiv.getEthnicDiscrimintaion(GermansEthnicit y) currently returns 0.

            I can either:
            - find a way to retrieve the EthnicGroup from the Ethnicity and the square, and use getNationality(). I am not clear about the distinction between Ethnicity and EthnicGroup I must confess. Why is the getNationality() on EthnicGroup rather than Ethnicity?
            - put the getNationality() data in Ethnicity.
            - keep what I did - which I am tempted to do as your only argument doesn't hold, since Germans won't revolt against Germans with that code.
            Clash of Civilization team member
            (a civ-like game whose goal is low micromanagement and good AI)
            web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

            Comment


            • #21
              Hey Laurent:

              but I don't know how to retrieve an EthnicGroup from a square.


              public Iterator populationIterator() in PopulationData returns a PopulationElement iterator. From that you could compare Ethnicity with all of the PopulationElements if desired. I'd say just tell Gary what methods you need in PopulationData, and it should be easy to implement.

              keep what I did - which I am tempted to do as your only argument doesn't hold, since Germans won't revolt against Germans with that code.


              That's fine by me at this point. We can always revisit it later. Is nationality actually set in the code? A lot of the social model stuff is not fully functional.
              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


              • #22
                I am unsure of what is going on here. I have completely rewritten and moved the population code (from game.population) to my new structure system, so any changes to population and ethnic groups will be lost when I have finished the economics/social/administration refactoring (in about two weeks).

                Bearing this in mind, all the calls will be different.

                The code Laurent is proposing seems to be pretty much in the social model, and the consequences of trying to implement it now are worrying.

                Ethnicity is the generic ethnic affiliation (Roman, Gaulish, Iberian). Ethnicity is generic, that is, all those of Roman Ethnicity have characteristics in common, in fact the name, and the social groups that that Ethnicity has.

                An EthnicGroup has an Ethnicity and a population. Hence an EthnicGroup inherits the SocialGroup structure of the Ethnicity.

                Cheers

                Comment


                • #23
                  My point is: I want to know the Ethnicities and their relative population in the square. For each Ethnicity I want to know which civ it likes most between those that fight on its soil. If it vastly prefers one of them, then it will consider mustering a militia.
                  Right now, Government.getDiscrimination(Ethnicity) provides one way to find it, and EthnicGroup.getPreferredNationality() another one, except EthnicGroup objects are unreachable from my code.
                  Gary, if you change the whole population stuff, I also need a getFightingPopulation() method in PopulationElement or something like that. This is the amount of peopla able to contribute to the army (basically the adults). Not all of it will be taken in the militia.
                  Clash of Civilization team member
                  (a civ-like game whose goal is low micromanagement and good AI)
                  web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

                  Comment


                  • #24
                    I have made a first implementation of militia. I lack things from the population point of view (no way to know what civilization a given ethnicity supports, lack of definition of available fighting population).

                    Anyway here are the first results:
                    Delenda scenario.
                    1/5th of the population of a square will rise as Warriors to help the defender if they give odds to win between 0.75 and 1.75 (random factor). They won't raise militia if odds are already more than 1.75. It would produce too many useless militia if Ithey rised every time.

                    The effects on gameplay are often little, but sometimes it makes a difference. Like when an exhausted 5000-man Hannibal attacks a slight 5000-man defended Rome. Suddenly 30000 Romans rise and rout the Carthaginians. Most of the time, however, the armies are too numerous and powerful for the militia to show their head.
                    When militias do appear, they rarely take much damage.
                    This is because they usually are used to outflank the opponent. Most damage is sustained by regular armies. I can probably change that if needed, but then all damage will probably be sustained by militia instead of regular army.
                    The amount of damage sustained is often 0, otherwise around 1-3% of total millitia. F.e. 830 dead in around 25000 militia and 67 in 6500 militia.
                    Clash of Civilization team member
                    (a civ-like game whose goal is low micromanagement and good AI)
                    web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

                    Comment


                    • #25
                      Hi Laurent, that looks pretty good to me!

                      I don't much like the militia never taking damage though... Is there an easy way to mix them in randomly with the normal troops? Anyway, those are my thoughts at the moment.

                      I'm still fighting over D7.1 stuff. Found a bug and when I fixed it, now the balance of things in dawn is different... will email on that shortly.

                      Cya,

                      Mark
                      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


                      • #26
                        I modified the code slightly and now it runs quite fine.
                        Here are 3 examples of fights where milita helped. Note these occurrences are not that many, mainly because in Delenda the armies are big and phalanxes and legions are way stronger than militia (warriors).
                        You can see that I have latins fighting Romans in the last example, which is silly, but hey that is why I want some Ethnicity stuff.

                        Battle 1)
                        Roman armies
                        lost 590 health in long-range fights
                        Attack: 589600 down to 530052
                        Defense: 22 down to 21
                        Health: 10000 down to 8538
                        Cost: 1460 down to 1291
                        12427 Gauls fought in militias, 3209 died.

                        Carthaginian armies
                        lost 897 health in long-range fights
                        Attack: 659549 down to 8325
                        Defense: 22
                        Health: 10200 down to 136
                        Cost: 2062 down to 27

                        Analysis: Carthage had an edge to begin with. Gaul milita made the difference. Thus it can affect game play as you will have to plan militias. Note militia and regular army took damage. Militia got more damage, but they are crap army to start with, so that is quite good.

                        Battle 2)
                        Roman armies
                        lost 798 health in long-range fights
                        Attack: 510128 down to 0
                        Defense: 21 down to 0
                        Health: 8245 down to 0
                        Cost: 1243 down to 0

                        Carthaginian armies
                        lost 350 health in long-range fights
                        Attack: 1041829 down to 931011
                        Defense: 24
                        Health: 16108 down to 14398
                        Cost: 3194 down to 2848
                        24969 Gauls fought in militias, 1074 died.

                        Analysis: Carthage had an edge but somehow the militia felt they were needed. It is a bit strange here as it seems Carthage was 2 vs 1, but there are a few more figures that go into the equation which don't show here. Anyway militia took half damage sustained by regular army here.

                        Battle 3)
                        Roman armies
                        lost 716 health in long-range fights
                        Attack: 606314 down to 25408
                        Defense: 22 down to 20
                        Health: 10000 down to 325
                        Cost: 1460 down to 55

                        Carthaginian armies
                        lost 460 health in long-range fights
                        Attack: 1363845 down to 951470
                        Defense: 27 down to 27
                        Health: 16563 down to 11128
                        Cost: 3385 down to 2366
                        31079 Latins fought in militias, 0 died.

                        Analysis: Latins shouldn't fight Romans during the Punic war! Again, militia rises when not eally needed. Here they took no casualty. This may be because they didn't fight much. Fights last several ticks, I log militia even if they fight only a single tick. If the militia outflanked Romans, thus reducing them to 1 vs 2, the militia wouldn't fight the following battles (ticks), which can explain the low damage. If this needs explanation in-game, I can try to add the number of ticks fought in the output, but I don't want it to grow too much.
                        Clash of Civilization team member
                        (a civ-like game whose goal is low micromanagement and good AI)
                        web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

                        Comment


                        • #27
                          Hi Laurent, looks great, aside from the issues you've already noted. I like the fact that it doesn't come into play all that much when there are reasonably-sized armies.

                          One issue is that looking forward, it should be possible to form a militia from a local area of several squares, or even perhaps an entire province to fight an invader. Another D13 issue, but I thought I'd raise it.
                          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


                          • #28
                            Bring on the Militia!

                            I have gone ahead and implemented a way for the people in a square to find out if they have affinity for a given civilization. This will support figuring out if a militia will muster in a square to resist occupation, and if so whose side they fight on. It uses the ethnic discrimination (ED) value as was suggested by Laurent. (Laurent, I have sent you the code changes. All modified code has the comment tag //*M*.) there will be some implementation issues with the way I have chosen, but I wanted to keep the modifications of the existing code to a minimum. For the militia code, at least for now, we will use the civ.getGovernment().getEthnicDiscrimination(ethnic ity) method of figuring out how much the people like the troops. An ethnic group (EG) can get its ethnicity using, surprisingly, the getEthnicity method. The requirements to support this in the XML scenario file are:

                            1. There needs to be ruler preferences set for all governments of civs. I think this is mostly true already in the scenario files. In any case I will send a new delenda file that has that included. The correct long-term way to figure out ethnic discrimination is to consult the government profile of the civ. In Gary's refactoring of the government code that has been turned off, so I just use the ruler preference for getting the ED instead. That's ruler preferences are required. The XML for ruler preferences is under civilization-government-ruler.

                            2. We need to set the preferred ethnicity (ethnicity that is favored by the government) in the civilization-government section of the XML scenario file. Usually it is just set to the ethnic group with the same name as the civilization.

                            Once these are in the scenario file, civ.getGovernment().getEthnicDiscrimination(ethnic ity) will determine the given government's treatment of people of that ethnicity. Ethnicities that are a civ's preferred one have an ethnic discrimination value of 0. From a militia perspective they should always come to the aid of their civ's troops, and attempt if practical to fight off innovators. Ethnicities that are not preferred in a given civ have the civ government's default ED value. For ancient governments we are assuming that the levels of ED are fairly high, may be in the range 0.4-1. It seems to me that the higher ED value an EG has in a potential conquering civ, the stronger should be the resistance from a militia perspective. Eventually other concerns should enter into this decision, but we are keeping it simple for now

                            To sum up what I think has been said earlier in this thread, and where we are now... When troops whose civ has an ED of 0 for the ethnicity are fighting in the square, militia will support those troops against any opponents. This is just the case of conquered or invaded Romans fighting with the Roman legions against the Carthaginians. Militia will also resist invasion by any civ that has an ED that is nonzero with respect to their ethnicity (provided its not futile). This is the case where Romans are invaded by the Carthaginians but no Roman normal troops are available. However, Gauls, and perhaps Iberians, will resist conquest by either side. Just to be clear though, as the code currently works the Gauls will not rise up by themselves to throw out the Romans that have previously conquered them. Once the square is controlled by a civ I'm assuming that that civilization's troops can move freely through it, or remain there without being attacked by militia.

                            Some issues:

                            One problem with the current scenarios is that for instance in delenda, the Punic war scenario, both Rome and Carthage are multi-ethnic civs. As things are currently set up those of Roman ethnicity are only in a single square, with the balance of the Empire being Latins and Gauls. I think at least for the Latins they should resist Carthaginian conquest similarly to the Romans. The Gauls might actually be ambivalent between Roman and Carthaginian rule. Anyway, so that things work sensibly with respect to the militia, I propose that we change all the Latins to Romans for the moment.

                            Any opinion as to whether the Gauls should support Roman defense of their territory, or remain neutral? In real life it would be a complicated decision. We could assume that if there is a large ED difference between the two civs, that the militia would rise for the better side. Perhaps the amount of militia would also be proportional to the ED difference between the civs, maybe with some bias to remain in the civ they're already with.

                            If an independent square is invaded by foreign troops from two different sides I'm not sure what happens either. Again it's moderately complicated. Suggestions?

                            In a square with more than one EG, it is possible that militia could arise that splits its allegiance between two sides. I think this is only natural, but thought I would state it explicitly just so that no one is surprised when it happens. Laurent, does the code work that way?

                            This will get us pretty close to completing objective 2 in the Demo 7.2 Proposal thread.

                            Anyone interested in early playtesting of the militia features for D7.2 should let us know in that thread.
                            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


                            • #29
                              Multi-ethnic squares will be able to split militia. They are actually more prone not to provide militia even if they wanted to fight together because they don't know if the other ethos will join in (e.g. if you have 5000 ethnicA and 5000 ethnicB who both support civ1, they would both fight if they knew they were 10000 to do so, but, being only 5000, they may well decide they are not numerous enough).

                              I think there should be ethnicity relationships of a sort, so that Latins are more "like" Romans than Gauls (maybe families/class hierarchies of ethnicities, like Indo-European/Latin/Roman - with the question of how new Ethnicities come to be - Italians from Romans, Lombards etc. for example). That could allow to decrease ED for sibling ethnicities for instance.
                              Clash of Civilization team member
                              (a civ-like game whose goal is low micromanagement and good AI)
                              web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

                              Comment


                              • #30
                                Originally posted by LDiCesare
                                Multi-ethnic squares will be able to split militia.
                                good!

                                I think there should be ethnicity relationships of a sort, so that Latins are more "like" Romans than Gauls (maybe families/class hierarchies of ethnicities, like Indo-European/Latin/Roman - with the question of how new Ethnicities come to be - Italians from Romans, Lombards etc. for example). That could allow to decrease ED for sibling ethnicities for instance.
                                We've talked about this before in the Social Model IIRC. And I think its a good idea for several reasons. But it may be addressable by just taking the vector difference between the social parameters of the two ethnicities. At least that's what I recall.

                                I'm not sure though that this is the way to do it for militias though. FE in civil wars the cultures are the same, yet they hate each other. Perhaps more of what would be needed is to have the relationship of each ethnicity kept track of for each civ that it has significant experiences with. But that's a Demo 12 kinda thing IMO.
                                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

                                Working...
                                X