Announcement

Collapse
No announcement yet.

CODE/DESIGN: Building & Wonder flag limit removal

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

  • CODE/DESIGN: Building & Wonder flag limit removal

    Just a little progress report...

    Currently I'm working on removing the limitations on how many Buildings and Wonders can have an effect on the game.

    I'm using an adapted (included serialization, for game saves, and full cell access for network functionality) STL Bitvector to do the work of storage, instead of UINT64's.

    I tested the concept of this on "achievements" which uses uint64's to store game "achievements" basically whether sea cities have been built, intended to trigger access to the different map layers, but wasn't needed, since they fudged the issue.

    Bitvectors work fine, compile fine and run fine... I have to do some testing on MP, however.

    I'm currently working on implementing city improvement and wonder flags this way... and the concept is essentially the same, except that there are hundreds more references to them.

    A big issue is that you have to be really careful not to overload a virtual network packet (max 8192 bytes- frame size for CTP2 data, not TCP) by including too much data, or you'll have fragmented sends.

    I don't see this as a big limitation... although we'll probably be limited to say... a max of 1024 flags (E.G. 1024 each of Wonders and City Improvements.)

    If it becomes an issue, I'll split out separate network packet structures for them.

  • #2
    ROFL. There is just so much to change, with these bitvectors...

    Its amusing to note that the code contains some wonderful nuggets such as
    Code:
    C:\ctp2\ctp2_code\gs\gameobj\[b]UnitData.cpp[/b](294):
    sint32 wonderHPBonus = wonderutil_GetIncreaseHP
    ([b]g_player[m_owner]->m_builtWonders[/b]);
    Essentially the code is liberally sprinkled with public member variable access, when the access should almost always be public function returning protected/private member var.

    Comment


    • #3
      Small implementation choice question...

      Code:
      #define k_MAX_BUILDINGS 64
      #define k_MAX_WONDERS 64
      
      sint32 buildings[k_MAX_BUILDINGS + k_MAX_WONDERS];
      This code is in CityData:estroyRandomBuilding

      There was obviously some thought or intent to theoretically destroy Wonders with this code, however, wonders are ignored by the subsequent code.

      My thought is that wonder destruction should probably be intentional and deliberate instead of being lumped in with a random destruction effect, so we should leave wonders out of this...

      Comment


      • #4
        You are right but we should allow for the idea of attacks on wonders.



        “something like a small amount of explosives under the forbidden city should do it”
        "Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
        The BIG MC making ctp2 a much unsafer place.
        Visit the big mc’s website

        Comment


        • #5
          Right... however, it can be achieved through SLIC, unless there is some game effect that should include the destruction of Wonders by default...

          Bombardment?
          Conquest?

          If there is any interest in this we should vote and decide a specific implementation method.

          Comment


          • #6
            (specific random destruction, that is)

            Comment


            • #7
              I was looking through citydata.cpp and noticed that nanoinfections can destroy wonders. I think there's a few other obscure cases like this.

              Comment


              • #8
                Destroying wonders should also have a HUGE reputation hit too.
                Formerly known as "E" on Apolyton

                See me at Civfanatics.com

                Comment


                • #9
                  To who the destroyer or owner.
                  "Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
                  The BIG MC making ctp2 a much unsafer place.
                  Visit the big mc’s website

                  Comment


                  • #10
                    I think that if you destroy a wonder you should get the same amount of points subtracted from your score that the builder got added to his/her score for building it. It would at least discourage such a nefarious act! I mean really folks, could you even imagine destroying the colisseum or the pyramids??

                    If you build a wonder, it should give you some advantage. But the good part about some of the latter wonders is that they give the player that didn't build it the chance to compensate by building city improvements. (ie Internet Wonder=Computer Centers)

                    BTW, it's annoying as all get out that you can still build city improvements when you have already been given the equivalent advantage by building the wonder. (once again, the Internet Wonder). Even if you build them it doesn't help you because the wonder already took care of it! Can't we just remove those city improvements from the list of improvements for the build que once you have the wonder?? You can always make the CIs available again if the wonder is destroyed or captured.
                    Last edited by epeterson; February 18, 2004, 13:08.

                    Comment


                    • #11
                      BTW, it's annoying as all get out that you can still build city improvements when you have already been given the equivalent advantage by building the wonder. (once again, the Internet Wonder). Even if you build them it doesn't help you because the wonder already took care of it! Can't we just remove those city improvements from the list of improvements for the build que once you have the wonder?? You can always make the CIs available again if the wonder is destroyed or captured.
                      This was fixed before through SLIC IIRC so it shouldnt be a problem.
                      Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
                      CtP2 AE Wiki & Modding Reference
                      One way to compile the CtP2 Source Code.

                      Comment


                      • #12
                        Its kind of a choice a player has to make... IMO

                        Essentially the reasoning for still allowing you to build an improvement after you've gotten a particular Wonder, is that the virtual buildings that are created can disappear, and you might want to anticipate that, and build actual, real life buildings in their place.

                        If the city with the wonder in, is conquered, they disappear (for the original player,) as they would if the city was destroyed, or the wonder became obsolete.

                        Building a replacement wouldn't happen instantly, and a player should be given opportunity to have these building effects be uninterrupted.

                        Its a (reasonable) design decision, not a bug.

                        Comment


                        • #13
                          Yes so we should get the benefit of the buildings .
                          "Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
                          The BIG MC making ctp2 a much unsafer place.
                          Visit the big mc’s website

                          Comment


                          • #14
                            "Ohhhhhh, I see!", said the blind newbie.

                            But...instead of giving them the buildings, why not just give them the equivalent science bonus and not make them pay for the maintenance of the buildings? You can still allow them to build the CIs but this way they can negate the cost of maintaining them if they want to.

                            ...I'm assuming the virtual buildings have a maintenance cost?

                            Comment


                            • #15
                              Nope... no maintainance cost

                              Here's the way things are structured...

                              In the city data record, there is a function, "GetEffectiveBuildings()" that returns the "effective" buildings the city has. This function returns a combination of the real buildings and the virtual buildings.

                              For effects, "GetEffectiveBuildings()" is called. For upkeep, only the actual buildings are referenced.

                              Comment

                              Working...
                              X