Announcement

Collapse
No announcement yet.

Planetfall

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

  • #61
    Maniac,

    Not sure if you still need SDK help, but I am a C++ and Python programmer and could donate a few hours a week to this project as needed. Let me know.

    Either way, I would like to see your DLL changes if you are amenable. I am trying to discover at this point the "capabilities" of core DLL changes versus Python changes.

    Comment


    • #62
      Planetfall could always use more programmers! At least if you're serious about it. Most people who offer their help, never actually end up doing something.

      Are you familiar with Civ4 rules and gameplay? Have you had previous experience with the Civ4 SDK, are you aware of the basic structure, or do you still need to lay your first eyes on it?

      When installing Planetfall plus the latest patch, you'll find the SDK files in the CvGameCoreDLL folder. A file comparison program is your friend. Searching the files for 'planetfall' will also guide you towards *most* of the changes.

      Btw, Planetfall is having trouble with an occasional random and unrepeatable crash. Fortunately Civ4 can generate crashdumps. Unfortunately I don't know how to read those. Have a look at this and this thread perhaps. Do you have a program which can read those crashdumps? If I supplied you with a crashdump, would you be willing to have a look at it and see if you notice something understandable? Or take a screenie of whatever you say? Perhaps it rings a bell with me.
      Contraria sunt Complementa. -- Niels Bohr
      Mods: SMAniaC (SMAC) & Planetfall (Civ4)

      Comment


      • #63
        I am familiar with the gameplay and becoming more familiar with the rules. I am just now making my way through the SDK (both C++ and Python) each evening and I figure that a directed "problem" would be the most effective way to get my feet wet. I program all day in C++ and Python (and C# and Java) so understanding/modding code is not an issue for me. I own AC as well but am less familiar with it but would love to know more of those rules as well. I will look into your issues this evening to see if I can dig up anything.

        Comment


        • #64
          Originally posted by AZSportsFan
          I figure that a directed "problem" would be the most effective way to get my feet wet.
          Problem is, at this point all the easy stuff has already been done by me.

          Well, there's one exception. Someone else said he'd do it, but he hasn't been heard of in two weeks, so I can only assume he's a goner.

          Here's the walkthrough I wrote for him. If you want, you can do this to get a first taste with the SDK.

          ***

          Well, the ability for buildings to provide fresh water health to their city would be useful. This requires a new XML tag. And knowing how to add an XML tag is a very important skill to learn.

          For some background
          Spoiler:
          The philosophy behind starting positions in unmodded Civ4 is to make them all very similar. For Planetfall I'd like starting positions to be more different, and balance is provided by there being tech paths to follow which have synergies with different starting positions. So for instance if you start in the middle of the Jungle or fungus, you could go Biogenetics or Xenobiology for the health. If you start in the middle of the arctic or the desert, you can go research recycling and pressure dome technologies. The end result is there is much more variety in early gameplay and tech b-lines.
          So regarding fresh water, in unmodded civ, access to fresh water health for your capital is practically ensured. For Planetfall it isn't assured, but you should quickly be able to research towards a building which gives it: the Hydro Plant.


          In other words, a boolean 'bFreshWater' XML tag, and the SDK code to make it do something, would be needed.

          Here's a tutorial on how to add XML tags.

          For starters, in this case this means adding that XML tag to CIV4BuildingsSchema.xml.
          In CIV4BuildingInfos.xml under BUILDING_HYDRO_PLANT a [bFreshWater]1[/bFreshWater] line would need to be added. (wrong type of brackets, but Apolyton feels the need to remove all text between > and <. ) I have no idea if this is stating the obvious or not, but in BuildingSchema you can set the new tag to MinOccurs=0 (or something like that, just mimic an example). That way that tag doesn't need to be added to every single building in BuildingInfos.xml. If the tag is absent, the building will just have the default value of that tag as defined in CvInfos.cpp.

          The next step is making the SDK aware of the existence of that tag. This is done in CvInfos.cpp and CvInfos.h. Looking at another boolean tag, it should be self-evident what needs to be added under cvbuildinginfo.

          Right, now the SDK can read those tags, but it doesn't do anything with them yet.

          For that we need to move to CvCity.cpp and CvCity.h, more precisely the CvCity:rocessBuilding function. That one is run when a building is added or removed in a city. We can mimic the code structure of another boolean function in processBuilding to see what's needed. For instance changeGovernmentCenterCount. Translated to the freshwater case, this means adding getFreshWaterCount, isFreshWater and changeFreshWaterCount functions. Don't forget to add these to the (header) file.

          In addition, the freshwatercount should be set to zero in CvCity::reset. And whether or not the city has a freshwater building should be added to the save file reading and writing. This is done in CvCity::read and CvCity::write. Important here is that the order of the items that are read and written is the same. Otherwise you get crashes when loading save files.

          Now a city knows if it has a freshwater providing building or not. But the city doesn't actually get the freshwater health bonus yet.

          If we wanted the plot to gain fresh water, we would have to go to the CvPlot::isFreshWater function I believe. But that would allow you to build fresh water requiring terrain improvements next to the city. And the idea behind the Hydro Plant is more that because of recycling technology, you can maintain a population even in an arid area, not that you can suddenly irrigate and cultivate a whole desert. That's what Condensers are for.

          Because of this, we can just stay in the CvCity.cpp file, more particularly the CvCity::updateFreshWaterHealth function I believe.

          I believe we just need to change the line
          Code:
          if (plot()->isFreshWater())
          to
          Code:
          if (plot()->isFreshWater() || isFreshWater())
          and it'll probably work.
          We're in the CvCity file, so the code knows we're talking about the CvCity function called isFreshWater().

          For finishing touches, it would be neat to have a note in Civilopedia if a building provides FreshWater. Most text is created in the CvGameTextMgr.cpp file. We're talking buildings here, so we go to CvGameTextMgr::setBuildingHelp. Again, just mimic the code of another boolean tag.

          There already is an TXT_KEY_IMPROVEMENT_FRESH_WATER text tag which could be used here too.
          Code:
          	
          		TXT_KEY_IMPROVEMENT_FRESH_WATER
          		[ICON_BULLET]Provides fresh water
          		[ICON_BULLET]Provides fresh water
          		[ICON_BULLET]Provides fresh water
          		[ICON_BULLET]Provides fresh water
          		[ICON_BULLET]Provides fresh water
          	
          (text made invisible again, please quote the post to see the contents...)

          Or perhaps that might cause confusion because the city plot doesn't actually get fresh water. So perhaps a new tag saying "Provides fresh water health" might be better. Whatever. If you want to add it, I'd suggest adding it to TextInterface.xml.


          So, how's my guide? Too complex? Or is it too simple now??

          In any case, best way to get to know the SDK is just kinda read parts of it, see which parts refer to what parts etc. Eg doing Windows Grep searches, seeing where a certain function is all referenced, to what other functions that leads etc, gives a feel for how the SDK is constructed.
          Last edited by Maniac; October 2, 2008, 14:45.
          Contraria sunt Complementa. -- Niels Bohr
          Mods: SMAniaC (SMAC) & Planetfall (Civ4)

          Comment


          • #65
            PM sent

            Comment


            • #66
              Maniac,

              Your guide is right on - almost too good . I do have a question though. So, a building has a bRiver or a bGovernmentCenter. So, from the code itself, it is not readily apparent if the flag is saying "This building must be next to a river" or not. I would guess that is the meaning of bRiver. But on bGovernmentCenter, does it mean "This building must be built in the government center", or "This building makes this city the gov center"?

              EDIT: Through some more poking, I see that bGovernmentCenter on the building means that it makes the a city a government center for maint costs (A Palace, for instance), and that you can only have one gov center building per city. It makes sense in game-speak (you can't put Versailles on your palace) but the names don't quite match intent in some places. Other checks of course make sure that you can't build two palaces. I'll learn em all yet. Sorry for the newbie ramblings.

              At any rate, the code change is nearly done and then I will need to do some testing. Should have something back to you this weekend.

              I think that it is more apparent to keep the function names/vars around the "BonusFreshWater" name as opposed to just FreshWater. Either way is ok in the end, but it seems that "bonus" means what it says a little better and may avoid confusion/collisions in the future. What say ye?

              Also, do you need this method CvCity::hasBonusFreshWater() available from Python?
              Last edited by AZSportsFan; October 3, 2008, 15:13.

              Comment


              • #67
                Originally posted by AZSportsFan
                At any rate, the code change is nearly done and then I will need to do some testing. Should have something back to you this weekend.
                Cool!

                I think that it is more apparent to keep the function names/vars around the "BonusFreshWater" name as opposed to just FreshWater. Either way is ok in the end, but it seems that "bonus" means what it says a little better and may avoid confusion/collisions in the future. What say ye?
                I... completely disagree.

                Civ4 uses the 'isBlah' format for all boolean functions. Even though it may make more grammatical sense to say hasFreshWater, I don't want to divert from the Civ4 standard. In the end that will cause more confusion if there's this limited set of functions which don't follow the rules. Now there's isBlah, getBlah, changeBlah, updateBlah, processBlah... You immediately know what kind of function you're dealing with.

                Also bonus resources like gold, wheat, oil etc are everywhere referred to in the code as 'Bonus'. Naming a tag hasBonusFreshWater will to a new reader give the incorrect impression a bonus resource is involved somehow. Again, it will cause more confusion in the end.

                Thus isFreshWater() seems best to fit with the Civ4 standards.

                Also, do you need this method CvCity::hasBonusFreshWater() available from Python?
                That's not needed. Just a waste of your time (unless you want to practice enabling something in python of course)
                Contraria sunt Complementa. -- Niels Bohr
                Mods: SMAniaC (SMAC) & Planetfall (Civ4)

                Comment


                • #68
                  Originally posted by Maniac
                  Planetfall could always use more programmers! At least if you're serious about it. Most people who offer their help, never actually end up doing something.

                  Are you familiar with Civ4 rules and gameplay? Have you had previous experience with the Civ4 SDK, are you aware of the basic structure, or do you still need to lay your first eyes on it?

                  When installing Planetfall plus the latest patch, you'll find the SDK files in the CvGameCoreDLL folder. A file comparison program is your friend. Searching the files for 'planetfall' will also guide you towards *most* of the changes.

                  Btw, Planetfall is having trouble with an occasional random and unrepeatable crash. Fortunately Civ4 can generate crashdumps. Unfortunately I don't know how to read those. Have a look at this and this thread perhaps. Do you have a program which can read those crashdumps? If I supplied you with a crashdump, would you be willing to have a look at it and see if you notice something understandable? Or take a screenie of whatever you say? Perhaps it rings a bell with me.
                  The .dmp files are meant to be read by Visual Studio. Do a search on DMP files and it should give you some info. Unfortunately, that .dmp file is good for your specific DLL and situation. When I compile I don't get the same size dlls as you do, so I don't think it will do me any good.

                  Planetfall gets a number of "asserts" when run - not sure if vanilla BTS does as well, but you may want to run with a debug DLL and see if you recognize any of the asserts....

                  Comment


                  • #69
                    No problem on the naming thing...

                    I don't think that just using updateFreshWaterHealth() to handle the "isFreshWater()" is going to work. I am not yet through debugging, but it doesn't seem like CvCity::init() is called enough (about the only thing that calls updateFreshWaterHealth()) to do any good. Also, it seems that we need to update some other health variable(s) in the processBuilding method....

                    Comment


                    • #70
                      Originally posted by AZSportsFan
                      The .dmp files are meant to be read by Visual Studio. Do a search on DMP files and it should give you some info. Unfortunately, that .dmp file is good for your specific DLL and situation. When I compile I don't get the same size dlls as you do, so I don't think it will do me any good.
                      I just read the wiki entry, but it doesn't really enlighten me.
                      What Visual Studio version is needed? For Civ4 only DLLs compiled by some 2003 program work - newer versions don't. Is it the same for these dump files?

                      I have made some minor changes myself since patch g was released. The dump file was from a game using that DLL. However the problem also exists in patch g games. Would you be able to read a dump from a patch g game?

                      Also I don't really understand. So that dump file is used to create a DLL? What do you need to do with that DLL then??

                      Planetfall gets a number of "asserts" when run - not sure if vanilla BTS does as well, but you may want to run with a debug DLL and see if you recognize any of the asserts....
                      Yeah I know. For a list of them, see this bug list. Note that list is long since outdated. All bugs have been solved. Except for the "specialist interface malfunction", for which I don't know what the number between the brackets is supposed to be. On the bottom there's list of asserts though which were encountered during the 3.13 phase of Planetfall. Were those you encountered on this list, or new ones?

                      In any case, back then those asserts didn't seem to cause any problems or crashes. I can only guess those asserts point to situations the Civ4 developers didn't expect ever to happen (eg a promotion reducing movement points) but which aren't actually problematic if they do happen.
                      In any case, it would be useful to know the source of these asserts, in case you'd ever want to focus on that.

                      Originally posted by AZSportsFan
                      I don't think that just using updateFreshWaterHealth() to handle the "isFreshWater()" is going to work. I am not yet through debugging, but it doesn't seem like CvCity::init() is called enough (about the only thing that calls updateFreshWaterHealth()) to do any good.
                      Good catch.
                      Solution is to include updateFreshWaterHealth() in the changeFreshWaterCount function. It's similar to the changeGovernmentCenterCount function. The check should happen where the GET_PLAYER(getOwnerINLINE()).updateMaintenance(); line is in the government center function.

                      Also, it seems that we need to update some other health variable(s) in the processBuilding method....
                      I don't understand. What's the problem?
                      Last edited by Maniac; October 3, 2008, 21:19.
                      Contraria sunt Complementa. -- Niels Bohr
                      Mods: SMAniaC (SMAC) & Planetfall (Civ4)

                      Comment


                      • #71
                        Patch v5i is available. This patch needs to be installed on top of the version 5 main file.
                        It will break savegames from earlier patches.

                        Changelog:

                        1. "The Lord's Conclave" has been renamed to "Manifest Destiny".
                        2. Manifest Destiny is researched by Atmospheric Transformation.
                        3. Ascetic Virtues is researched by High Pressure Containment.
                        4. Great People names added, by Beaver.
                        5. Flame Thrower art by SeZereth added.
                        6. All faction leaders have a hated civic which they cannot run.
                        7. Sea Colony Pod cost now correct.
                        8. Centauri Hydrology allows Water Working.
                        9. Fungal Towers cause collateral damage.
                        10. Genejack Factory cost reduced to 90 hammers.
                        11. Monsoon Jungle cannot be chopped, only replaced by another feature.
                        12. Oil resource provides +1 happiness.
                        13. Tree Farm added as a building. It provides +1 energy to Forest and Hybrid Forest.
                        14. Tree Farm terrain improvement removed.
                        15. Centauri Preserves can't be built adjacent to each other. They increase the Flowering Counter.
                        16. Temple of Planet provides a free specialist per Centauri Preserve within the base's range.
                        17. Settlement and Eden provide +1 happiness, but give one less food than currently.
                        18. Hydro Plant provides Fresh Water health to its base. Thanks AZSportsFan.
                        19. Further cityset art progress by GeoModder.
                        20. Kelp and Mining Platform or Tidal Harness can no longer co-exist. Mining Platform now produces 2 minerals; Tidal Harness 3 energy.
                        21. Kinematics no longer boosts Sea Windmill yield.

                        Please post save games of any persistent crashes you may encounter. At least as long as you don't play on Large sized maps, as these make my computer cry.

                        Planetfall is brought to you by:

                        Contraria sunt Complementa. -- Niels Bohr
                        Mods: SMAniaC (SMAC) & Planetfall (Civ4)

                        Comment


                        • #72
                          Patch v6d is available. This patch needs to be installed on top of the version 6 main file.
                          It will break savegames from earlier patches.
                          Please post save games of any persistent crashes you may encounter.

                          Changelog:

                          1. Ridges can't have features.
                          2. Land and immobile units can blockade.
                          3. Bases never starve due to food shortages. Instead maintenance cost increases, and unless you're running Enclosed Biosphere there is a chance for drone riots.
                          4. More tech quotes added, by Shakiko.
                          5. Genejack Factories now let Drones produce three minerals.
                          6. Former ignores terrain movement cost and can move across cliffs (lowland<->ridge).
                          7. Reworked promotion and special ability system.
                          8. Spartan units provide military happiness. No civic needed.
                          9. Politics civics and Power value civic effects changed.
                          10. A fungal bloom can only happen on plots neighbouring fungus.
                          11. Temporary: Spore Launcher can't do ranged strikes.
                          12. Diplo music by Flouzemaker.
                          Contraria sunt Complementa. -- Niels Bohr
                          Mods: SMAniaC (SMAC) & Planetfall (Civ4)

                          Comment


                          • #73
                            Version 7 of Planetfall has been released. There also already is a patch "a" fixing some bugs discovered after uploading the main file.

                            Changelog:

                            1. Psychic Terror promotion available for Native Life. Targets weakest unit in stack. Thanks to Kael.
                            2. Precision special ability available for Submarines. Targets weakest unit in stack.
                            3. Genejack Factory now costs 120 minerals.
                            4. Units on Highlands and Ridges are +20% stronger.
                            5. Religions give their bonus even when not the state religion.
                            6. Relgions give more varied boni. For example Voice of Planet gives a +1 Planet.
                            7. Religious "bonus facilities" removed.
                            8. Missionary and Ascetic now cost 60 minerals.
                            9. Six secret projects added: Unity CryoBay, Unity Hydroponics Bay, Unity Library, Unity Mining Laser, Unity Observation Bay & Unity Reactor.
                            10. Material Supplies can build these secret projects.
                            11. Being the first to circumnavigate the globe no longer gives +1 water movement.
                            12. Cruiser and Hovertank models fixed by The_Coyote.
                            13. Geothermal Spa and Ski Vacation resources removed.
                            14. APC special ability now correctly allows double movement on flat terrain.
                            15. Updated PlotLSystem by GeoModder.
                            16. Infantry unit added, available with Nuclear Physics.
                            17. Fission Reactor removed.
                            18. Uranium, Helium and Rubidium now provide health.
                            19. Fusion Plant renamed Nuclear Reactor. Provides +1 health with Uranium, Helium, Iridium and Rubidium.
                            20. High Pressure Containment and Quantum Mechanics techs removed.
                            21. Various unit/building tech prerequisite changes.
                            22. Maintenance Bay no longer gives an Engineer slot.
                            23. Hybrid Forest mineral production is only increased by +1 with the Hybrid ecology civic.
                            Contraria sunt Complementa. -- Niels Bohr
                            Mods: SMAniaC (SMAC) & Planetfall (Civ4)

                            Comment


                            • #74
                              Patch v7d has been released. This patch needs to be installed on top of the version 7 main file.
                              For a change, I don't think it will break savegames from the previous patch c.

                              Changelog:

                              1. Gamefont with new icons added, by .Teodosio.
                              2. Nerve Stapler special ability now requires Mind-Machine Interface.
                              3. Fungus growth rate varies with mapsize and # of players.
                              Contraria sunt Complementa. -- Niels Bohr
                              Mods: SMAniaC (SMAC) & Planetfall (Civ4)

                              Comment


                              • #75
                                playing my first game now. do you need someone to fill in datalinks entries? my programming skills are naught, but i may be able to fill in a few blanks for y'all.
                                I wasn't born with enough middle fingers.
                                [Brandon Roderick? You mean Brock's Toadie?][Hanged from Yggdrasil]

                                Comment

                                Working...
                                X