Announcement

Collapse
No announcement yet.

Planning for D6

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

  • #31
    It is frequently said of Java that errors which are runtime errors in other languages are compile errors in Java.

    The system of using strings rather than objects completely subverts that very large advantage of Java.

    It requires a lot of unnecessary code to test whether the string is a legitimate one. It requires a lot of unnecessary if then else code or search loops, rather than using polymorphism, to select the correct action.

    I cannot see where code like:
    sites = getSites("farm");
    is easier to manage than:
    sites = getSites(SiteType.FARM);

    The point is that the second one will not compile if SiteType.FARM doesn't exist or if it is incorrectly typed. The first will, if for example "ffarm" is typed by accident. So then I
    have to write code to check to see if that has happened. This I will not do.

    I did not suggest that the econ model should be restructured correctly (though, in the long run it would be a good idea), only that the interface to other models should use the robust system.

    Having been involved in a system with 12,000 classes the prospect of 50 specials doesn't worry me if it makes the code more reliable and decreases the debugging load.

    I am not really interested in "selling" anyone on good coding practices, I just refuse to use bad ones myself.

    Cheers

    Comment


    • #32
      Hi Gary:

      Originally posted by Gary Thomas
      It requires a lot of unnecessary code to test whether the string is a legitimate one. It requires a lot of unnecessary if then else code or search loops, rather than using polymorphism, to select the correct action.
      Error checking of the strings for everything in the econ model requires something like 15 lines of code total. There are no search loops or other such junk needed in the code I have that I know of. The names are keys in HashTables, which makes tracking down objects fairly fast. If you get null from the HashTable then you know something doesn't match up. See paragraph below your last quote if its not clear what I mean.

      I cannot see where code like:
      sites = getSites("farm");
      is easier to manage than:
      sites = getSites(SiteType.FARM);
      And when a scenario designer wants to add the resource 'bauxite' that we don't have, my approach works fine whereas your approach requires extra code to geterate SiteType.BAUXITE at runtime or some other hack. This counterbalances all the benfits you are espousing, and that I agree are real and significant.

      The point is that the second one will not compile if SiteType.FARM doesn't exist or if it is incorrectly typed. The first will, if for example "ffarm" is typed by accident. So then I
      have to write code to check to see if that has happened. This I will not do.
      You needn't do it, I've already done simple name checking and it is trivial. It returns an error message as soon as it comes across any name that doesn't match. If the "farm" sector doesn't find "farm" Resources, or "farm kapital" it squawks. It would choke on any "ffarm" resource. So although any errors are not found at compile they are apparent immediately at runtime.

      Seeing as you've said Resources should go in the econ package, it'll be my problem anyway. I am Not going to refactor the whole econ package right now just for this. So how about you make it internally good your way, but make it accept the strings? That way we are set to move to the FARM method at some TBD future point. I can just do it myself and take it off your hands. But I doubt you'd like the result .

      Lets just agree on something and get this going so I can kill the fake terrain .

      On Mine vs GoldMine, it does occur to me that it may be worth having at least a handfull of resource general types in there explicitly. FE Mine could have a type name field that could be "gold" or "tin" or... that way we could have the Mine objects override some methods in Resource that are finetuned to mining as opposed to Resources like Farmland, or Forest that behave differently.
      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


      • #33
        This was the result of a server busy message - the message got sent twice.

        Cheers

        Comment


        • #34
          And when a scenario designer wants to add the resource 'bauxite' that we don't have, my approach works fine whereas your approach requires extra code to geterate SiteType.BAUXITE at runtime or some other hack.
          It appears that I mistundestood the use of site types. If they are merely data (that is, read in from a scenario), then none of my comments apply. I had assumed that there was hard-coded information about them. Sorry about my confusion.

          If the strings are data, all I will do is search for the string and return 0 if it isn't found (that is, for example, no gold mines are present).

          I am still a little curious about how different site types do different things. Is this also specified in the scenario data?

          Does this fit your needs?

          Cheers

          Comment


          • #35
            Yeah, I guess returning 0 if there are no sites locally will work fine. If we can I'd like to include the "is the string a legal resource" test, but I can do that if you don't want to.

            I am still a little curious about how different site types do different things. Is this also specified in the scenario data?
            Economic sectors like farming or gold mining are named with strings. Usually a square will only have the four basic sectors (Food, Resources, Production, and Services [FRPS]) plus no or one special. Sectors know by a string name what resources they use. (Production works differently, I won't get into that here). Sectors produce a good named by a string. The named goods are either fundamental units in the economic system (FRPS) or are specials that can be converted into some combination of the basic goods. But the good part about specials is if in limited supply, they turn into Many units of the basic goods.

            If we don't include Bauxite in the game and someone wants to they put the info in an ini file (right now its done in static blocks, but I'll update that soon). The info describes how to:
            1. set up an "Aluminum" sector that
            2. uses the resource "Bauxite" (ore we can just call it "Aluminum" since that's what the output is),
            3. produces the good "Aluminum",
            4. has an "Aluminum kapital" infrastructure class that tells how many aluminum smelters are present, and
            5. enters a bunch of parameters that determine the math of how it all works in 1-4, including the conversion between Aluminum and basic goods.

            If we decide we want to go the route where Aluminum is needed to build aircraft, the system will be able to handle that too, but lets not go there right now .
            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


            • #36
              I'm getting close to the first feeble implementation of Merchants. And to make merchants interesting we need probably at least three economic specials. I thought I would post this so people had a chance to get in their opions if they're strong!

              Right now Gold is in there. Gold acts as Services when cashed in because Services = Money in the current system. A second one I'd like is Tin (assuming copper is widespread this means bronze). By my thinking Tin would change into Resources since it is a resource that helps make better mfg goods (it could also be Production). I'm looking for one more (or maybe two) ancient big specials. If we look for ones that match the remaining basic goods (Food and Production) I have a few ideas. Food could be Spices or Salt, since both help preserve food, and Production could be things like metalwares or cloth.

              Any ideas?

              Needless to say we'll have to characterize specials distributions in the scenarios fairly soon too. And maybe get artwork to show them?
              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


              • #37
                Exactly what specials isn't that important..Tin, Salt and maybe wool or cloth are OK.

                I have a paragraph on specials in the ecology version I'm working on (and which is delayed longer than I like..sorry!). I link their distribution to a few prerequisites (temperature, climate, and such) and after that it's probably best to limit them to provinces or at least continents, to avoid giving everyone the same.
                (This is limited to the living resources.)

                A question about production, though: while requiring specific inputs for specific products could be annoying while playing, have you considered separating just energy and resource sites? Resources have been fairly easy to attain and conserve during history, but getting energy in sizable amounts, and processing it, was problematic until the IR. Until then population was most important, but after that industrial development. In game terms, FE if you have power infra you can use energy as labor.

                Comment


                • #38
                  I suppose Wood is a Resource? It was a pretty important trade item in ancient times.

                  For Production, I suspect that the most important was harness for chariot or riding horses. The nomads couldn't make it and had to purchase it, particularly the metal bits (a pun!). On the other hand they had the horses.

                  Nails were another standard.

                  Incense was much desired.

                  Cheers

                  Comment


                  • #39
                    Gary:

                    I will send you the current econ code in about seven hours, and then you can go ahead and integrate and shuffle on Govt hierarchy to your heart's content. I'm assuming this fits with your plans, and if not, please fill me in. The reason this is a good time at least from my end is I have a heavy week in terms of RL and wouldn't get much done Mon-Wed anyway.

                    Do you want to do the game.econ type changes too while you have pretty much the whole code? (Need to hear from Laurent on this).

                    If you get the chance during all that stuff if you can throw in Resources next, I'm in a position to use them in testing the growing capabilities of Merchants.

                    Simon: I responded to your points in the main Econ thread.

                    The specials I have in so far are:
                    Gold -> Services
                    Tin -> Resources
                    Cloth -> Manufactured Goods
                    for Food maybe just Livestock?
                    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


                    • #40
                      I am currently busy with the game.military retailoring. The area that impact me most are some relocation problems between game.militray and game.model.military, due to other classes that reference the latter. I am slowly cleaning things up and seeing what changes are needed, so don't hurry in sending me something. I already have a mess to clean up, and will be looking into orders in particular. When I am clean enough so that econ begins being a real problem, I will ask for it and send my classes. For the moment it is too much of a mess...
                      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


                      • #41
                        Ok, Laurent, I won't send you any code until it will either make your wildest dreams come true, or you tell me you're ready
                        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


                        • #42
                          Haven't got immediate access to email, so I am using the forum.

                          I got D6 to compile!

                          Laurent: I might not have included all your new code in the version I sent you. I realized later that I got interrupted part way through incorporating it. I will check this when I get to my office in a couple of hours.

                          Cheers

                          Comment


                          • #43
                            Yippee! I have some minor mods I will send you in about an hour.
                            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


                            • #44
                              Gary and I have been talking over email on what to do for demo 5.1. What we have come up with between us is:

                              1. Roads Implemented. Perhaps to build them just have player draw an outline on the map and return a cost? And you'd only be able to build roads within your civ.

                              2. Civs with real provinces and territory in the scenarios. We will implement Gary's idea for borders (From map graphics thread).

                              3. Merchants (at least an alpha version)

                              4. Whatever else we come up with (Laurent?)

                              Whatcha think?

                              After that the next big step would be putting F_Smith's old govt/social code into the system to get a government model running. It would then be modified to match Rodrigo's new Gov't system. (At least the more important parts of it).

                              Technology is mostly coded, but we need to work with Richard to get the spec for individual technologies in the system before we can go anywhere.

                              And of course there are the military model enhancements, like ships, that will go in fairly soon.

                              Laurent:

                              I think for one of the demos soon it would be great to have a utility that would show the player all the values for elements, and units. Its not high priority, but it would help the players get the feel for what they are using. Perhaps this is premature though, and all we need is a couple of tables we can put in the manual. What do you think?
                              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


                              • #45
                                One enhancement that has been asked for several times (including by Mark) is an indication on the red moves track of how many moves it will take the unit to get there. For those of you who are familiar with Space Empires IV, I intend to use their system of a little number at the end of each line segment, 0 for the current move, 1 for the next move, and so forth.

                                I did code the infrastructure for this in D5 but didn't add the actual numbers, mainly because it meant farting around with text formatting. However I think I will add it for D5.1.

                                Cheers

                                Comment

                                Working...
                                X