The Forums Are Now Closed!

The content will remain as a historical reference, thank you.

How to mod the AI?

Or is someone working on an AI mod?

By on November 23, 2009 10:55:45 AM from Demigod Forums Demigod Forums

I like fooling around with the skirmish AI, but I do not enjoy beating it all the time on Nightmare difficulty.  I know that the AI has several issues, but fixing two issues in particular would make it a lot more fun to play against. 

First, the AI will rarely buy catapults and giants, even when it has the warscore and income.  It would rather spend its gold on stuff like trebuchets and Finger of God.  My question: Is there a fairly simple way to mod the AI so that it will invest in particular citadel upgrades at a given time?  For example, I would like for it to prioritize buying tower health at warscore 1-3, currency at warscore 3 or so, Catapults at warscore 8-10 (i really don't care when it gets priests and angels), and Giants as soon as it gets warscore 10.  Is there a tool for viewing the AI code and adjusting it in this way?

The second issue is probably a bit more difficult to fix.  The AI has a problem with getting confused and wondering around an enemy base.  I see this kind of often on Leviathan and occasionally Cataract.  It seems to not know where it is and wonders around until it gets killed by one of the citadel towers.  Is there a way to mod the AI so that it flees to its home citadel when its health gets too low in an enemy area (like the enemy citadel)?  Even better, it should not be roaming around an enemy citadel until the towers are destroyed. 

Karma for anyone who can provide helpful advice.

+9 Karma | 8 Replies
November 23, 2009 11:07:47 AM from Demigod Forums Demigod Forums

Ask good ol' Sorian

November 23, 2009 11:27:35 AM from Demigod Forums Demigod Forums

 

For the giants question yes.

 

dgdata.zip\lua\sim\AI\AIGlobals.lua

Assuming this file is not locked to the dgdata asset we should be able to mod this.


CitadelUpgradeWeights = {
    # Fortified Structure
    CBuildingHealth01 = {
        Priority = -1,
    },

    CBuildingHealth02 = {
        Priority = -1,
    },

    CBuildingHealth03 = {
        Priority = -1,
    },

    CBuildingHealth04 = {
        Priority = -1,
    },

    # Building Firepower
    CBuildingStrength01 = {
        Priority = -1,
    },

    CBuildingStrength02 = {
        Priority = -1,
    },

    CBuildingStrength03 = {
        Priority = -1,
    },

    CBuildingStrength04 = {
        Priority = -1,
    },

    # Currency
    CGoldIncome01 = {
        Priority = -1,
    },

    CGoldIncome02 = {
        Priority = -1,
    },

    CGoldIncome03 = {
        Priority = -1,
    },

    # Blacksmith
    CTroopStrength01 = {
        Priority = -1,
    },

    CTroopStrength02 = {
        Priority = -1,
    },

    CTroopStrength03 = {
        Priority = -1,
    },

    CTroopStrength04 = {
        Priority = -1,
    },

    # Armory
    CTroopArmor01 = {
        Priority = -1,
    },

    CTroopArmor02 = {
        Priority = -1,
    },

    CTroopArmor03 = {
        Priority = -1,
    },

    CTroopArmor04 = {
        Priority = -1,
    },

    # Experience
    CPortalFrequency01 = {
        Priority = -1,
    },

    CPortalFrequency02 = {
        Priority = -1,
    },

    CPortalFrequency03 = {
        Priority = -1,
    },

    CPortalFrequency04 = {
        Priority = -1,
    },

    # Graveyard
    CDeathPenalty01 = {
        Priority = 3,
    },

    CDeathPenalty02 = {
        Priority = 6,
    },

    CDeathPenalty03 = {
        Priority = 10,
    },

    # Additional troops
    # Priests
    CTroopNumber03 = {
        Priority = -1,
    },

    # Angels
    CTroopNumber05 = {
        Priority = -1,
    },

    # Catapults
    CTroopNumber04 = {
        Priority = -1,  # angels and catapults were switched.
    },

    # Giants
    CTroopNumber06 = {
        Priority = -1,
    },

    CUpgradeStructure01 = {
        Priority = -1,
    },

    CUpgradeStructure02 = {
        Priority = -1,
    },

 


 

Not sure what -1 does, but if positive numbers do what you expect them to do then seem like the AI is set to pickup graveyard asap. 

 

 

November 23, 2009 11:47:13 AM from Demigod Forums Demigod Forums

 

The other issue might just be a map issue.  The threat detection and retreat seems pretty good in most situations.

November 23, 2009 12:11:24 PM from Demigod Forums Demigod Forums

@Peppe

Many thanks for this! Another rather noobish question: Do I need a particular program to access and mod .lua files? 

+1 Karma

P.S. If Sorian or other knowledgeable folks can help with this, I would be very grateful (and more karma to come!)

November 23, 2009 12:18:36 PM from Demigod Forums Demigod Forums

use notepad, notepad++ or scite.

November 23, 2009 12:36:38 PM from Demigod Forums Demigod Forums

I am not in front of my gaming computer, so I can't really test anything.  However, I will try to mod this later today or tomorrow.  So, how might it work? Tweak the values that Peppe has found in the dgdata.zip\lua\sim\AI\AIGlobals.lua, using Notepad as the text editor.  Then save the modded file in Demigod\bindata\mods\lua\sim\AI\AIGlobals.lua?  Are do you need to put "dgdata.zip" somewhere in the installation path, which would seem odd (that is, to include a .zip file)?

November 24, 2009 12:15:48 AM from Demigod Forums Demigod Forums

 

The_hunger,

 

I have started an Skirmish AI project here: https://forums.demigodthegame.com/369930

 

I think a full skirmish AI will take input and development by multiple people, but have kicked it off with your mod idea.

 

You can start from that file and play with the values in the AIglobal file included to see what priority work best.  You might be able to find min/max priorities and at what value it signifigantly affects the AI.

The priority for citidel upgrades compete with item purchase priorities.

November 24, 2009 1:24:02 AM from Demigod Forums Demigod Forums

I'm no fancy programmer type, but wouldn't be easier to just set a priority list. Like say, you want giants as your top priority so then a list would look like this:

Priests
Angels
Catapultasauri
Giants
Tower health #1
...

Having the list continue down as necessary. In this scenario they'd prioritize buying the units followed by everything else on the list in the order you specify.  Let's say they can't buy angels because the war score isn't high enough, so they'd skip down and buy tower health #1.

I'm just thinking back to Final Fantasy XII and how the gambit system worked. Set the priorities and triggers if need be. I'm partial to that style because then I can tailor my AIs to buy what I want, when I want them to. Including gear if so desired.

Sorry I'm not being real clear on this, but if you've played FFXII or any of Bioware's PC exclusive games (NWN/Baldur's Gate) or Dragon Age: Origins you'd understand what I'm talking about. Though admittedly this would be a far bigger list of scripted commands than what any of those games handled.

Stardock Forums v1.0.0.0    #108435  walnut2   Server Load Time: 00:00:00.0000234   Page Render Time:

Stardock Magazine | Register | Online Privacy Policy | Terms of Use

Copyright ?? 2012 Stardock Entertainment and Gas Powered Games. Demigod is a trademark of Gas Powered Games. All rights reserved. All other trademarks and copyrights are the properties of their respective owners. Windows, the Windows Vista Start button and Xbox 360 are trademarks of the Microsoft group of companies, and 'Games for Windows' and the Windows Vista Start button logo are used under license from Microsoft. ?? 2012 Advanced Micro Devices, Inc. All rights reserved. AMD, the AMD Arrow logo and combinations thereof are trademarks of Advanced Micro Devices, Inc.