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

Civilization 5 Modding Dead.

Discussion in 'Civ5 - Creation & Customization' started by Afforess, Apr 11, 2011.

  1. bitula

    bitula Prince

    Joined:
    Nov 15, 2010
    Messages:
    438
    Well if you are right on this, then they have made a genius work with the scripting layer. I seriously doubt this, since the script functionality is constrained by the native dll functions on which they are built, and so I dont believe, that such versatality is possible unless the whole game is a script, but it is not. Its really, really hard to believe what you are saying, and yes ofcourse, you neet to teach the AI to use new features which you introduced yourself. Whats the point in enabling stacking or creating religion if the AI doesnt know how to handle it, or handles it ineffectively. You say you can do all this with LUA??? I dont think so...
     
  2. SamBC

    SamBC Emperor

    Joined:
    Feb 2, 2010
    Messages:
    1,052
    Location:
    Lancaster
    The big difference for the AI, I think, is that you'll be able to integrate reasoning for a new mechanic directly into existing decision-making. If you add a new empire-wide factor it needs to affect existing decisions, so you'll be able to add it to the algorithms for those, and so on.
     
  3. SamBC

    SamBC Emperor

    Joined:
    Feb 2, 2010
    Messages:
    1,052
    Location:
    Lancaster
    You can make decisions about new features, that aren't alternatives to existing ones (so not suitable for, say, unit actions) in Lua; you can't make new features impact decisions about existing features.
     
  4. smellymummy

    smellymummy King

    Joined:
    Jul 31, 2002
    Messages:
    705
    it is very versatile. if you turn on the console you can browse the 'tables' that shows everything available through the api. it's really extensive. those examples you listed, religion, great generals, very much implementable. great generals being the easier of the two ;)

    couldnt say about corps since im not sure what they're supposed to do in game.

    this is not to say that with lua you can make it civ5->civ4. i've read ideas over the past months where doing something would be impossible with the API, though these were often due to not being able to do something against the game mechanics, and i guess this is where the dll comes in

    ETA:
    the code in here in particular the *track* functions, shows how you can actually take over control of AI unit actions. also some basic functions taking over AI city builds as well. lua lets us do all that

    though this ties back to what i wrote above about making your custom goal AI. just improving the AI movement and war, there's so much to consider: tiles, friendly units, unit strength, overall strategic goal, etc. and of course then that ties itself into production and scientific goals.. its mind boggling. i suppose thats where flavors come in to make the civ programmers job easier
     
  5. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,827
    Location:
    France
    absolutely right, the DLL being also limited on the sound and multiplayer part I guess.

    because you completely underestimate what we can do with the available callbacks

    We can do corporations, religions, great generals, vassals, colonies, revolutions, culture flipping, etc... all with Lua.

    I don't even think it will be easier to do in C++

    But it will run faster, and I suppose, that for big mods conversion from 4 to 5 it's really easier (and faster) to wait for the source and convert the C++ core code of the mod to the new game engine than to translate it in Lua (and then back to C++ when available for performance)

    See my sig for Tile flipping as an example.
     
  6. Spatzimaus

    Spatzimaus Mad Scientist

    Joined:
    Sep 21, 2005
    Messages:
    3,063
    Location:
    Los Angeles, CA
    So you call him a liar, even though WE'VE DONE THESE THINGS, and you haven't even tried. Very nice.

    Lua is extraordinarily flexible, and people have already come up with some spectacular uses, including religions and such. And seriously, unit stacking is in the XML; you change one value, and POOF, stacked units.

    Here's a few modest changes I've added, through Lua, in my own mod:
    > Nuke interception, with the percentages dynamically changing based on how many civs you're at war with and how many have anti-nuke systems (i.e., your enemies pool their interception abilities against you, with a diminishing returns aspect and some caps)
    > EDIT: Forgot to mention Terraforming. Plant jungles, plant forests, create or remove hills, create new resource deposits, change snow into tundra into plains or desert into grassland, that sort of thing.
    > Non-nuke bombardment weapons that damage all enemy units adjacent to the target unit as well.
    > "Critical hit" abilities for units to deal extra damage or to spontaneously heal themselves at the start of a combat.
    > Barbarians healing, and being given random promotions as the game goes on to make them more dangerous.
    > A unit that steals promotions from the units it fights
    > Wonders that give you a chance of stealing techs from other civs, in three different ways
    > Units that can move across both land and sea
    > A "Rookie" promotion that goes away after a unit's first fight, giving him -25% to combat but double XP in that first fight.
    > A psionic class of units that adjust their strength based on the strength of the unit they're fighting; when fighting a stronger unit they'll get up to 25% stronger, when fighting a weaker unit they'll get up to 25% weaker.
    > An "Empath" specialist that gives +1 Happiness to its city, and whose Great Person can be used to create a custom Monolith improvement that gives +3 Happiness in addition to its normal yields.
    > A Wonder that gives every OTHER civ a permanent -10 to their Happiness.
    > Buildings that give temporary promotions to friendly units that start their turn in that city
    > Buildings that give temporary promotions to enemy units that are in your territory
    > A national wonder that gives you warnings when another civ gets close to completing a Wonder of their own.
    > A building type that adds a random chance of triggering a 1-turn Golden Age, with the chance depending on how many of those buildings you have and how big your empire is as a whole.
    > A project that makes every Great Improvement (Academy, Manufactory, etc.) generate Great Person points of the appropriate type.
    > When you build a spaceship, instead of ending the game it gives you a few extra bonuses (free policy, free tech, golden age), and any other civ that finishes their own spaceship within a randomized window will get a lesser bonus. At the end of that window, barbarians swarm all over the world, spaceships no longer can be built, and a few other mod-specific events trigger; after that point, special barbarian bases will begin to randomly spawn inside players' territory and create units until destroyed, with the types of units spawning becoming more dangerous as time goes on.
    > A new victory condition that starts a 20-turn timer, causes everyone to declare war on you, and shrinks your cities by 1 each turn until the timer ends, at which point you win if you're still alive and no one else has won some other way.

    There's more, but this should give an idea of what can be done, and all of the above use a grand total of FIVE Lua events. (Start of turn, end of turn, start of combat, end of combat, on unit created.) Okay, I also use a sixth event, start of game, but not for any of the above. Most of the above aren't even that complicated, so with a little effort you can add all sorts of things. The only real limitation, as mentioned before, is that the AI can't easily be taught to use these new functions so most of them have to be done in "passive" ways where the AI has no decisions to make. The DLL will allow us to fix that, but even within the limits we have now there's a tremendous amount that can be done.

    And there are HUNDREDS of other events out there...
     
  7. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,827
    Location:
    France
    OT, but have you tried to use "plot = unit:LastMissionPlot()" on the attacking unit ?
     
  8. Spatzimaus

    Spatzimaus Mad Scientist

    Joined:
    Sep 21, 2005
    Messages:
    3,063
    Location:
    Los Angeles, CA
    Don't think so; I didn't think the mission plot structures were used on attacks. I'll try it when I get home; that WOULD make things quite a bit easier, since I'd finally be able to add a few custom anti-city abilities I'd been developing (a missile that destroys city defensive structures, for instance).
     
  9. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,827
    Location:
    France
    ok, just tested with land and air units, seems to return the attacked plot, don't know for nukes.
     
  10. bitula

    bitula Prince

    Joined:
    Nov 15, 2010
    Messages:
    438
    No, problem is, most posters here seem not to understand that LUA is a subset of functions of the game which is in C++ which's dll source were talking about or maybe they do not understand the difference between native code and scipts. They seem to think these can substitute each other. The problem is not that how much stuff you can acheive with LUA directly or via workarounds, but that you must rely on firaxis developers to add new functions, new parameters etc, instead of just adding it yourself and then use it yorself in LUA if you like LUA so much. This is what I mean by HUGE difference.
     
  11. SamBC

    SamBC Emperor

    Joined:
    Feb 2, 2010
    Messages:
    1,052
    Location:
    Lancaster
    I don't think anyone would argue against the idea that there's a big difference in the theoretical limitations. However, you seem to be implying throughout that there are huge practical limitations at the moment, and the limitations are actually quite, well, limited.
     
  12. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,827
    Location:
    France
    Exactly what I was about to say.

    And as a modder, I don't see a huge difference between a function used to calculate culture spreading in Lua and the same function in C++

    I don't see the huge difference between implementing a vassalage system à la civ4 in Lua and C++

    etc, etc...

    IMO the broken graphical tools are making a bigger difference than the absence of dll access for huge conversion, that and the lack of documentation on the available lua callbacks (That is something we need the source for)
     
  13. bitula

    bitula Prince

    Joined:
    Nov 15, 2010
    Messages:
    438
    Well yes, if the theoratical limitation holds in practice. And as I see it does. Again: The number of things you can do in LUA is limited to a finite set of functions. The number of things you can "both practically and thoratically" do in the source code is UNLIMITED (excluding graphical engine, audio etc., but that is not available for LUA either.). Its not about C++ or LUA, if the core game would have been written in LUA and the modding layer in C++ (which ofcourse is nonsense), than I would ask: when will LUA source will be released.
     
  14. Putmalk

    Putmalk Deity

    Joined:
    Sep 26, 2010
    Messages:
    2,623
    Location:
    New York
    Questions about using all of these new LUA functions:

    1) How does it affect loading times for the mod (when you enable it)?
    2) How does it affect performance in-game (turn-times)?
    3) How difficult is it to debug these LUA functions?
    4) When you scripted these LUA functions, I assume you created a brand new LUA file as opposed to modifying originals?

    @Spatz
     
  15. Spatzimaus

    Spatzimaus Mad Scientist

    Joined:
    Sep 21, 2005
    Messages:
    3,063
    Location:
    Los Angeles, CA
    No significant difference that I've been able to note, although since I rarely play an unmodded game any more it's hard to do a direct comparison. Someone who only occasionally uses my mod would be a better source for this answer.

    Same as above. I've specifically avoided large-overhead loops (like looping over the entire map), so none of my functions require significant execution time, and the best I can say is that when I play I don't notice significant slowdown.

    Trivial. You type things like:
    Code:
    print("Name: ",bName,mPlayer:GetName(),row.StealTechPercentCivs,row.StealTechChance);
    
    and the print statement will execute in your FireTuner with all of the variables. While it's not as convenient as a true graphical debugger with breakpoints and such, it suffices for what you can do with Lua.

    Correct. If you download my mods, and go into the Lua directory for each, you'll see files that I created. In my Balance mod there's just a small HeadStart.lua; the Content mod adds Terraform.lua, SpatzEndTurn.lua, SpatzMove.lua (not currently used), SpatzStartTurn.lua, SpatzUnit.lua, and the big one is SpatzWonders.lua, which covers all of my building/project bonuses and nearly everything involved with my space race event overrides. My Content mod also includes copies of WhysUtils.lua (Whys' utility functions for the save/load functionality) and Whys' CustomNotificationPanel.lua and BuildingResources.lua files.
     
  16. Putmalk

    Putmalk Deity

    Joined:
    Sep 26, 2010
    Messages:
    2,623
    Location:
    New York
    Thanks, mate. I'm looking into LUA soon and I want to get a handle on how it affects the gameplay.
     
  17. primordial stew

    primordial stew Emperor

    Joined:
    Sep 1, 2005
    Messages:
    1,219
    Location:
    a puddle
    There is a mod I want to create, but it's held up on needing key Lua functions. I have the map ready along with the Lua to throw out the first 5 months of reinforcements.

    Is it possible now, to do the following?

    1) limit a hex to 1 combat per player turn
    2) limited replacements/healing, and handled by the AI
    3) scripted reinforcements considered by the AI
    4) zone based weather effects, and considered by the AI
    5) maxHP set for each unit
    6) an air unit can perform either offensive or defensive support on each turn
    7) no city production (all cities are puppets). Replacement points can either be used to replace loses in live units, or to reconstitute eliminated units.
     
  18. Gedemon

    Gedemon Modder Super Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,827
    Location:
    France
    may be wrong, but :
    1/ no, need the dll or a CanAttack game event
    2/ yes, but define "handled by the AI"
    3/ yes, and again define what you want of the AI
    4/ depend of what you plan
    5/ difficult
    6/ see 4
    7/ yes
     
  19. primordial stew

    primordial stew Emperor

    Joined:
    Sep 1, 2005
    Messages:
    1,219
    Location:
    a puddle
    > "handled by the AI"

    As applied to limited replacements, the AI (and player somehow) would now have a limited set of replacements so would have the additional task of prioritizing how they are allocated.

    As applied to scripted reinforcements, when considering where to defend it will be essential to know where reinforcements are coming. If there are currently 4 units available, but 8 are needed in that area, then if another 4 are not coming then it would be best to retreat.


    > maxHP

    I need this to be easy. A new XML field, and modifications to the section of the code that implement healing so that it stops at the appropriate value.
     

Share This Page