1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

How to compile the DLL

Discussion in 'Civ5 - SDK / LUA' started by DaveMcW, Nov 2, 2012.

  1. ww2commander

    ww2commander Emperor

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    enhancement

    EDIT: To quote that reliable source of truth known as Wikipedia
    "A software bug is an error, flaw, mistake, failure, or fault in a computer program or system that produces an incorrect or unexpected result, or causes it to behave in unintended ways"

    Thus to use your example...a lack of canals is not a bug but an oversight or limitation. Ships losing all their HP points when entering a city would be a bug.

    I know you agree with me whoward and just playing devil's advocate so I thought I would clarify this further for those who come along and read the last few threads thinking 'wish-list' time!
     
  2. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,658
    Location:
    France
    There is a proposal here, but that's not for a "single community DLL", more an easier way to pick the change you want and combine them in a DLL.

    One important thing here I think, is to make gameplay change optional when possible, as whoward69 is doing, this way if a DLL is widely used, each mod needing it could activate or not the new "features".
     
  3. trystero49

    trystero49 Prince

    Joined:
    Apr 30, 2012
    Messages:
    515
    Another important thing is documentation. If a modder includes (added by:[AUTHOR]) in the comments next to every change then things will be a lot easier to look through and decide what parts they want.
     
  4. Irkalla

    Irkalla ENTP POWWWEEEEEER

    Joined:
    Sep 25, 2012
    Messages:
    1,009
    Location:
    Way down around Vicksburg
    I still have no idea why we can't just make DLLs, and ship with a standard GameCore that includes whatever DLLs are mentioned in a certain XML file.

    I'm not versed in C++ at all, but I'm fairly sure you can include.
     
  5. trystero49

    trystero49 Prince

    Joined:
    Apr 30, 2012
    Messages:
    515
    BTW, I changed the build directory and I built the .dll but it generated 29 warnings about various .pdb files with the comment "linking object as if no debug info". Will this be a problem?

    Also, it builds .pdb, .lib and .exp files as well as a .dll. What do I use those files for? Can I ignore them?

    Thanks.
     
  6. isnorden

    isnorden Amnesiac Modder

    Joined:
    Jul 6, 2012
    Messages:
    608
    Location:
    Madison, Wisconsin, USA


    Thanks for letting me know; you saved me a little unnecessary work/installing, since I'm lucky enough to have a copy of VS 2010 Pro at home and already installed C++, thinking that it might help with game-editing projects. I take it the SDK subfolder would get copied into the corresponding folder for Visual C++ 2010? :) (Sorry if I seem completely clueless here; I'm just beginning to learn DLL editing here, and going about it the same way I did with XML--examine the core game code, memorize the snippets for behaviors I know, and ask for help when I get stuck.)
     
  7. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,524
    Location:
    Near Portsmouth, UK
    AFAIK you just need to copy CvGameCoreSource to "the usual place" (on my machine it's "C:\Users\{username}\Documents\Visual Studio 2010\Projects") BUT you will still need to install VS 2008 (you can use the Express version)
     
  8. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    Warnings won't prevent compilation... can usually be ignored, but useful to keep track of if something unexpected happens. You can ignore those files but you'll want to keep them around. They speed up future compilation times.

    This is the difference between a language that is interpreted vs. compiled. In C++, "include" doesn't mean "load that file when you're loading this one" - it tells the compiler to literally copy and paste the text of that file over the include statement. There is no practical difference between placing #include "CvMap.h" in your file and pasting the entire contents of CvMap.h onto that spot. And of course, compilation happens modder-side before distribution, not user-side when run (otherwise civ5 would take 20 minutes to load).

    Never cared for the "many small mods on the buffet table" approach myself. I prefer larger mods like Rhye's and Fall of Civilization and Fall from Heaven. I wouldn't be surprised if many people who had plans for what to do when the DLL was released are the same way; the DLL lends itself more to those mods than the small mods, especially with Lua being able to do more than civ4's python.
     
  9. croxis

    croxis Chat room op

    Joined:
    Dec 17, 2001
    Messages:
    3,277
    Location:
    Portland, OR, US
    c:\users\croxis\documents\src\civvsdk\cvgamecoredll_expansion\CvGameCoreDLLPCH.h(58): fatal error C1083: Cannot open include file: 'unordered_set': No such file or directory

    When trying to build.
     
  10. DaveMcW

    DaveMcW Deity

    Joined:
    Oct 8, 2002
    Messages:
    6,489
    You're missing Service Pack 1, probably because you didn't use the download link in the first post.
     
  11. schmop

    schmop Chieftain

    Joined:
    Nov 19, 2011
    Messages:
    22
    A dll is loaded at runtime, nothing to do with includes. You could even build in some dynamic dll loading into the civ dll, I guess. A first step towards multiple mods modifying the dll, perhaps?

    I wanted to check how difficult it would be to tinker with the tactical AI... 9000 lines of c++ tells me it's probably gonna be quite a challenge :sad:
     
  12. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    A DLL is compiled from all the .cpp and .h files; when we speak of DLL modding, we are actually speaking of changing the .cpp and .h files and compiling a new DLL. It is only this final compiled code that is loaded at runtime, not the source.

    While I don't have civ5, the civ4 C++ code was interdependent to such a degree that even a simple change as adding a new XML field required changing code in dozens of locations. If the civ5 DLL is in any way similar, it would be flat out impossible for two modders to make changes the the DLL that don't conflict with each other. Even merging two civ4 DLL mods required the work of an expert programmer.
     
  13. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,872
    Location:
    DE/NL/FR
    He's not talking about that.
    Theoretically it's possible to load a second dll from a first dll.
    But I have no clue how this would be interconnected, how this would practically work in regards to merging stuff, and would probably also be lots of work, and at the end probably not worth it.
     
  14. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,658
    Location:
    France
    I really put some great hopes in something like what is proposed in the Git thread...
     
  15. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,524
    Location:
    Near Portsmouth, UK
    It's more than theory! It's known as "dependancy injection" and is part of the Inversion of Control / Aspect Orientated Programming (IoC/AOP) frameworks such as Spring for Java and PocoCapsule for C++

    But the use of such frameworks needs to be adopted from Day 1 - not 2 years down the track
     
  16. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    Given the way XML and Lua work in civ5, I suspect that if Firaxis had made the code in such a way to allow for this to be practical that they would have done so.
     
  17. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,872
    Location:
    DE/NL/FR
    Depends on if you have the people with the experience to do that.
    The other stuff is sure set up in a very professional way, but they had already some experience in that area.

    But since whoward pointed out that this is rather a big thing, I guess they didn't have the people who knew enough about it.

    Oh, 'kay. Not much of a pro in that area :D.
     
  18. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,524
    Location:
    Near Portsmouth, UK
    I have the advantage that IoC/AOP is (part of) my day job :D
     
  19. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    32,872
    Location:
    DE/NL/FR
    Oh...then you now know what we expect from you :D.
     
  20. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,524
    Location:
    Near Portsmouth, UK
    Didn't realise I started this two years ago ;) - perhaps I should send Firaxis two-years worth of consultancy invoices and see what happens :lol:
     

Share This Page